summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2021-10-20 11:03:31 +0200
committerSimon Rettberg2021-10-20 11:03:31 +0200
commit24b31716778e20adf4251eb095c57bcb56788b8c (patch)
tree69504bedcddbfe9d9237c618f51047e3d6b2e98b
parentUse reasonable timeouts (diff)
downloadsystemd-init-24b31716778e20adf4251eb095c57bcb56788b8c.tar.gz
systemd-init-24b31716778e20adf4251eb095c57bcb56788b8c.tar.xz
systemd-init-24b31716778e20adf4251eb095c57bcb56788b8c.zip
Simplify cmdline parsing, check qcow handler, don't build unused one
-rwxr-xr-xbuild-initramfs.sh41
1 files changed, 14 insertions, 27 deletions
diff --git a/build-initramfs.sh b/build-initramfs.sh
index b00839df..e4b213f6 100755
--- a/build-initramfs.sh
+++ b/build-initramfs.sh
@@ -61,8 +61,8 @@ declare -A module_dnbd3=(
declare -A module_xloop=(
[handler]="git"
- [url]="git://git.openslx.org/openslx-ng/xloop.git"
[path]="${_repo_dir}/modules.d/dnbd3-rootfs/binaries/xloop"
+ [url]="git://git.openslx.org/openslx-ng/xloop.git"
)
declare -A module_qemu_xmount=(
@@ -219,16 +219,13 @@ parse_command_line() {
while true; do
case "$1" in
-h|--help)
- shift
print_help_message "$0"
exit 0
;;
-v|--verbose)
- shift
verbose='yes'
;;
-d|--debug)
- shift
debug='yes'
;;
-p|--file-path)
@@ -241,18 +238,14 @@ parse_command_line() {
"This option needs a path to save initramfs image to."
return 1
fi
- shift
;;
-c|--cleanup)
- shift
cleanup='yes'
;;
-f|--full-cleanup)
- shift
full_cleanup='yes'
;;
-s|--use-systemd-in-initramfs)
- shift
use_systemd_in_initramfs='yes'
;;
-t|--target)
@@ -265,10 +258,8 @@ parse_command_line() {
"This option needs a path create initramfs from."
return 1
fi
- shift
;;
-i|--init)
- shift
initialize='yes'
;;
-k|--kernel-version)
@@ -281,7 +272,6 @@ parse_command_line() {
"This option needs a kernel version to build the initramfs for."
return 1
fi
- shift
;;
-H|--kernel-headers)
local given_argument="$1"
@@ -293,22 +283,13 @@ parse_command_line() {
"This option needs the path to the kernel headers."
return 1
fi
- shift
;;
-q|--qcow-handler)
local given_argument="$1"
shift
qcow_handler="$1"
- if [ -z "$qcow_handler" ]; then
- echo \
- "Error with given option \"$given_argument\":" \
- "This options needs to be either 'xmount' or 'kernel'."
- return 1
- fi
- shift
;;
-u|--update)
- shift
update='yes'
;;
-O|--override-module)
@@ -328,16 +309,10 @@ parse_command_line() {
override_argument="|${override_argument}"
fi
override["$override_module"]+="$override_argument"
- shift
;;
-)
shift
- while [[ "$1" =~ ^.+$ ]]; do
- dracut_parameter+=("$1")
- shift
- done
- ;;
- '')
+ dracut_parameter+=( "$@" )
break
;;
*)
@@ -345,8 +320,20 @@ parse_command_line() {
"Error with given option \"$1\": This argument is not available."
return 1
esac
+ shift
done
+ if [ "$qcow_handler" = "xmount" ]; then
+ unset module_xloop
+ elif [ "$qcow_handler" = "xloop" ]; then
+ unset module_xmount
+ else
+ echo \
+ "Error with given option '--qcow-handler/-q':" \
+ "This options needs to be either 'xmount' or 'xloop', given: '$qcow_handler'."
+ return 1
+ fi
+
return 0
}
## endregion