Creating smaller images

This commit is contained in:
Manfred Touron 2014-10-21 14:01:40 +00:00
parent 2768e5b442
commit 7447b901b4
1 changed files with 4 additions and 3 deletions

View File

@ -8,8 +8,9 @@ prepare_nbd_volume() {
device=$1 device=$1
if ! `mountpoint -q "$TARGET"`; then if ! `mountpoint -q "$TARGET"`; then
sudo mkfs.ext4 "$device" sudo mkfs.ext4 "$device"
sudo mkdir -p "$TARGET" sudo mkdir -p "$TARGET.device"
sudo mount "$device" "$TARGET" sudo mount "$device" "$TARGET.device"
rsync -aHAX "$TARGET" "$TARGET.device"
fi fi
} }
@ -86,11 +87,11 @@ cli() {
;; ;;
"image") "image")
NBD_DEVICE=${2:-"/dev/nbd1"} NBD_DEVICE=${2:-"/dev/nbd1"}
prepare_nbd_volume $NBD_DEVICE
build_image build_image
patch_image patch_image
upgrade_image upgrade_image
clean_image clean_image
prepare_nbd_volume $NBD_DEVICE
exit 0 exit 0
;; ;;
"build_image"|"patch_image"|"archive_target"|"prepare_nbd_volume"|"upgrade_image"|"clean_image") "build_image"|"patch_image"|"archive_target"|"prepare_nbd_volume"|"upgrade_image"|"clean_image")