mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-12-25 06:22:40 +00:00
25 lines
568 B
Bash
Executable File
25 lines
568 B
Bash
Executable File
#!/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
|