summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjandob2015-11-19 17:10:13 +0100
committerjandob2015-11-19 17:10:13 +0100
commit81821ce533a5405ca3b5b570c899d2e4c3568e84 (patch)
tree9189f7539950f50bb0a7c6463c82ffb6d5379555
parentrebash update (diff)
downloadsystemd-init-81821ce533a5405ca3b5b570c899d2e4c3568e84.tar.gz
systemd-init-81821ce533a5405ca3b5b570c899d2e4c3568e84.tar.xz
systemd-init-81821ce533a5405ca3b5b570c899d2e4c3568e84.zip
simplifying build script
-rwxr-xr-xbuilder/build-initramfs.sh55
m---------builder/dnbd3-rootfs/scripts/rebash0
2 files changed, 30 insertions, 25 deletions
diff --git a/builder/build-initramfs.sh b/builder/build-initramfs.sh
index 5755e1da..1a39f6b2 100755
--- a/builder/build-initramfs.sh
+++ b/builder/build-initramfs.sh
@@ -52,11 +52,20 @@
# as file name) for lines containing a match to the given
# PATTERN. By default, grep prints the matching lines.
-source dnbd3-rootfs/scripts/utils.sh
+# endregion
+
+source dnbd3-rootfs/scripts/rebash/core.sh
+core.import logging
+core.import utils
+core.import exceptions
+
+logging.set_commands_log_level debug
+logging.set_log_level debug
+
+exceptions._init
__NAME__='build-initramfs'
-# endregion
function build-initramfs() {
# Provides the main module scope.
@@ -75,7 +84,7 @@ function build-initramfs() {
"$_SCOPE" _LOAD_ENVIRONMENT='no'
"$_SCOPE" _CREATE_SYSTEM_IMAGE='no'
local dependencies=(bash cpio git test shift echo mktemp cat rm sed \
- gzip curl tar grep make cmake)
+ gzip curl tar grep make)
"$_SCOPE" _DEPENDENCIES="${dependencies[*]}"
fi
@@ -170,7 +179,7 @@ EOF
esac
done
if [[ "$UID" != '0' ]]; then
- utils_log 'critical' \
+ logging.critical \
"You have to run this script as \"root\" not as \"${USER}\"."
exit 2
fi
@@ -186,26 +195,24 @@ EOF
#
# >>> build_initramfs_initialize_dracut
# ...
- {
- mkdir dracut && \
- utils_log 'Download and extract dracut.' && \
+ mkdir dracut
+ utils_log 'Download and extract dracut.'
curl --location \
https://www.kernel.org/pub/linux/utils/boot/dracut/dracut-043.tar.gz | \
- tar --extract --gzip --directory dracut --strip-components 1 && \
- pushd dracut && \
+ tar --extract --gzip --directory dracut --strip-components 1
+ pushd dracut
# NOTE: On virtualbox shared folder symlinks are not allowed.
# make the dracut-install binary (dracut-install resolves dependencies etc.)
- utils_log 'Compile dracut.' && \
- make install/dracut-install && \
+ logging.info 'Compiling dracut.'
+ 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 install/dracut-install dracut-install && \
+ cp install/dracut-install dracut-install
popd
return $?
- } 1>"$UTILS_STANDARD_OUTPUT" 2>"$UTILS_ERROR_OUTPUT"
}
function build_initramfs_create_qcow2_system() {
# Packs current distribution in a qcow2 container.
@@ -223,23 +230,21 @@ EOF
# region controller
if [[ "$0" == *"${__NAME__}.sh" ]]; then
- utils_dependency_check "${_DEPENDENCIES[*]}" || \
- utils_log 'error' 'Satisfying main dependencies failed.'
+ utils.dependency_check "${_DEPENDENCIES[*]}"
build_initramfs_command_line_interface "$@" || return $?
- utils_log 'Checking dracut.' && \
+ logging.info 'Checking dracut.'
if ! [[ -d ./dracut ]]; then
- utils_log "Dracut isn't available yet loading it." && \
+ logging.info "Dracut isn't available yet loading it."
build_initramfs_initialize_dracut
fi
- utils_log 'Build initramfs.' && \
- utils_log 'Link dnbd3 plugin into dracut modules folder.' && \
- local dracut_modules_source='../../dnbd3-rootfs' && \
- local dracut_modules_target='dracut/modules.d/90dnbd3-rootfs' && \
+ logging.info 'Build initramfs.'
+ logging.info 'Link dnbd3 plugin into dracut modules folder.'
+ local dracut_modules_source='../../dnbd3-rootfs'
+ local dracut_modules_target='dracut/modules.d/90dnbd3-rootfs'
if [[ ! -L "$dracut_modules_target" || "$(readlink \
"$dracut_modules_target")" != "$dracut_modules_source" ]]
then
- ln --symbolic "$dracut_modules_source" "$dracut_modules_target" \
- 1>"$UTILS_STANDARD_OUTPUT" 2>"$UTILS_ERROR_OUTPUT" \
+ ln --symbolic "$dracut_modules_source" "$dracut_modules_target"
# NOTE: If you copy we would have to recompile each binaries every
# time.
#cp --recursive --force --no-target-directory \
@@ -255,8 +260,8 @@ EOF
fi
# TODO load i18n if debug flag is set.
dracut/dracut.sh --local $loglevel --force --modules "dnbd3-rootfs i18n" \
- --no-hostonly /boot/initramfs-test.img \
- 1>"$UTILS_STANDARD_OUTPUT" 2>"$UTILS_ERROR_OUTPUT"
+ --no-hostonly /boot/initramfs-test.img
+ logging.info 'All done!'
fi
return 0
diff --git a/builder/dnbd3-rootfs/scripts/rebash b/builder/dnbd3-rootfs/scripts/rebash
-Subproject 36f3d8b6f2d84b1ee9ccfaf6797c9b1a6660504
+Subproject 7d1496d004f0cb6bde1f81626ae259898c46630