summaryrefslogtreecommitdiffstats
path: root/builder
diff options
context:
space:
mode:
authortorben2016-03-24 17:42:23 +0100
committertorben2016-03-24 17:42:23 +0100
commiteeaaf95c9475f806a95a85b5f57664d296c71dba (patch)
treedae31b4d58307d193fd78b816f5ec2550d4e5a6b /builder
parentFix. (diff)
downloadsystemd-init-eeaaf95c9475f806a95a85b5f57664d296c71dba.tar.gz
systemd-init-eeaaf95c9475f806a95a85b5f57664d296c71dba.tar.xz
systemd-init-eeaaf95c9475f806a95a85b5f57664d296c71dba.zip
Improve openslx config file.
Diffstat (limited to 'builder')
-rwxr-xr-xbuilder/dnbd3-rootfs/hooks/prepare-root-partition.sh39
1 files changed, 15 insertions, 24 deletions
diff --git a/builder/dnbd3-rootfs/hooks/prepare-root-partition.sh b/builder/dnbd3-rootfs/hooks/prepare-root-partition.sh
index 79cb6225..b57a915c 100755
--- a/builder/dnbd3-rootfs/hooks/prepare-root-partition.sh
+++ b/builder/dnbd3-rootfs/hooks/prepare-root-partition.sh
@@ -18,36 +18,27 @@ source /etc/openslx
if [[ "$SLX_WRITABLE_DEVICE_IDENTIFIER" != '' ]] &&
! persistent_device="$(
tools.find_block_device "$SLX_WRITABLE_DEVICE_IDENTIFIER" '' \
- "$SLX_WRITABLE_DEVICE_IDENTIFIER_TIMEOUT"
+ "$SLX_WRITABLE_DEVICE_IDENTIFIER_TIMEOUT_IN_SECONDS"
)"
then
logging.warn "Failed to find unique device with identifier" \
"\"${SLX_WRITABLE_DEVICE_IDENTIFIER}\"; matched devices:" \
"\"${persistent_device}\""
fi
-
-# TODO move somewhere else
-#tmp_device="$(tools.find_block_device \
- #'$SLX_TMP_PARTITION_IDENTIFIER')"
-
-#if [ -n $tmp_device ]; then
- #mount --type auto "$tmp_device" "$NEWROOT/tmp"
-#fi
-
-if [ -n "$SLX_WRITABLE_DEVICE_STORAGE_FILE" ] && [ -n "$persistent_device" ]
+if [ -n "$SLX_WRITABLE_DEVICE_STORAGE_FILE_PATH" ] && [ -n "$persistent_device" ]
then
persistent_mountpoint=/mnt/slx_writable_device
- storage_file=$persistent_mountpoint/$SLX_WRITABLE_DEVICE_STORAGE_FILE
- ! mkdir --parents $persistent_mountpoint
+ storage_file_path="${persistent_mountpoint}/$SLX_WRITABLE_DEVICE_STORAGE_FILE_PATH"
+ ! mkdir --parents "$(dirname "$storage_file_path")"
if ! mount --type auto "$persistent_device" "$persistent_mountpoint"; then
logging.warn "Failed to mount $persistent_device, checking filesystem."
- ! $SLX_WRITABLE_DEVICE_STORAGE_FILSYSTEM_CHECK_COMMAND \
+ ! $SLX_WRITABLE_DEVICE_STORAGE_FILESYSTEM_CHECK_COMMAND \
"$persistent_device"
if ! mount --type auto "$persistent_device" "$persistent_mountpoint"
then
logging.warn "Mounting $persistent_device, still failing," \
"creating new filesystem on device"
- $SLX_WRITABLE_DEVICE_STORAGE_FILSYSTEM_CREATE_COMMAND \
+ $SLX_WRITABLE_DEVICE_STORAGE_FILESYSTEM_CREATE_COMMAND \
"$persistent_device"
fi
if ! mount --type auto "$persistent_device" "$persistent_mountpoint"
@@ -58,13 +49,13 @@ then
fi
fi
if [ -n "$persistent_device" ]; then
- if [ ! -e "$storage_file" ]; then
+ if [ ! -e "$storage_file_path" ]; then
# Create a sparse file.
- dd of="$storage_file" bs=1M \
- seek="$SLX_WRITABLE_DEVICE_STORAGE_FILE_MAX_SIZE_MB" count=0
+ dd of="$storage_file_path" bs=1M \
+ seek="$SLX_WRITABLE_DEVICE_STORAGE_MAXIMUM_FILE_SIZE_IN_MB" count=0
fi
persistent_device="$(losetup --find)"
- losetup "$persistent_device" "$storage_file"
+ losetup "$persistent_device" "$storage_file_path"
fi
fi
@@ -77,19 +68,19 @@ if [ -n "$persistent_device" ]; then
persistent='P'
fi
else
- ramdisk_size="$SLX_RAMDISK_SIZE"
- if [ "$ramdisk_size" = '' ]; then
- ramdisk_size="$(awk '/MemTotal/ {print $2}' /proc/meminfo)"
+ ramdisk_size_in_kb="$SLX_RAMDISK_SIZE_IN_KB"
+ if [ "$ramdisk_size_in_kb" = '' ]; then
+ ramdisk_size_in_kb="$(awk '/MemTotal/ {print $2}' /proc/meminfo)"
fi
# NOTE: If the kernel modul "brd" is compiled into current kernel we can't
# configure ram disk size dynamically. In this case it have to be
# configured via kernel command line: "brd.rd_size=SITE_IN_KILOBYTE"
# statically:
#! rmmod brd 2>/dev/null
- #modprobe brd max_part=1 rd_size="$ramdisk_size"
+ #modprobe brd max_part=1 rd_size="$ramdisk_size_in_kb"
#writable_device='/dev/ram0'
ramdisk_location="$(mktemp)"
- dd of="$ramdisk_location" seek="$ramdisk_size" count=0 1>/dev/null
+ dd of="$ramdisk_location" seek="$ramdisk_size_in_kb" count=0 1>/dev/null
writable_device="$(losetup --find)"
losetup "$writable_device" "$ramdisk_location"
fi