From 7d89972c5756677c62d02d5f4030a97029188c0e Mon Sep 17 00:00:00 2001 From: Juan RP Date: Sun, 21 Sep 2014 12:48:32 +0200 Subject: mklive: added -S opt to set a custom rootfs free size in MB. --- mklive.sh.in | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'mklive.sh.in') diff --git a/mklive.sh.in b/mklive.sh.in index 22a7ccf..74dc7fb 100644 --- a/mklive.sh.in +++ b/mklive.sh.in @@ -57,6 +57,7 @@ Options: -l Default locale to use (en_US.UTF-8 if unset). -i Compression type for the initramfs image (xz if unset). -s Compression type for the squashfs image (xz if unset) + -S Allocate this free size (MB) for the rootfs. -o Output file name for the ISO image (auto if unset). -p "pkg pkgN ..." Install additional packages into the ISO image. @@ -193,10 +194,13 @@ generate_grub_efi_boot() { generate_squashfs() { # Find out required size for the rootfs and create an ext3fs image off it. - ROOTFS_SIZE=$(du -sk "$ROOTFS"|awk '{print $1}') + ROOTFS_SIZE=$(du -sm "$ROOTFS"|awk '{print $1}') + if [ -z "$ROOTFS_FREESIZE" ]; then + ROOTFS_FREESIZE="$((ROOTFS_SIZE/6))" + fi mkdir -p "$BUILDDIR/tmp/LiveOS" dd if=/dev/zero of="$BUILDDIR/tmp/LiveOS/ext3fs.img" \ - bs="$((${ROOTFS_SIZE}+($ROOTFS_SIZE/6)))K" count=1 >>$LOGFILE 2>&1 + bs="$((ROOTFS_SIZE+ROOTFS_FREESIZE))M" count=1 >>$LOGFILE 2>&1 mkdir -p "$BUILDDIR/tmp-rootfs" mkfs.ext3 -F -m1 "$BUILDDIR/tmp/LiveOS/ext3fs.img" >>$LOGFILE 2>&1 mount -o loop "$BUILDDIR/tmp/LiveOS/ext3fs.img" "$BUILDDIR/tmp-rootfs" @@ -228,7 +232,7 @@ generate_iso_image() { # # main() # -while getopts "a:b:r:c:C:T:k:l:i:s:o:p:h" opt; do +while getopts "a:b:r:c:C:T:k:l:i:s:S:o:p:h" opt; do case $opt in a) BASE_ARCH="$OPTARG";; b) BASE_SYSTEM_PKG="$OPTARG";; @@ -238,6 +242,7 @@ while getopts "a:b:r:c:C:T:k:l:i:s:o:p:h" opt; do l) LOCALE="$OPTARG";; i) INITRAMFS_COMPRESSION="$OPTARG";; s) SQUASHFS_COMPRESSION="$OPTARG";; + S) ROOTFS_FREESIZE="$OPTARG";; o) OUTPUT_FILE="$OPTARG";; p) PACKAGE_LIST="$OPTARG";; C) BOOT_CMDLINE="$OPTARG";; -- cgit 1.4.1