From 3fd9ada9a9c7c146004c4cf35467a4e7b27e64e5 Mon Sep 17 00:00:00 2001 From: Ivan Davidov Date: Sat, 30 Apr 2016 21:50:26 +0300 Subject: [PATCH] Several information message improvements. --- src/08_generate_rootfs/etc/02_overlay.sh | 7 +++--- src/generate_hdd.sh | 29 +++++++++++++++++++----- src/qemu32.sh | 4 ++-- src/qemu64.sh | 2 +- 4 files changed, 29 insertions(+), 13 deletions(-) diff --git a/src/08_generate_rootfs/etc/02_overlay.sh b/src/08_generate_rootfs/etc/02_overlay.sh index fdd5bc5e1..581d09e6b 100755 --- a/src/08_generate_rootfs/etc/02_overlay.sh +++ b/src/08_generate_rootfs/etc/02_overlay.sh @@ -30,11 +30,11 @@ mount -t tmpfs none /mnt # Create folders for all critical file systems. -echo "Create folders for all critical file systems..." mkdir /mnt/dev mkdir /mnt/sys mkdir /mnt/proc mkdir /mnt/tmp +echo "Created folders for all critical file systems." # Copy root folders in the new mountpoint. echo "Copying the root file system to /mnt..." @@ -144,7 +144,6 @@ for DEVICE in /dev/* ; do rmdir $DEFAULT_OVERLAY_DIR 2>/dev/null rmdir $DEFAULT_UPPER_DIR 2>/dev/null rmdir $DEFAULT_WORK_DIR 2>/dev/null - else # All done, time to go. echo " Overlay data from device '$DEVICE' has been merged." @@ -159,16 +158,16 @@ for DEVICE in /dev/* ; do done # Move critical file systems to the new mountpoint. -echo "Remounting /dev, /sys, /tmp and /proc in /mnt." mount --move /dev /mnt/dev mount --move /sys /mnt/sys mount --move /proc /mnt/proc mount --move /tmp /mnt/tmp +echo "Mount locations /dev, /sys, /tmp and /proc have been moved to /mnt." # The new mountpoint becomes file system root. All original root folders are # deleted automatically as part of the command execution. The '/sbin/init' # process is invoked and it becomes the new PID 1 parent process. -echo "Moving from initramfs root area to overlayfs root area." +echo "Switching from initramfs root area to overlayfs root area." exec switch_root /mnt /etc/03_init.sh echo "(/etc/02_overlay.sh) - there is a serious bug..." diff --git a/src/generate_hdd.sh b/src/generate_hdd.sh index 5fc2da2de..6be0ad313 100755 --- a/src/generate_hdd.sh +++ b/src/generate_hdd.sh @@ -2,14 +2,14 @@ # Create sparse file of 20MB which can be used by QEMU. -if [ "$1" = "" ] ; then +if [ "$1" = "-e" -o "$1" = "--empty" ] ; then # Create new hard disk image file. rm -f hdd.img truncate -s 20M hdd.img echo "Created new hard disk image file 'hdd.img' with 20MB size." -elif [ "$1" = "-f" -o "$1" = "-folder" ] ; then +elif [ "$1" = "-f" -o "$1" = "--folder" ] ; then if [ ! "$(id -u)" = "0" ] ; then - echo "Using option '-f' (or '-folder') requires root permissions." + echo "Using option '-f' (or '--folder') requires root permissions." exit 1 fi @@ -44,9 +44,9 @@ elif [ "$1" = "-f" -o "$1" = "-folder" ] ; then chown $(logname) hdd.img echo "Applied original ownership to hard disk image file." -elif [ "$1" = "-s" -o "$1" = "-sparse" ] ; then +elif [ "$1" = "-s" -o "$1" = "--sparse" ] ; then if [ ! "$(id -u)" = "0" ] ; then - echo "Using option '-s' (or '-sparse') requires root permissions." + echo "Using option '-s' (or '--sparse') requires root permissions." exit 1 fi @@ -110,7 +110,24 @@ elif [ "$1" = "-s" -o "$1" = "-sparse" ] ; then chown $(logname) hdd.img echo "Applied original ownership to hard disk image file." +elif [ "$1" = "-h" -o "$1" = "--help" ] ; then + cat << CEOF + Usage: $0 [OPTION] + This utility generates 20MB sparse file 'hdd.img' which can be used as QEMU + disk image where all filesystem changes from the live session are persisted. + + -e, --empty Create empty sparse image file which is not formatted. + -f, --folder Create sparse image file formatted with Ext2 filesystem which + contains compatible overlay folder structure. + -h, --help Prints this help information. + -s, --sparse Create sparse image file formatted with FAT filesystem which + contains sparse image file 'minimal.img' (1MB) formatted with + Ext2 filesystem which contains the actual overlay structure. +CEOF + +elif [ "$1" = "" ] ; then + echo "No option specified. Use '-h' or '--help' for more info." else - echo "Option '$1' is not recognized. Valid options are '-f' and '-s'." + echo "Option '$1' is not recognized. Use '-h' or '--help' for more info." fi diff --git a/src/qemu32.sh b/src/qemu32.sh index 67d3e6f2d..940848a78 100755 --- a/src/qemu32.sh +++ b/src/qemu32.sh @@ -9,9 +9,9 @@ if [ "$1" = "-hdd" -o "$1" = "-h" ] ; then echo "Starting QEMU with attached ISO image and hard disk." - qemu-system-i386 -m 64M -hda hdd.img -cdrom minimal_linux_live.iso -boot d + qemu-system-i386 -m 64M -cdrom minimal_linux_live.iso -hda hdd.img -boot d else - echo "Starting QEMU with attached ISO image." + echo "Starting QEMU with attached ISO image and no hard disk." qemu-system-i386 -m 64M -cdrom minimal_linux_live.iso -boot d fi diff --git a/src/qemu64.sh b/src/qemu64.sh index e5134b53f..bdc575174 100755 --- a/src/qemu64.sh +++ b/src/qemu64.sh @@ -9,7 +9,7 @@ if [ "$1" = "-hdd" -o "$1" = "-h" ] ; then echo "Starting QEMU with attached ISO image and hard disk." - qemu-system-x86_64 -m 64M -hda hdd.img -cdrom minimal_linux_live.iso -boot d + qemu-system-x86_64 -m 64M -cdrom minimal_linux_live.iso -hda hdd.img -boot d else echo "Starting QEMU with attached ISO image." qemu-system-x86_64 -m 64M -cdrom minimal_linux_live.iso -boot d