summaryrefslogtreecommitdiffstats
path: root/builder/dnbd3-rootfs
diff options
context:
space:
mode:
authorjandob2015-12-03 18:21:57 +0100
committerjandob2015-12-03 18:21:57 +0100
commit7c856d9deb001f48a7b374a978ed9b3a506c15ea (patch)
treecd0c30a925e8775abdd2e5bd88042abd00390899 /builder/dnbd3-rootfs
parentfix (diff)
parentRefactoring. (diff)
downloadsystemd-init-7c856d9deb001f48a7b374a978ed9b3a506c15ea.tar.gz
systemd-init-7c856d9deb001f48a7b374a978ed9b3a506c15ea.tar.xz
systemd-init-7c856d9deb001f48a7b374a978ed9b3a506c15ea.zip
merge
Diffstat (limited to 'builder/dnbd3-rootfs')
-rwxr-xr-xbuilder/dnbd3-rootfs/hooks/pre-mount/prepare-root-partition.sh34
-rwxr-xr-xbuilder/dnbd3-rootfs/hooks/pre-udev/setup-loopback-device.sh1
-rwxr-xr-xbuilder/dnbd3-rootfs/module-setup.sh8
3 files changed, 22 insertions, 21 deletions
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 70c4e1a7..38817dea 100755
--- a/builder/dnbd3-rootfs/hooks/pre-mount/prepare-root-partition.sh
+++ b/builder/dnbd3-rootfs/hooks/pre-mount/prepare-root-partition.sh
@@ -34,49 +34,49 @@ udevadm settle
local read_only_partition=$(utils.find_block_device \
"$SLX_SYSTEM_PARTITION_IDENTIFIER")
-if [ -z $read_only_partition ]; then
- warn no partition found on device $nbd_device
+if [ -z "$read_only_partition" ]; then
+ warn no partition found on device "$nbd_device"
emergency_shell
fi
# Make read-only partition writable.
## detect partition for persistent storage
-local persistent_device=$(utils.find_block_device \
- "$SLX_WRITABLE_DEVICE_IDENTIFIER")
+local persistent_device="$(utils.find_block_device \
+ "$SLX_WRITABLE_DEVICE_IDENTIFIER")"
# TODO move somewhere else
-#local tmp_device=$(utils.find_block_device \
- #'$SLX_TMP_PARTITION_IDENTIFIER')
+#local tmp_device="$(utils.find_block_device \
+ #'$SLX_TMP_PARTITION_IDENTIFIER')"
#if [ -n $tmp_device ]; then
- #mount -t auto "$tmp_device" $NEWROOT/tmp
+ #mount --type auto "$tmp_device" "$NEWROOT/tmp"
#fi
-local persistent="N" # 'P' for persistent storage, 'N' for not persistent
+local persistent='N' # 'P' for persistent storage, 'N' for not persistent
local writable_device
if [ -n "$persistent_device" ]; then
- writable_device=$persistent_device
+ writable_device="$persistent_device"
if [ "$SLX_WRITABLE_DEVICE_PERSISTENT" = "yes" ]; then
- persistent="P"
+ persistent='P'
fi
else
local ramdisk_size="$SLX_RAMDISK_SIZE"
if [ "$ramdisk_size" = "" ]; then
- ramdisk_size=$(cat /proc/meminfo | awk '/MemTotal/ {print $2}')
+ ramdisk_size="$(cat /proc/meminfo | awk '/MemTotal/ {print $2}')"
fi
- modprobe brd max_part=1 rd_size=$ramdisk_size
- writable_device="/dev/ram0"
- persistent="N"
+ modprobe brd max_part=1 rd_size="$ramdisk_size"
+ writable_device='/dev/ram0'
+ persistent='N'
fi
# persistent storage on a filesystem (e.g. usb stick)
# writable_device="$(losetup -f)"
#dd if=/dev/zero of=persistent_storage.img bs=1k count=1000
#losetup "$writable_device" persistent_storage.img
-#persistent="P"
+#persistent='P'
local partition_size="$(blockdev --getsz "$read_only_partition")"
-local writable_partition_name="root"
+local writable_partition_name='root'
logging.info "Using writable device $writable_device, persistency: $persistent"
-local chunksize="1"
+local chunksize='1'
modprobe dm_snapshot
dmsetup create "$writable_partition_name" --noudevsync --table \
"0 $partition_size snapshot $read_only_partition $writable_device $persistent $chunksize"
diff --git a/builder/dnbd3-rootfs/hooks/pre-udev/setup-loopback-device.sh b/builder/dnbd3-rootfs/hooks/pre-udev/setup-loopback-device.sh
deleted file mode 100755
index 9103afd9..00000000
--- a/builder/dnbd3-rootfs/hooks/pre-udev/setup-loopback-device.sh
+++ /dev/null
@@ -1 +0,0 @@
-/sbin/initqueue --name ifup-lo --unique --onetime /sbin/ifup lo -m
diff --git a/builder/dnbd3-rootfs/module-setup.sh b/builder/dnbd3-rootfs/module-setup.sh
index 9ee50ce4..2d5528f8 100755
--- a/builder/dnbd3-rootfs/module-setup.sh
+++ b/builder/dnbd3-rootfs/module-setup.sh
@@ -15,6 +15,7 @@ clean() {
utils_clean_systemd_preserve_process_marker \
"$moddir/binaries/systemd-preserve-process-marker/"
fi
+ return 0
}
check() {
@@ -28,7 +29,7 @@ check() {
logging_set_log_level 'info'
logging_set_commands_log_level 'info'
- # TODO uncomment if rebash is fixed: exceptions_init
+ exceptions_activate
if [[ ! -f "$moddir/binaries/nbd/nbd.ko" ]]; then
utils_compile_nbd "$moddir/binaries/nbd/"
@@ -57,6 +58,9 @@ check() {
if [[ ! -f /usr/bin/sh ]] && [[ -f /bin/sh ]]; then
ln --symbolic --force /bin/sh /usr/bin/sh
fi
+
+ exceptions_deactivate
+
return 0
}
@@ -107,8 +111,6 @@ install() {
# load nbd.ko, dnbd3.ko
inst_hook pre-udev 00 "$moddir/hooks/pre-udev/load-custom-kernel-modules.sh"
- # TODO needed?
- inst_hook pre-udev 00 "$moddir/hooks/pre-udev/setup-loopback-device.sh"
# get the openslx config from the servers configured in the kernel command
# line (${SLX_SERVER}/${SLX_SERVER_BASE}/config)