summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortorben2015-12-10 14:48:28 +0100
committertorben2015-12-10 14:48:28 +0100
commit667ca262d2c889a2039992b0e0c8f896d7176793 (patch)
treeb1a3a252b58994a8f67365ba56eb1c93f71ebebb
parentMerge branch 'master' of git.openslx.org:openslx-ng/systemd-init (diff)
downloadsystemd-init-667ca262d2c889a2039992b0e0c8f896d7176793.tar.gz
systemd-init-667ca262d2c889a2039992b0e0c8f896d7176793.tar.xz
systemd-init-667ca262d2c889a2039992b0e0c8f896d7176793.zip
Now working if you run it from any location.
-rwxr-xr-xbuilder/build-initramfs.sh14
1 files changed, 11 insertions, 3 deletions
diff --git a/builder/build-initramfs.sh b/builder/build-initramfs.sh
index 754f8829..45a54b2b 100755
--- a/builder/build-initramfs.sh
+++ b/builder/build-initramfs.sh
@@ -54,10 +54,16 @@
# endregion
+# region ensure presence of needed dependencies
+
set -o errexit
-build_initramfs__needed_location='./dnbd3-rootfs'
+build_initramfs__needed_location="$(dirname "${BASH_SOURCE[0]}")/dnbd3-rootfs"
if ! [[ -d "$build_initramfs__needed_location" ]]; then
echo "The dnbd3 dracut plugin isn't available, loading it."
+ if ! hash git 2>/dev/null; then
+ echo "Needed dependency \"git\" isn't available. Please install \"git\" or provide the repositories data structure in \"$(dirname "${BASH_SOURCE[0]}")\"."
+ result=1
+ fi
build_initramfs__temporary_repository_location="$(mktemp --directory)"
git clone git://git.openslx.org/openslx-ng/systemd-init.git \
"$build_initramfs__temporary_repository_location"
@@ -71,6 +77,8 @@ if ! [[ -d "$build_initramfs__needed_location" ]]; then
fi
set +o errexit
+# endregion
+
source "$(dirname "${BASH_SOURCE[0]}")/dnbd3-rootfs/scripts/rebash/core.sh"
core.import exceptions
exceptions.activate
@@ -270,12 +278,12 @@ if ! build_initramfs_parse_command_line "$@"; then
exit 1
fi
logging.info 'Checking dracut.'
-if ! [[ -d ./dracut ]]; then
+if ! [[ -d "$(dirname "${BASH_SOURCE[0]}")/dracut" ]]; then
logging.info "Dracut isn't available yet loading it."
build_initramfs_initialize_dracut
fi
build_initramfs__dracut_modules_source='../../dnbd3-rootfs'
-build_initramfs__dracut_modules_target='dracut/modules.d/90dnbd3-rootfs'
+build_initramfs__dracut_modules_target="$(dirname "${BASH_SOURCE[0]}")/dracut/modules.d/90dnbd3-rootfs"
if [[ ! -L "$build_initramfs__dracut_modules_target" || "$(readlink \
"$build_initramfs__dracut_modules_target")" != \
"$build_initramfs__dracut_modules_source" ]]