blob: d3f97aff1b94e3744bd9d4ad3b5fc13fd8efcc48 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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"
}
|