summaryrefslogtreecommitdiffstats
path: root/builder
diff options
context:
space:
mode:
authorJonathan Bauer2019-08-02 17:20:53 +0200
committerJonathan Bauer2019-08-02 17:20:53 +0200
commitd8f91fdc78e8fa72de6cc04cc8f9768d62495942 (patch)
tree6f2bb462cf044adce1a3a1657ff98206696ac4a7 /builder
parent[busybox] downgrade to 1_25_1 til patches fixes (diff)
downloadsystemd-init-d8f91fdc78e8fa72de6cc04cc8f9768d62495942.tar.gz
systemd-init-d8f91fdc78e8fa72de6cc04cc8f9768d62495942.tar.xz
systemd-init-d8f91fdc78e8fa72de6cc04cc8f9768d62495942.zip
formatting round 1
Diffstat (limited to 'builder')
-rwxr-xr-xbuilder/build-initramfs.sh104
1 files changed, 51 insertions, 53 deletions
diff --git a/builder/build-initramfs.sh b/builder/build-initramfs.sh
index 4899d9c8..50ce7c1e 100755
--- a/builder/build-initramfs.sh
+++ b/builder/build-initramfs.sh
@@ -30,7 +30,8 @@ _needed_location="${_root_dir}/modules.d"
if ! [[ -d "$_needed_location" ]]; then
echo "The dracut modules aren't available, loading them."
if ! hash git; then
- echo "Needed dependency \"git\" isn't available. Please install \"git\" or provide the repositories data structure in \"${_root_dir}\"."
+ echo "Needed dependency \"git\" isn't available."
+ echo "Please install \"git\" or provide the repositories data structure in \"${_root_dir}\"."
fi
_temporary_repository_location="$(mktemp --directory)"
git clone --branch "$_git_branch" --single-branch --depth 1 \
@@ -46,8 +47,8 @@ if ! [[ -d "$_needed_location" ]]; then
# 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
+ patch -p1 < $p || echo "Failed to patch $path with $p - expect errors."
+ done 2>/dev/null
'
popd
# finally copy all dracut modules under modules.d/
@@ -369,12 +370,12 @@ parse_command_line() {
shift
done
;;
-
'')
break
;;
*)
- logging.critical "Error with given option \"$1\": This argument is not available."
+ logging.critical \
+ "Error with given option \"$1\": This argument is not available."
return 1
esac
done
@@ -451,13 +452,11 @@ initialize_dracut() {
dracut_version="046"
fi
dracut_resource_url="https://www.kernel.org/pub/linux/utils/boot/dracut/dracut-$dracut_version.tar.gz"
- if [[ ! -f "${_root_dir}/dracut/install/dracut-install" ]]
- then
+ if [[ ! -f "${_root_dir}/dracut/install/dracut-install" ]]; then
mkdir --parents "${_root_dir}/dracut"
logging.info "Download and extract dracut version $dracut_version"
curl --location "$dracut_resource_url" | tar --extract --gzip \
- --directory "${_root_dir}/dracut" \
- --strip-components 1
+ --directory "${_root_dir}/dracut" --strip-components 1
pushd "${_root_dir}/dracut"
# NOTE: On virtualbox shared folder symlinks are not allowed.
# NOTE: make the dracut-install binary (dracut-install resolves
@@ -477,52 +476,53 @@ initialize_dracut() {
return $?
}
initialize_dnbd3_rootfs_module() {
- # shellcheck disable=SC2016,SC2034
- local __doc__='
- Initialize dependency of dnbd3-rootfs modules:
- xmount, qemu-xmount, dnbd3
-
- Example:
-
- `initialize_dnbd3_rootfs_module`
- '
- core.import "${_root_dir}/modules.d/dnbd3-rootfs/scripts/build.sh"
- # We might want to move the "binaries" repos from the dnbd3-rootfs module to main repo one day...
- _deps_base_dir="${_root_dir}/modules.d/dnbd3-rootfs/binaries"
- if [[ ! -f "${_deps_base_dir}/xmount/trunk/build/src/xmount" ]]; then
- logging.info "Could not find xmount binary, building it..."
- if ! build_compile_xmount "${_deps_base_dir}/xmount/"; then
- logging.error "Failed to build xmount binary."
- return 1
- fi
+ # shellcheck disable=SC2016,SC2034
+ local __doc__='
+ Initialize dependency of dnbd3-rootfs modules:
+ xmount, qemu-xmount, dnbd3
+
+ Example:
+
+ `initialize_dnbd3_rootfs_module`
+ '
+ core.import "${_root_dir}/modules.d/dnbd3-rootfs/scripts/build.sh"
+ # We might want to move the "binaries" repos from the dnbd3-rootfs module to main repo one day...
+ _deps_base_dir="${_root_dir}/modules.d/dnbd3-rootfs/binaries"
+ if [[ ! -f "${_deps_base_dir}/xmount/trunk/build/src/xmount" ]]; then
+ logging.info "Could not find xmount binary, building it..."
+ if ! build_compile_xmount "${_deps_base_dir}/xmount/"; then
+ logging.error "Failed to build xmount binary."
+ return 1
fi
- if [[ ! -f "${_deps_base_dir}/qemu-xmount/libxmount_input_qemu.so" ]]; then
- logging.info "Could not find xmount qemu library, building it..."
- if ! build_compile_qemu_xmount "${_deps_base_dir}/qemu-xmount/"; then
- logging error "Failed to build xmount qemu library."
- return 1
- fi
+ fi
+ if [[ ! -f "${_deps_base_dir}/qemu-xmount/libxmount_input_qemu.so" ]]; then
+ logging.info "Could not find xmount qemu library, building it..."
+ if ! build_compile_qemu_xmount "${_deps_base_dir}/qemu-xmount/"; then
+ logging error "Failed to build xmount qemu library."
+ return 1
fi
- if [[ ! -f "${_deps_base_dir}/dnbd3/build/dnbd3.ko" ]] || \
- [[ ! -f "${_deps_base_dir}/dnbd3/build/dnbd3-client" ]]; then
+ fi
+ # TODO check for its existence using modinfo -k <kernel_version>
+ if [[ ! -f "${_deps_base_dir}/dnbd3/build/dnbd3.ko" ]] || \
+ [[ ! -f "${_deps_base_dir}/dnbd3/build/dnbd3-client" ]]; then
logging.info "Could not find dnbd3, building it..."
if ! CMAKE_FLAGS="-DKERNEL_DIR=${kernel_headers}" \
build_compile_dnbd3 "${_deps_base_dir}/dnbd3/"; then
- logging.error "Failed to build dnbd3."
- return 1
+ logging.error "Failed to build dnbd3."
+ return 1
fi
+ fi
+ if [[ ! -f "${_deps_base_dir}/systemd-preserve-process-marker/systemd-preserve-process-marker" ]]; then
+ logging.info "Could not find systemd-preserve-process-marker binary, building it ..."
+ if ! build_compile_systemd_preserve_process_marker \
+ "${_deps_base_dir}/systemd-preserve-process-marker/"; then
+ logging.error "Failed to build systemd-preserve-process-marker"
+ return 1
fi
- if [[ ! -f "${_deps_base_dir}/systemd-preserve-process-marker/systemd-preserve-process-marker" ]]; then
- logging.info "Could not find systemd-preserve-process-marker binary, building it ..."
- if ! build_compile_systemd_preserve_process_marker \
- "${_deps_base_dir}/systemd-preserve-process-marker/"; then
- logging.error "Failed to build systemd-preserve-process-marker"
- return 1
- fi
- fi
- logging.info "Compilation of dnbd3-rootfs dependencies succeeded."
- return 0
+ fi
+ logging.info "Compilation of dnbd3-rootfs dependencies succeeded."
+ return 0
}
cleanup() {
# shellcheck disable=SC2016,SC2034
@@ -618,8 +618,7 @@ main() {
if $_parameter_skip; then
_parameter_skip=false
elif [[ "$_parameter" == '-t' ]] || \
- [[ "$_parameter" == '--target' ]]
- then
+ [[ "$_parameter" == '--target' ]]; then
_parameter_skip=true
else
_parameter_to_forward+=("$_parameter")
@@ -671,8 +670,7 @@ main() {
# TODO change to *not* always use '90' ...
_dracut_module_target="${_root_dir}/dracut/modules.d/00${_dracut_module}"
if [[ ! -L "$_dracut_module_target" || "$(readlink \
- "$_dracut_module_target")" != "$_dracut_module_relative_path" ]]
- then
+ "$_dracut_module_target")" != "$_dracut_module_relative_path" ]]; then
logging.info \
"Link ${_dracut_module} plugin into dracut modules folder ($_dracut_module_relative_path -> $_dracut_module_target)."
if ! ln --symbolic --force "$_dracut_module_relative_path" \
@@ -711,8 +709,8 @@ main() {
logging.info 'Removing distribution specific files.'
cleanup
elif [[ "$initialize" == 'yes' ]]; then
- logging.info 'Prepare dnbd3-rootfs module dependencies.'
- initialize_dnbd3_rootfs_module
+ logging.info 'Prepare dnbd3-rootfs module dependencies.'
+ initialize_dnbd3_rootfs_module
else
logging.info 'Build initramfs.'
# NOTE: We deactivate our exception handle since dracut returns "1" if