Merge pull request #163 from nathanleclaire/bootflag

Add 'bootflag' script to check kernel flags
This commit is contained in:
Justin Cormack 2016-06-02 11:58:44 +01:00
commit d0c8e5de01
2 changed files with 25 additions and 0 deletions

View File

@ -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

View 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