mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-23 11:00:25 +00:00
Merge pull request #163 from nathanleclaire/bootflag
Add 'bootflag' script to check kernel flags
This commit is contained in:
commit
d0c8e5de01
@ -73,6 +73,7 @@ COPY packages/userns/useradd /usr/sbin
|
||||
COPY packages/vsudd/vsudd /sbin
|
||||
COPY packages/vsudd/etc /etc
|
||||
COPY packages/mobyconfig/mobyconfig /usr/bin
|
||||
COPY packages/bootflag/bootflag /usr/bin
|
||||
COPY packages/gummiboot/gummiboot.tar.gz /usr/share/src/
|
||||
COPY packages/oom/etc /etc
|
||||
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