From 9e19f11cc1ea3c23057f3d7cd2e4d88f726f0902 Mon Sep 17 00:00:00 2001 From: jandob Date: Thu, 3 Dec 2015 13:23:47 +0100 Subject: changed some config vars; added support for ram size detection --- .../hooks/pre-mount/prepare-root-partition.sh | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'builder') 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 7e858b25..2492e493 100755 --- a/builder/dnbd3-rootfs/hooks/pre-mount/prepare-root-partition.sh +++ b/builder/dnbd3-rootfs/hooks/pre-mount/prepare-root-partition.sh @@ -41,10 +41,10 @@ fi # Make read-only partition writable. ## detect partition for persistent storage local persistent_device=$(utils.find_block_device \ - "$SLX_PERSISTENT_PARTITION_PATTERN_LABEL_UUID_TYPE") + "$SLX_WRITABLE_DEVICE_IDENTIFIER") # TODO move somewhere else #local tmp_device=$(utils.find_block_device \ - #'$SLX_TMP_PARTITION_PATTERN_LABEL_UUID_TYPE') + #'$SLX_TMP_PARTITION_IDENTIFIER') #if [ -n $tmp_device ]; then #mount -t auto "$tmp_device" $NEWROOT/tmp @@ -54,9 +54,15 @@ local persistent="N" # 'P' for persistent storage, 'N' for not persistent local writable_device if [ -n "$persistent_device" ]; then writable_device=$persistent_device - persistent="P" + if [ "$SLX_WRITABLE_DEVICE_PERSISTENT" = "yes" ]; then + persistent="P" + fi else - modprobe brd max_part=1 rd_size=$SLX_RAMDISK_SIZE + local ramdisk_size="$SLX_RAMDISK_SIZE" + if [ "ramdisk_size" = "" ]; then + 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" fi @@ -69,6 +75,7 @@ fi local partition_size="$(blockdev --getsz "$read_only_partition")" local writable_partition_name="root" +logging.info "Using writable device $writable_device, persistency: $persistent" local chunksize="1" modprobe dm_snapshot dmsetup create "$writable_partition_name" --noudevsync --table \ -- cgit v1.2.3-55-g7522