From 0cf91875d0af08d13295f85dc028bf767b541784 Mon Sep 17 00:00:00 2001 From: Thiago Abdo Date: Fri, 8 Nov 2019 14:48:27 +0100 Subject: edit build-initramfs.sh so it should be executed from inside the repo Signed-off-by: Thiago Abdo --- builder/build-initramfs.sh | 52 ++++------------------------------------------ 1 file changed, 4 insertions(+), 48 deletions(-) diff --git a/builder/build-initramfs.sh b/builder/build-initramfs.sh index b8599e43..f44f438c 100755 --- a/builder/build-initramfs.sh +++ b/builder/build-initramfs.sh @@ -12,53 +12,9 @@ # see http://creativecommons.org/licenses/by/3.0/deed.de ## endregion +# I think this are the same... declare -rg _root_dir="$(readlink -f $(dirname ${BASH_SOURCE[0]}))" -declare -rg _repo_dir="${_root_dir}/systemd-init.git" -declare -rg _git_source="git://git.openslx.org/openslx-ng/systemd-init.git" -declare -rg _git_branch="nobash" - -## region ensure presence of needed dependencies -set -o errexit -if [ ! -e "$_repo_dir" ]; then - echo "Missing dracut modules repository, loading them." - if ! hash git; then - echo "Needed dependency \"git\" isn't available." - echo "Please install \"git\" or provide the main repository in \"${_repo_dir}\"." - exit 1 - fi - git clone --branch "$_git_branch" --single-branch --depth 1 \ - "$_git_source" "${_repo_dir}" - pushd "${_repo_dir}" - git submodule init - # try to clone submodules as shallowy as possible, since we cannot just - # use '--depth 1' on submodules residing on non-master branches... - for mod in $(grep -Po '(?<=^\[submodule ")([^"]+)' .gitmodules); do - url="$(git config -f .gitmodules --get submodule.${mod}.url)" - path="$(git config -f .gitmodules --get submodule.${mod}.path)" - branch="$(git config -f .gitmodules --get submodule.${mod}.branch)" - commit="$(git submodule status $path | grep -oE '[0-9a-f]{40}')" - depth_arg=("--shallow-since") - [ "$mod" = "dnbd3" ] && depth_arg+=("2019-02-12") - [ "$mod" = "rebash" ] && depth_arg+=("2016-11-30") - [ "$mod" = "qemu-xmount" ] && depth_arg+=("2016-01-01") - [ "$mod" = "xmount" ] && depth_arg+=("2015-11-05") - [ "$mod" = "kernel-qcow2-linux" ] && depth_arg+=("2019-08-25") - [ "$mod" = "kernel-qcow2-util-linux" ] && depth_arg+=("2019-08-15") - git clone -n --no-tags "${depth_arg[@]}" --branch "$branch" "$url" "$path" - pushd "$path" - git checkout "$commit" - popd - done - # apply patches for submodules - git submodule foreach ' - for p in $(find ${toplevel}/builder/patches/${path##*/} -type f -name "*.patch" | sort -n); do - patch -p1 < $p || echo "Failed to patch $path with $p - expect errors." - done 2>/dev/null - ' - popd -fi -set +o errexit -## endregion +declare -rg _repo_dir="${_root_dir}" file_path='/boot/initramfs.img' dracut_parameter=(--force --no-hostonly) @@ -265,7 +221,7 @@ main() { initialize_dracut fi - for _dracut_module_dir in "${_repo_dir}/builder/modules.d/"*; do + for _dracut_module_dir in "${_repo_dir}/modules.d/"*; do [ -d "${_dracut_module_dir}" ] || continue _dracut_module="$(basename $_dracut_module_dir)" # TODO allow module-specific priority @@ -306,7 +262,7 @@ main() { echo 'Removing distribution specific files.' cleanup else - . "${_repo_dir}/builder/modules.d/dnbd3-rootfs/helper/build.inc" + . "${_repo_dir}/modules.d/dnbd3-rootfs/helper/build.inc" build_initialize_components if [[ "$initialize" == 'yes' ]]; then echo "Initialized." -- cgit v1.2.3-55-g7522