From 7447b901b4db0c775a8bb7097d803491c290f507 Mon Sep 17 00:00:00 2001 From: Manfred Touron Date: Tue, 21 Oct 2014 14:01:40 +0000 Subject: [PATCH] Creating smaller images --- images/lib.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/images/lib.sh b/images/lib.sh index 9c3d3f0..109f95c 100644 --- a/images/lib.sh +++ b/images/lib.sh @@ -8,8 +8,9 @@ prepare_nbd_volume() { device=$1 if ! `mountpoint -q "$TARGET"`; then sudo mkfs.ext4 "$device" - sudo mkdir -p "$TARGET" - sudo mount "$device" "$TARGET" + sudo mkdir -p "$TARGET.device" + sudo mount "$device" "$TARGET.device" + rsync -aHAX "$TARGET" "$TARGET.device" fi } @@ -86,11 +87,11 @@ cli() { ;; "image") NBD_DEVICE=${2:-"/dev/nbd1"} - prepare_nbd_volume $NBD_DEVICE build_image patch_image upgrade_image clean_image + prepare_nbd_volume $NBD_DEVICE exit 0 ;; "build_image"|"patch_image"|"archive_target"|"prepare_nbd_volume"|"upgrade_image"|"clean_image")