aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKARBOWSKI Piotr <piotr.karbowski@gmail.com>2017-12-27 19:50:11 +0100
committerKARBOWSKI Piotr <piotr.karbowski@gmail.com>2017-12-27 19:50:11 +0100
commit98f3443c3b9a4a7a13b35b40868acad83013eaa8 (patch)
treeaee3a555882a07ee6ccf5b56cfd7c04668ffee38
parentCopyright year update (diff)
downloadbetter-initramfs-98f3443c3b9a4a7a13b35b40868acad83013eaa8.tar.xz
better-initramfs-98f3443c3b9a4a7a13b35b40868acad83013eaa8.zip
simplify process_commandline_options()
-rw-r--r--ChangeLog2
-rwxr-xr-xsourceroot/functions.sh68
2 files changed, 11 insertions, 59 deletions
diff --git a/ChangeLog b/ChangeLog
index 32a916e..d616353 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,8 @@
For details check git history.
devel branch:
+ - simplify process_commandline_options() by dropping get_opt() all
+ together
- uswsusp support removed.
I had mixed luck with this one, and found that the in-kernel swsusp just
works, and after resume system is snappier. I don't think anyone used
diff --git a/sourceroot/functions.sh b/sourceroot/functions.sh
index 00f82b9..b67820c 100755
--- a/sourceroot/functions.sh
+++ b/sourceroot/functions.sh
@@ -39,6 +39,10 @@ InitializeBusybox() {
}
rescueshell() {
+ if [ "${console}" ]; then
+ console="${console%,*}"
+ fi
+
if [ "$rescueshell" != 'true' ]; then
# If we did not forced rescueshell by kernel opt, print additional message.
ewarn "Dropping to rescueshell because of above error."
@@ -74,10 +78,6 @@ run() {
fi
}
-get_opt() {
- echo "${*#*=}"
-}
-
run_hooks() {
# Support for optional code injection via hooks placed into
# multiple initramfs images.
@@ -143,15 +143,6 @@ process_commandline_options() {
initramfsdebug)
set -x
;;
- root\=*)
- root=$(get_opt $i)
- ;;
- init\=*)
- init=$(get_opt $i)
- ;;
- enc_root\=*)
- enc_root=$(get_opt $i)
- ;;
luks)
luks=true
;;
@@ -170,59 +161,14 @@ process_commandline_options() {
tuxonice)
tuxonice=true
;;
- resume\=*)
- resume=$(get_opt $i)
- ;;
- rootfstype\=*)
- rootfstype=$(get_opt $i)
- ;;
-
- rootflags\=*)
- rootfsmountparams="-o $(get_opt $i)"
- ;;
-
ro|rw)
root_rw_ro=$i
;;
sshd)
sshd=true
;;
- sshd_wait\=*)
- sshd_wait=$(get_opt $i)
- ;;
- sshd_port\=*)
- sshd_port=$(get_opt $i)
- ;;
- sshd_interface\=*)
- # deprecated
- sshd_interface=$(get_opt $i)
- ;;
- sshd_ipv4\=*)
- # deprecated
- sshd_ipv4=$(get_opt $i)
- ;;
- sshd_ipv4_gateway\=*)
- # deprecated
- sshd_ipv4_gateway=$(get_opt $i)
- ;;
- binit_net_if\=*)
- binit_net_if=$(get_opt $i)
- ;;
- binit_net_addr\=*)
- binit_net_addr=$(get_opt $i)
- ;;
binit_net_route\=*)
- binit_net_routes="${binit_net_routes} $(get_opt $i)"
- ;;
- binit_net_gw\=*)
- binit_net_gw=$(get_opt $i)
- ;;
- rootdelay\=*)
- rootdelay=$(get_opt $i)
- ;;
- console\=*)
- console=$(get_opt $i)
- console="${console%,*}"
+ binit_net_routes="${binit_net_routes} ${i#*=}"
;;
mdev)
mdev=true
@@ -233,6 +179,10 @@ process_commandline_options() {
bcache)
bcache=true
;;
+ *=*)
+ # Catch-all.
+ export "${i%%=*}=${i#*=}"
+ ;;
esac
done
}