diff options
author | Cem Keylan <cem@ckyln.com> | 2020-08-13 11:36:52 +0300 |
---|---|---|
committer | Cem Keylan <cem@ckyln.com> | 2020-08-13 11:36:52 +0300 |
commit | da7d85d81a596c3f6668def35a252e5d9c06777b (patch) | |
tree | 41182d3539e975d354baa4d714e305516d1af65c /rc.lib | |
parent | 95c655caffe9bd2c1cc2e99dda79cfeac4455fad (diff) | |
download | init-da7d85d81a596c3f6668def35a252e5d9c06777b.tar.gz |
rc.lib: simplify kernel command line parsing function
Instead of specifying each variable, you can now set anything from
the kernel command line.
Diffstat (limited to 'rc.lib')
-rw-r--r-- | rc.lib | 17 |
1 files changed, 8 insertions, 9 deletions
@@ -109,15 +109,14 @@ parse_cmdline() { # We want to read words instead of lines here. # shellcheck disable=2013 - for arg in $(cat /proc/cmdline); do - case "$arg" in - ro) RO=1 ;; - forcefsck) FORCEFSCK="-f" ;; - fastboot) FASTBOOT=1 ;; - loglevel=?) dmesg_level=${arg#loglevel=} ;; - devd=*) devd=${arg#devd=} ;; - esac - done + while read -r cmdline; do + for arg in $cmdline; do + case "$arg" in + *=*) export "$arg" ;; + *) export "$arg=1" ;; + esac + done + done < /proc/cmdline } random() { |