mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-27 12:38:11 +00:00
Add 'bootflag' script to check kernel flags
Signed-off-by: Nathan LeClaire <nathan.leclaire@gmail.com>
This commit is contained in:
parent
312f45babb
commit
810d50aef0
@ -73,6 +73,7 @@ COPY packages/userns/useradd /usr/sbin
|
|||||||
COPY packages/vsudd/vsudd /sbin
|
COPY packages/vsudd/vsudd /sbin
|
||||||
COPY packages/vsudd/etc /etc
|
COPY packages/vsudd/etc /etc
|
||||||
COPY packages/mobyconfig/mobyconfig /usr/bin
|
COPY packages/mobyconfig/mobyconfig /usr/bin
|
||||||
|
COPY packages/bootflag/bootflag /usr/bin
|
||||||
COPY packages/gummiboot/gummiboot.tar.gz /usr/share/src/
|
COPY packages/gummiboot/gummiboot.tar.gz /usr/share/src/
|
||||||
COPY packages/oom/etc /etc
|
COPY packages/oom/etc /etc
|
||||||
COPY packages/9pmount-vsock/9pmount-vsock /sbin
|
COPY packages/9pmount-vsock/9pmount-vsock /sbin
|
||||||
|
24
alpine/packages/bootflag/bootflag
Executable file
24
alpine/packages/bootflag/bootflag
Executable file
@ -0,0 +1,24 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Script to print values of arbitrary kvpairs the kernel was passed as command
|
||||||
|
# line parameters on boot.
|
||||||
|
#
|
||||||
|
# e.g. if kernel booted with cloud_provider=azure, 'bootflag cloud_provider'
|
||||||
|
# will return 'azure'.
|
||||||
|
#
|
||||||
|
# If multiple flags have the same key, it will return only the first one found.
|
||||||
|
|
||||||
|
if [ $# -ne 1 ]; then
|
||||||
|
echo "Usage: bootflag [key]"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
awk -v flag=$1 '{
|
||||||
|
for(i = 1; i <= NF; i++) {
|
||||||
|
split($i, kvpair, "=");
|
||||||
|
if(kvpair[1] == flag) {
|
||||||
|
print kvpair[2];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}' /proc/cmdline
|
Loading…
Reference in New Issue
Block a user