diff options
author | torben | 2015-12-11 16:15:09 +0100 |
---|---|---|
committer | torben | 2015-12-11 16:15:09 +0100 |
commit | 7c62b1b4ba0938259fe19babef9929064da9e65f (patch) | |
tree | 8a9619f8a916d1659d4b5eb79680d32950282e34 /builder/build-initramfs.sh | |
parent | Fix many paths which breaks installing from another directory than the (diff) | |
download | systemd-init-7c62b1b4ba0938259fe19babef9929064da9e65f.tar.gz systemd-init-7c62b1b4ba0938259fe19babef9929064da9e65f.tar.xz systemd-init-7c62b1b4ba0938259fe19babef9929064da9e65f.zip |
Fix dracut building.
Diffstat (limited to 'builder/build-initramfs.sh')
-rwxr-xr-x | builder/build-initramfs.sh | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/builder/build-initramfs.sh b/builder/build-initramfs.sh index ffbb55db..89bdb598 100755 --- a/builder/build-initramfs.sh +++ b/builder/build-initramfs.sh @@ -220,7 +220,7 @@ function build_initramfs_initialize_dracut() { # # >>> build_initramfs_initialize_dracut # ... - mkdir "$(dirname "${BASH_SOURCE[0]}")/dracut" + mkdir --parents "$(dirname "${BASH_SOURCE[0]}")/dracut" logging.info 'Download and extract dracut.' curl --location \ https://www.kernel.org/pub/linux/utils/boot/dracut/dracut-043.tar.gz | \ @@ -231,13 +231,13 @@ function build_initramfs_initialize_dracut() { # NOTE: make the dracut-install binary (dracut-install resolves # dependencies etc.) logging.info 'Compiling dracut.' - make "$(dirname "${BASH_SOURCE[0]}")/install/dracut-install" + make install/dracut-install # NOTE: We have to copy the binary to current instead of symlinking them # since this feature isn't supported in shared virtual box machine folders. # If symlinks would be available we could simply use: # >>> make dracut-install - cp "$(dirname "${BASH_SOURCE[0]}")/install/dracut-install" \ - "$(dirname "${BASH_SOURCE[0]}")dracut-install" + cp "$(dirname "${BASH_SOURCE[0]}")/dracut/install/dracut-install" \ + "$(dirname "${BASH_SOURCE[0]}")/dracut/dracut-install" popd return $? } @@ -319,7 +319,7 @@ fi ## endregion ## region handle dependencies which can be resolved automatically logging.info 'Checking dracut.' -if ! [[ -d "$(dirname "${BASH_SOURCE[0]}")/dracut" ]]; then +if ! [[ -f "$(dirname "${BASH_SOURCE[0]}")/dracut/dracut-install" ]]; then logging.info "Dracut isn't available yet loading it." build_initramfs_initialize_dracut fi @@ -332,12 +332,14 @@ if [[ ! -L "$build_initramfs__dracut_modules_target" || "$(readlink \ then logging.info \ "Link dnbd3 plugin into dracut modules folder ($build_initramfs__dracut_modules_source -> $build_initramfs__dracut_modules_target)." - ln --symbolic "$build_initramfs__dracut_modules_source" \ - "$build_initramfs__dracut_modules_target" - # NOTE: If you copy we would have to recompile each binaries every time: - # >>> cp --recursive --force --no-target-directory \ - # ... "$(basename "$build_initramfs__dracut_modules_source")" \ - # ... "$build_initramfs__dracut_modules_target" + if ! ln --symbolic "$build_initramfs__dracut_modules_source" \ + "$build_initramfs__dracut_modules_target" 2>/dev/null; then + logging.warn \ + "Link \"$build_initramfs__dracut_modules_source\" to \"$build_initramfs__dracut_modules_target\" fails. We will copy them. So you have to recopy it if you recompile things in specified source." + cp --recursive --force --no-target-directory \ + "$(dirname "${BASH_SOURCE[0]}")/$(basename "$build_initramfs__dracut_modules_source")" \ + "$build_initramfs__dracut_modules_target" + fi fi ## endregion ## region prepare and perform final dracut call @@ -361,6 +363,7 @@ else # NOTE: We deactivate our exception handle since dracut returns "1" if it # is launched with help parameter ("-h" or "--help"). exceptions.deactivate + echo "$(dirname "${BASH_SOURCE[0]}")/dracut/dracut.sh" "$(dirname "${BASH_SOURCE[0]}")/dracut/dracut.sh" --local \ $build_initramfs__loglevel --modules "$build_initramfs__modules" \ ${build_initramfs_dracut_parameter[*]} /boot/initramfs-test.img |