diff options
| author | jandob | 2015-12-04 15:00:41 +0100 |
|---|---|---|
| committer | jandob | 2015-12-04 15:00:41 +0100 |
| commit | feefc52a95202fc5af7fb987e6140eed6f8f39bf (patch) | |
| tree | 819c73ecf2a53432a9e45684d3cc0b9747107e67 /builder | |
| parent | update rebash (diff) | |
| parent | Sync (diff) | |
| download | systemd-init-feefc52a95202fc5af7fb987e6140eed6f8f39bf.tar.gz systemd-init-feefc52a95202fc5af7fb987e6140eed6f8f39bf.tar.xz systemd-init-feefc52a95202fc5af7fb987e6140eed6f8f39bf.zip | |
Merge branch 'master' of git.openslx.org:openslx-ng/systemd-init
Diffstat (limited to 'builder')
| -rwxr-xr-x | builder/build-initramfs.sh | 57 | ||||
| -rwxr-xr-x | builder/dnbd3-rootfs/module-setup.sh | 12 |
2 files changed, 53 insertions, 16 deletions
diff --git a/builder/build-initramfs.sh b/builder/build-initramfs.sh index cb85a86e..41a8af24 100755 --- a/builder/build-initramfs.sh +++ b/builder/build-initramfs.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash # -*- coding: utf-8 -*- -# region header +# region header # Copyright Torben Sickert (t.sickert["~at~"]gmail.com) 29.10.2015 # Janosch Dobler (TODO) 29.10.2015 @@ -54,7 +54,25 @@ # endregion +set -o errexit +build_initramfs__needed_location='./dnbd3-rootfs' +if ! [[ -d "$build_initramfs__needed_location" ]]; then + echo "The dnbd3 dracut plugin isn't available, loading it." + build_initramfs__temporary_repository_location="$(mktemp --directory)" + git clone git://git.openslx.org/openslx-ng/systemd-init.git \ + "$build_initramfs__temporary_repository_location" + pushd "$build_initramfs__temporary_repository_location" + git submodule init + git submodule update + popd + cp --recursive "$build_initramfs__temporary_repository_location" \ + "$build_initramfs__needed_location" + rm --recursive --force "$build_initramfs__temporary_repository_location" +fi +set +o errexit + source "$(dirname "${BASH_SOURCE[0]}")/dnbd3-rootfs/scripts/rebash/core.sh" +exit 0 core.import logging core.import utils core.import exceptions @@ -66,6 +84,7 @@ logging.set_log_level critical # region properties +build_initramfs_dracut_parameter='--force --no-hostonly' build_initramfs_verbose='no' build_initramfs_debug='no' build_initramfs_create_system_image='' @@ -107,6 +126,9 @@ function build_initramfs_print_command_line_option_description() { -i --create-system-image Creates an image under given path from current system. (default: "$build_initramfs_create_system_image"). + +Additional dracut parameter and normal parameter can be deleimiter via a single +dash (-) (default: "$build_initramfs_dracut_parameter"). EOF } function build_initramfs_print_help_message() { @@ -153,6 +175,14 @@ function build_initramfs_parse_command_line() { fi shift ;; + -) + shift + while [[ "$1" =~ ^.+$ ]]; do + build_initramfs_dracut_parameter+=" $1" + shift + done + shift + ;; '') break @@ -225,13 +255,16 @@ function build_initramfs_cleanup() { # region controller -# TODO check for existing kernel headers: - # ubuntu: sudo apt-get install linux-headers-$(uname -r) -# TODO Check for: -# /usr/lib/x86_64-linux-gnu/libz.so ldconfig -p |grep libz.so -# for dnbd3 - utils.dependency_check "${build_initramfs_dependencies[*]}" +# TODO check for existing kernel headers. +if false; then + logging.error "You have to install the compression library \"libz\". Otherwise we aren't able to compile dnbd3 for your kernel." + exit 1 +fi +if ! ldconfig --print-cache | grep libz.so; then + logging.critical "You have to install the compression library \"libz\". Otherwise we aren't able to compile dnbd3 for your kernel." + exit 1 +fi if ! build_initramfs_parse_command_line "$@"; then build_initramfs_print_help_message "$0" exit 1 @@ -274,10 +307,14 @@ elif [[ "$build_initramfs_cleanup" == 'yes' ]]; then build_initramfs_cleanup else logging.info 'Build initramfs.' - dracut/dracut.sh --local $build_initramfs__loglevel --force --modules \ - "$build_initramfs__modules" --no-hostonly /boot/initramfs-test.img + # NOTE: We deactivate our exception handle since dracut returns "1" if it + # is launched with help parameter ("-h" or "--help"). + exceptions.deactivate + dracut/dracut.sh --local $build_initramfs__loglevel --modules \ + "$build_initramfs__modules" ${build_initramfs_dracut_parameter[*]} \ + /boot/initramfs-test.img + exceptions.activate fi -logging.info 'Done!' exceptions.deactivate # endregion diff --git a/builder/dnbd3-rootfs/module-setup.sh b/builder/dnbd3-rootfs/module-setup.sh index 2d5528f8..64452cfe 100755 --- a/builder/dnbd3-rootfs/module-setup.sh +++ b/builder/dnbd3-rootfs/module-setup.sh @@ -45,14 +45,14 @@ check() { # NOTE: This are workarounds for: # - distributions where "systemd-udevd" doesn't lives in "/usr/lib" but in # "/lib". - if [[ ! -f "${systemdutildir}/systemd-udevd" ]] && [[ -f /lib/systemd/systemd-udevd ]]; then + local alternate_systemd_udevd_location='/lib/systemd/systemd-udevd' + if [[ ! -f "${systemdutildir}/systemd-udevd" ]] && \ + [[ -f "$alternate_systemd_udevd_location" ]]; then mkdir --parents "${initdir}${systemdutildir}" - # TODO - #echo "${initdir}${systemdutildir}/systemd-udevd" - #echo /usr/lib/systemd/systemd-udevd - #ln --symbolic --force /lib/systemd/systemd-udevd \ + ln --symbolic --force "$alternate_systemd_udevd_location" \ + "${initdir}${systemdutildir}/systemd-udevd" + #cp "$alternate_systemd_udevd_location" \ # "${initdir}${systemdutildir}/systemd-udevd" - cp /lib/systemd/systemd-udevd "${initdir}${systemdutildir}/systemd-udevd" fi # - "/usr/bin/sh" isn't available. if [[ ! -f /usr/bin/sh ]] && [[ -f /bin/sh ]]; then |
