summaryrefslogtreecommitdiffstats
path: root/builder
diff options
context:
space:
mode:
authortorben2015-11-20 15:56:14 +0100
committertorben2015-11-20 15:56:14 +0100
commitfc23fa6f63191a5f9a610949a497816744fa7248 (patch)
treecf5ba47de3443dd34ed3470eea57aae0ac0e6576 /builder
parentSync. (diff)
downloadsystemd-init-fc23fa6f63191a5f9a610949a497816744fa7248.tar.gz
systemd-init-fc23fa6f63191a5f9a610949a497816744fa7248.tar.xz
systemd-init-fc23fa6f63191a5f9a610949a497816744fa7248.zip
Supporting open slx configuration file.
Diffstat (limited to 'builder')
-rwxr-xr-xbuilder/dnbd3-rootfs/hooks/cmdline/prepare-kernel-command-line-parameter.sh21
-rwxr-xr-xbuilder/dnbd3-rootfs/hooks/pre-mount/fetch-config.sh33
-rwxr-xr-xbuilder/dnbd3-rootfs/hooks/pre-mount/prepare-root-partition.sh12
3 files changed, 30 insertions, 36 deletions
diff --git a/builder/dnbd3-rootfs/hooks/cmdline/prepare-kernel-command-line-parameter.sh b/builder/dnbd3-rootfs/hooks/cmdline/prepare-kernel-command-line-parameter.sh
index 505cc4c6..7dcc8c83 100755
--- a/builder/dnbd3-rootfs/hooks/cmdline/prepare-kernel-command-line-parameter.sh
+++ b/builder/dnbd3-rootfs/hooks/cmdline/prepare-kernel-command-line-parameter.sh
@@ -1,14 +1,14 @@
command -v warn &> /dev/null || . /lib/dracut-lib.sh
-## TODO check set -e
# This location will be used to have a writable kernel command line file
# location.
-writeable_proc_cmdline_path='/writable_proc_cmdline/'
+local writeable_proc_cmdline_path='/writable_proc_cmdline/'
mkdir --parents "$writeable_proc_cmdline_path"
# NOTE: The fake writeable overlay have to be a temporary filesystem for the
# hack to work.
mount --types tmpfs tmpfs "$writeable_proc_cmdline_path"
+local parameter
for parameter in $(getargs ip=); do
local temp="$parameter:"
set --
@@ -29,13 +29,22 @@ for parameter in $(getargs ip=); do
/proc/cmdline > "${writeable_proc_cmdline_path}cmdline"
done
+if [ -z "$final_dracut_ip_configuration" ]; then
+ warn 'No "ip" parameter found in the kernel command line.'
+fi
mount --options bind "${writeable_proc_cmdline_path}cmdline" /proc/cmdline
for parameter in $(getargs slxsrv=); do
- slxsrv="$parameter"
+ SLX_SERVER="$parameter"
done
for parameter in $(getargs slxbase=); do
- slxbase="$parameter"
+ SLX_SERVER_BASE="$parameter"
done
-
-##set +e
+if [ -z "$SLX_SERVER" ]; then
+ warn 'No "slxsrv" parameter found in the kernel command line.'
+ return 1
+fi
+if [ -z "$SLX_SERVER_BASE" ]; then
+ warn 'No "slxbase" parameter found in the kernel command line.'
+ return 1
+fi
diff --git a/builder/dnbd3-rootfs/hooks/pre-mount/fetch-config.sh b/builder/dnbd3-rootfs/hooks/pre-mount/fetch-config.sh
index 310aba51..7922ce2a 100755
--- a/builder/dnbd3-rootfs/hooks/pre-mount/fetch-config.sh
+++ b/builder/dnbd3-rootfs/hooks/pre-mount/fetch-config.sh
@@ -1,32 +1,17 @@
-# Load dracUT library if not already loaded.
command -v getarg >/dev/null || . /lib/dracut-lib.sh
-# read SLX_SERVER and SLX_BASE from the kernel command line
-SLX_SERVER=$(getarg slxsrv)
-SLX_BASE=$(getarg slxbase)
-SLX_CONFIG_DIR="/opt/openslx"
-SLX_CONFIG_FILE="/opt/openslx/config"
-
-if [ -z "$SLX_SERVER" ]; then
- warn "No 'slxsrv' parameter found in the kernel command line!"
- warn "Skipping OpenSLX configuration..."
- return 1
-fi
-if [ -z "$SLX_BASE" ]; then
- warn "No 'slxbase' parameter found in the kernel command line!"
- warn "Skipping OpenSLX configuration..."
- return 1
-fi
-
-info "Getting configuration from OPENSLX-Server..." && \
-mkdir -p "${SLX_CONFIG_DIR}" && \
-wget --timeout 5 --quiet "http://${SLX_SERVER}/${SLX_BASE}/config" \
- --output-document "${SLX_CONFIG_FILE}" && \
-return_code="$?"
+local configuration_file_name='config'
+info 'Getting configuration file.'
+wget --timeout 5 --quiet "http://${SLX_SERVER}${SLX_SERVER_BASE}${configuration_file_name}" \
+ --output-document "/$configuration_file_name"
+local return_code="$?"
if [[ $return_code != 0 ]]; then
- warn "Downloading OpenSLX configuration from ${SLX_SERVER}/${SLX_BASE} failed. Return code: $return_code"
+ warn "Downloading OpenSLX configuration file from \"${SLX_SERVER}${SLX_SERVER_BASE}${configuration_file_name}\" failed. Return code: $return_code"
emergency_shell -n "$0"
return 1
else
return 0
fi
+source "/$configuration_file_name"
+mkdir --parents "$SLX_CONFIGURATION_LOCATION"
+mv "/$configuration_file_name" "$SLX_CONFIGURATION_LOCATION"
diff --git a/builder/dnbd3-rootfs/hooks/pre-mount/prepare-root-partition.sh b/builder/dnbd3-rootfs/hooks/pre-mount/prepare-root-partition.sh
index 80ba8c6c..1e76f2ea 100755
--- a/builder/dnbd3-rootfs/hooks/pre-mount/prepare-root-partition.sh
+++ b/builder/dnbd3-rootfs/hooks/pre-mount/prepare-root-partition.sh
@@ -1,22 +1,22 @@
source "/usr/lib/utils.sh"
-declare -rg DNBD3_SERVER="132.230.4.201"
declare -rg DNBD3_IMAGE="archLinux.vdi"
declare -rg DNBD3_RID="0"
declare -rg DNBD3_DEVICE="/dev/dnbd0"
# Close previous connections to be able to run this script many times.
-dnbd3-client --device "$DNBD3_DEVICE" --close && \
-if ! systemd-preserve-process-marker dnbd3-client --host "$DNBD3_SERVER" \
- --image "$DNBD3_IMAGE" --device "$DNBD3_DEVICE" --rid "$DNBD3_RID"
+dnbd3-client --device "$SLX_DNBD3_DEVICE" --close && \
+if ! systemd-preserve-process-marker dnbd3-client --host "$SLX_DNBD3_SERVERS" \
+ --image "$SLX_DNBD3_IMAGE" --device "$SLX_DNBD3_DEVICE" --rid \
+ "$SLX_DNBD3_RID"
then
- warn "Failed to connect $DNBD3_IMAGE from $DNBD3_SERVER to $DNBD3_DEVICE"
+ warn "Failed to connect $SLX_DNBD3_IMAGE from $SLX_DNBD3_SERVER to $SLX_DNBD3_DEVICE"
emergency_shell -n "Error in $0"
return 1
fi
local nbd_device='/dev/nbd0' && \
systemd-preserve-process-marker qemu-nbd --connect="$nbd_device" \
- "$DNBD3_DEVICE" --read-only && \
+ "$SLX_DNBD3_DEVICE" --read-only && \
# TODO make partition label configurable.
local read_only_partition="$(utils_create_partition_via_offset "$nbd_device" \
system)" && \