summaryrefslogtreecommitdiffstats
path: root/testModule/library.sh
diff options
context:
space:
mode:
authortorben2015-04-09 03:27:39 +0200
committertorben2015-04-09 03:27:39 +0200
commit3541f12849b277a2405a4d3bf692cf62f2045126 (patch)
tree065f302e6fe108d53771bf421429224202ba33f1 /testModule/library.sh
parentTrying convert given pxe ip configuration to dracut compatible one. (diff)
downloadsystemd-init-3541f12849b277a2405a4d3bf692cf62f2045126.tar.gz
systemd-init-3541f12849b277a2405a4d3bf692cf62f2045126.tar.xz
systemd-init-3541f12849b277a2405a4d3bf692cf62f2045126.zip
Adding functions library.
Diffstat (limited to 'testModule/library.sh')
-rw-r--r--testModule/library.sh38
1 files changed, 38 insertions, 0 deletions
diff --git a/testModule/library.sh b/testModule/library.sh
new file mode 100644
index 00000000..d3f97aff
--- /dev/null
+++ b/testModule/library.sh
@@ -0,0 +1,38 @@
+cat /proc/cmdline >/tmp/cmdline
+
+replace_cmd() {
+ sed --regexp-extended "s/$1=[^ ]*/$1=$2/g" /tmp/cmdline -i
+}
+
+getcmdline() {
+ local _line
+ local _i
+ local CMDLINE_ETC_D
+ local CMDLINE_ETC
+ unset _line
+
+ if [ -e /etc/cmdline ]; then
+ while read -r _line; do
+ CMDLINE_ETC="$CMDLINE_ETC $_line";
+ done </etc/cmdline;
+ fi
+ for _i in /etc/cmdline.d/*.conf; do
+ [ -e "$_i" ] || continue
+ while read -r _line; do
+ CMDLINE_ETC_D="$CMDLINE_ETC_D $_line";
+ done <"$_i";
+ done
+ ## NOTE: We modify this to be able to alter kernel command line arguments
+ ## at runtime.
+ if [ -e /tmp/cmdline ]; then
+ read -r CMDLINE </tmp/cmdline;
+ CMDLINE="$CMDLINE_ETC_D $CMDLINE_ETC $CMDLINE"
+ else
+ ##
+ if [ -e /proc/cmdline ]; then
+ read -r CMDLINE </proc/cmdline;
+ CMDLINE="$CMDLINE_ETC_D $CMDLINE_ETC $CMDLINE"
+ fi
+ fi
+ printf "%s" "$CMDLINE"
+}