From 97b2f81875c15e59958d4bd40322a016c4e91652 Mon Sep 17 00:00:00 2001 From: Jonathan Bauer Date: Wed, 2 Mar 2022 16:55:26 +0100 Subject: build-initramfs.sh: fix error parsing whitespace as unknown arguments --- build-initramfs.sh | 82 +++++++++++++++++++++++++++++++++++------------------- 1 file changed, 53 insertions(+), 29 deletions(-) diff --git a/build-initramfs.sh b/build-initramfs.sh index f6c54ce0..498e8f07 100755 --- a/build-initramfs.sh +++ b/build-initramfs.sh @@ -43,7 +43,7 @@ declare -A core_repo=( [handler]="git" [path]="$_repo_dir" [url]="git://git.openslx.org/openslx-ng/systemd-init.git" - [branch]="downloader-cmake-refactor" + [branch]="downloader" ) declare -A core_dracut=( @@ -56,27 +56,38 @@ declare -A module_dnbd3=( [handler]="git" [path]="${_repo_dir}/modules.d/dnbd3-rootfs/binaries/dnbd3" [url]="git://git.openslx.org/dnbd3.git" - [branch]="workqueue" -) - -declare -A module_xloop=( - [handler]="git" - [path]="${_repo_dir}/modules.d/dnbd3-rootfs/binaries/xloop" - [url]="git://git.openslx.org/openslx-ng/xloop.git" + [branch]="master" + [commit]="c881c79" ) declare -A module_qemu_xmount=( - [handler]="http" + [handler]="git" [path]="${_repo_dir}/modules.d/dnbd3-rootfs/binaries/qemu-xmount" - [url]="https://github.com/eaas-framework/qemu/tarball/4873cd023da8511ed9792a318d1456c949046123" + [url]="git://github.com/eaas-framework/qemu.git" + [branch]="libxmount_input" + [commit]="4873cd023da8511ed9792a318d1456c949046123" ) declare -A module_xmount=( - [handler]="http" + [handler]="git" [path]="${_repo_dir}/modules.d/dnbd3-rootfs/binaries/xmount" - [url]="https://github.com/eaas-framework/xmount/tarball/015137556fce1e21273f198ae0b9158157f74f74" + [url]="git://github.com/eaas-framework/xmount.git" + [branch]="master" + [commit]="0151375" +) + +declare -A module_kernel_qcow2_linux=( + [handler]="git" + [url]="git://git.openslx.org/openslx-ng/xloop.git" + [path]="${_repo_dir}/modules.d/dnbd3-rootfs/binaries/xloop" ) +declare -A module_kernel_qcow2_util_linux=( + [handler]="git" + [url]="git://git.openslx.org/openslx/kernel-qcow2-util-linux.git" + [path]="${_repo_dir}/modules.d/dnbd3-rootfs/binaries/kernel-qcow2-util-linux" + [branch]="xloop-hack" +) declare -A override @@ -102,17 +113,6 @@ bootstrap() { fi echo "######################### $module #########################" if [ -n "${override["$module"]}" ]; then - echo "Module overriden: ${override["$module"]}" - IFS='|' read -r -a pairs <<< "${override["$module"]}" - declare -p pairs - for pair in "${pairs[@]}"; do - IFS='=' read -r key value <<< "$pair" - _ref["$key"]="$value" - done - fi - echo "Handler: ${_ref[handler]}" - echo " URL: ${_ref[url]}" - echo " Branch: ${_ref[branch]}" echo " Commit: ${_ref[commit]}" echo " Path: ${_ref[path]}" @@ -316,9 +316,12 @@ parse_command_line() { break ;; *) - echo \ - "Error with given option \"$1\": This argument is not available." - return 1 + if [ -n "$1" ]; then + echo \ + "Error with given option \"$1\": This argument is not available." + return 1 + fi + ;; esac shift done @@ -416,6 +419,30 @@ main() { popd || exit 1 fi + echo 'Checking dracut...' + kernel_version="$(uname -r)" + fi + echo " * kernel version: $kernel_version" + # similar for kernel headers needed to compile dnbd3 against. + if [ -z "$kernel_headers" ]; then + kernel_headers="/lib/modules/${kernel_version}/build" + fi + if [ ! -f "${kernel_headers}/Makefile" ]; then + echo 'Missing kernel headers for given kernel!' + exit 1 + fi + echo " * kernel headers: $kernel_headers" + if [ -n "$qcow_handler" ]; then + echo " * qcow2 handler: $qcow_handler" + export qcow_handler + fi + + if [ "$update" = "yes" ]; then + pushd "${_repo_dir}" || exit 1 + git pull + popd || exit 1 + fi + echo 'Checking dracut...' if [ ! -f "${_dracut_dir}/dracut-install" ]; then echo "Dracut isn't available yet loading it." @@ -481,9 +508,6 @@ main() { exit 0 fi - # ask password shice wegkloppen - sed -i '/systemd-ask-password/d' "${_dracut_dir}/modules.d/00systemd/module-setup.sh" - echo 'Building initramfs...' "${_dracut_dir}/dracut.sh" --local \ --modules "${dracut_modules[*]}" --conf /etc/dracut.conf \ -- cgit v1.2.3-55-g7522