From 52867dce456b5fd4421f3b5beb6c2e62249d5648 Mon Sep 17 00:00:00 2001
From: Ivan Davidov <davidov.i@gmail.com>
Date: Sun, 24 Apr 2016 01:17:40 +0300
Subject: [PATCH] Updates on the log messages.

---
 src/01_get_kernel.sh   |  4 ++--
 src/02_build_kernel.sh |  2 +-
 src/03_get_glibc.sh    |  4 ++--
 src/04_build_glibc.sh  |  4 ++--
 src/06_get_busybox.sh  |  4 ++--
 src/10_get_syslinux.sh |  4 ++--
 src/11_generate_iso.sh |  9 +++----
 src/generate_hdd.sh    | 53 +++++++++++++++++++++---------------------
 8 files changed, 43 insertions(+), 41 deletions(-)

diff --git a/src/01_get_kernel.sh b/src/01_get_kernel.sh
index 986f2b4de..b52105798 100755
--- a/src/01_get_kernel.sh
+++ b/src/01_get_kernel.sh
@@ -20,14 +20,14 @@ cd source
 
 if [ ! "$USE_LOCAL_SOURCE" = "true" ] ; then
   # Downloading kernel source bundle file. The '-c' option allows the download to resume.
-  echo "Downloading kernel source bundle from '$DOWNLOAD_URL'."
+  echo "Downloading kernel source bundle from $DOWNLOAD_URL"
   wget -c $DOWNLOAD_URL
 else
   echo "Using local kernel source bundle $SRC_DIR/source/$ARCHIVE_FILE"
 fi
 
 # Delete folder with previously extracted kernel.
-echo "Removing kernel work area..."
+echo "Removing kernel work area. This may take a while..."
 rm -rf ../work/kernel
 mkdir ../work/kernel
 
diff --git a/src/02_build_kernel.sh b/src/02_build_kernel.sh
index deccb6581..9adf74638 100755
--- a/src/02_build_kernel.sh
+++ b/src/02_build_kernel.sh
@@ -25,8 +25,8 @@ if [ "$USE_PREDEFINED_KERNEL_CONFIG" = "true" ] ; then
   cp -f $SRC_DIR/config_predefined/kernel.config .config
 else
   # Create default configuration file for the kernel.
-  echo "Generating default kernel configuration..."
   make defconfig
+  echo "Generated default kernel configuration."
 
   # Changes the name of the system to 'minimal'.
   sed -i "s/.*CONFIG_DEFAULT_HOSTNAME.*/CONFIG_DEFAULT_HOSTNAME=\"minimal\"/" .config
diff --git a/src/03_get_glibc.sh b/src/03_get_glibc.sh
index c5ef24594..29b521a4c 100755
--- a/src/03_get_glibc.sh
+++ b/src/03_get_glibc.sh
@@ -20,14 +20,14 @@ cd source
 
 if [ ! "$USE_LOCAL_SOURCE" = "true" ] ; then
   # Downloading glibc source bundle file. The '-c' option allows the download to resume.
-  echo "Downloading glibc source bundle from '$DOWNLOAD_URL'."
+  echo "Downloading glibc source bundle from $DOWNLOAD_URL"
   wget -c $DOWNLOAD_URL
 else
   echo "Using local glibc source bundle $SRC_DIR/source/$ARCHIVE_FILE"
 fi
 
 # Delete folder with previously extracted glibc.
-echo "Removing glibc work area..."
+echo "Removing glibc work area. This may take a while..."
 rm -rf ../work/glibc
 mkdir ../work/glibc
 
diff --git a/src/04_build_glibc.sh b/src/04_build_glibc.sh
index f525d6a39..9bfcd1239 100755
--- a/src/04_build_glibc.sh
+++ b/src/04_build_glibc.sh
@@ -12,16 +12,16 @@ cd work/glibc
 cd $(ls -d *)
 
 # Prepare working area, e.g. 'work/glibc/glibc-2.23/glibc_objects'.
-echo "Preparing glibc object area..."
+echo "Preparing glibc object area. This may take a while..."
 rm -rf ./glibc_objects
 mkdir glibc_objects
 
 # Prepare install area, e.g. 'work/glibc/glibc-2.23/glibc_installed'.
-echo "Preparing glibc install area..."
 rm -rf ./glibc_installed
 mkdir glibc_installed
 cd glibc_installed
 GLIBC_INSTALLED=$(pwd)
+echo "Prepared glibc install area."
 
 # All glibc work is done from the working area.
 cd ../glibc_objects
diff --git a/src/06_get_busybox.sh b/src/06_get_busybox.sh
index 067d19fc7..8fa4f9a36 100755
--- a/src/06_get_busybox.sh
+++ b/src/06_get_busybox.sh
@@ -20,14 +20,14 @@ cd source
 
 if [ ! "$USE_LOCAL_SOURCE" = "true" ] ; then
   # Downloading BusyBox source bundle file. The '-c' option allows the download to resume.
-  echo "Downloading BusyBox source bundle from '$DOWNLOAD_URL'."
+  echo "Downloading BusyBox source bundle from $DOWNLOAD_URL"
   wget -c $DOWNLOAD_URL
 else
   echo "Using local BusyBox source bundle $SRC_DIR/source/$ARCHIVE_FILE"
 fi
 
 # Delete folder with previously extracted busybox.
-echo "Removing BusyBox work area..."
+echo "Removing BusyBox work area. This may take a while..."
 rm -rf ../work/busybox
 mkdir ../work/busybox
 
diff --git a/src/10_get_syslinux.sh b/src/10_get_syslinux.sh
index 54ccbf232..dd71ac58c 100755
--- a/src/10_get_syslinux.sh
+++ b/src/10_get_syslinux.sh
@@ -20,14 +20,14 @@ cd source
 
 if [ ! "$USE_LOCAL_SOURCE" = "true" ] ; then
   # Downloading SYSLINUX source bundle file. The '-c' option allows the download to resume.
-  echo "Downloading SYSLINUX source bundle from '$DOWNLOAD_URL'."
+  echo "Downloading SYSLINUX source bundle from $DOWNLOAD_URL"
   wget -c $DOWNLOAD_URL
 else
   echo "Using local SYSLINUX source bundle $SRC_DIR/source/$ARCHIVE_FILE"
 fi
 
 # Delete folder with previously extracted Syslinux.
-echo "Removing SYSLINUX work area..."
+echo "Removing SYSLINUX work area. This may take a while..."
 rm -rf ../work/syslinux
 mkdir ../work/syslinux
 
diff --git a/src/11_generate_iso.sh b/src/11_generate_iso.sh
index 4e2d59d4e..d28aea424 100755
--- a/src/11_generate_iso.sh
+++ b/src/11_generate_iso.sh
@@ -15,17 +15,17 @@ WORK_SYSLINUX_DIR=$(pwd)
 cd ../../..
 
 # Remove the old ISO file if it exists.
-echo "Removing old ISO image..."
 rm -f minimal_linux_live.iso
+echo "Old ISO image files has been removed."
 
 # Remove the old ISO generation area if it exists.
 echo "Removing old ISO image work area..."
 rm -rf work/isoimage
 
 # This is the root folder of the ISO image.
-echo "Preparing ISO image work area..."
 mkdir work/isoimage
 cd work/isoimage
+echo "Prepared new ISO image work area."
 
 # Copy the precompiled files 'isolinux.bin' and 'ldlinux.c32' in the ISO image root folder.
 cp $WORK_SYSLINUX_DIR/bios/core/isolinux.bin .
@@ -100,7 +100,7 @@ elif [ "$OVERLAY_TYPE" = "folder" ] ; then
   
   cp -rf $SRC_DIR/11_generate_iso/* minimal/rootfs/
 else
-  echo "Generated ISO image will have no overlay structure."
+  echo "Generating ISO image with no overlay structure..."
 fi
 
 # Create ISOLINUX configuration file.
@@ -123,7 +123,8 @@ if [ "$(id -u)" = "0" ] ; then
   # Apply ownership back to original owner for all affected files.
   chown $(logname) ../../minimal_linux_live.iso
   chown $(logname) ../../work/minimal_linux_live.iso
-  chown -R $(logname) .  
+  chown -R $(logname) .
+  echo "Applied original ownership to all affected files and folders."
 fi
 
 cd ../..
diff --git a/src/generate_hdd.sh b/src/generate_hdd.sh
index 074bf6f5a..5fc2da2de 100755
--- a/src/generate_hdd.sh
+++ b/src/generate_hdd.sh
@@ -3,113 +3,114 @@
 # Create sparse file of 20MB which can be used by QEMU.
 
 if [ "$1" = "" ] ; 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
   if [ ! "$(id -u)" = "0" ] ; then
     echo "Using option '-f' (or '-folder') requires root permissions."
     exit 1
   fi
   
-  echo "Create new hard disk image file with 20MB size."
   rm -f hdd.img
   truncate -s 20M hdd.img
+  echo "Created new hard disk image file 'hdd.img' with 20MB size."
   
   LOOP_DEVICE=$(losetup -f)
-  
-  echo "Attach hard disk image file to loop device."
   losetup $LOOP_DEVICE hdd.img
+  echo "Attached hard disk image file to loop device."
   
-  echo "Format hard disk image file with Ext2 filesystem."
   mkfs.ext2 $LOOP_DEVICE
+  echo "Hard disk image file has been formatted with Ext2 filesystem."
   
-  echo "Mount hard disk image file to temporary folder."
   mkdir folder
   mount hdd.img folder
+  echo "Mounted hard disk image file to temporary folder."
   
-  echo "Create overlay structure."
   mkdir -p folder/minimal/rootfs
   mkdir -p folder/minimal/work
+  echo "Overlay structure has been created."
   
-  echo "Create sample text file."
   echo "This file is on external hard disk." > folder/minimal/rootfs/overlay.txt 
+  echo "Created sample text file."
 
-  echo "Unmount hard disk image file."
   umount folder
   rm -rf folder
+  echo "Unmounted hard disk image file."
   
-  echo "Detach hard disk image file from loop device."
   losetup -d $LOOP_DEVICE
+  echo "Detached hard disk image file from loop device."
   
-  echo "Apply original ownership to hard disk image file."
   chown $(logname) hdd.img
+  echo "Applied original ownership to hard disk image file."
 elif [ "$1" = "-s" -o "$1" = "-sparse" ] ; then
   if [ ! "$(id -u)" = "0" ] ; then
     echo "Using option '-s' (or '-sparse') requires root permissions."
     exit 1
   fi
   
-  echo "Create new hard disk image file with 20MB size."
   rm -f hdd.img
   truncate -s 20M hdd.img
+  echo "Created new hard disk image file 'hdd.img' with 20MB size."
   
   LOOP_DEVICE_HDD=$(losetup -f)
-  
-  echo "Attach hard disk image file to loop device."
   losetup $LOOP_DEVICE_HDD hdd.img
+  echo "Attached hard disk image file to loop device."
   
-  echo "Format hard disk image file with FAT filesystem."
   mkfs.vfat $LOOP_DEVICE_HDD
+  echo "Hard disk image file has been formatted with FAT filesystem."
   
-  echo "Mount hard disk image file to temporary folder."
   mkdir sparse
   mount hdd.img sparse
+  echo "Mounted hard disk image file to temporary folder."
   
-  echo "Create new overlay image file with 1MB size."
   rm -f sparse/minimal.img
   truncate -s 1M sparse/minimal.img
+  echo "Created new overlay image file with 1MB size."
 
   LOOP_DEVICE_OVL=$(losetup -f)
-  echo "Attach overlay image file to loop device."
   losetup $LOOP_DEVICE_OVL sparse/minimal.img
+  echo "Attached overlay image file to loop device."
 
-  echo "Format overlay image file with Ext2 filesystem."
   mkfs.ext2 $LOOP_DEVICE_OVL
+  echo "Overlay image file has been formatted with Ext2 filesystem."
 
-  echo "Mount overlay image file to temporary folder."
   mkdir ovl
   mount sparse/minimal.img ovl
+  echo "Mounted overlay image file to temporary folder."
   
-  echo "Create overlay structure."
   mkdir -p ovl/rootfs
   mkdir -p ovl/work
+  echo "Overlay structure has been created."
   
   echo "Create sample text file."
   echo "This file is on external hard disk." > ovl/rootfs/overlay.txt
 
-  echo "Apply root ownership to overlay content."
   chown -R root:root ovl
+  echo "Applied root ownership to overlay content."
 
-  echo "Unmount overlay image file."
   umount ovl
   sleep 1
   rm -rf ovl
+  echo "Unmounted overlay image file."
 
-  echo "Detach overlay image file from loop device."
   losetup -d $LOOP_DEVICE_OVL
   sleep 1
+  echo "Overlay image file has been detached from loop device."
 
-  echo "Unmount hard disk image file."
   umount sparse  
   sleep 1
   rm -rf sparse
+  echo "Unmounted hard disk image file."
   
-  echo "Detach hard disk image file from loop device."
   losetup -d $LOOP_DEVICE_HDD
   sleep 1
+  echo "Hard disk image file has been detached from loop device."
   
-  echo "Apply original ownership to hard disk image file."
   chown $(logname) hdd.img
+  echo "Applied original ownership to hard disk image file."
 else
   echo "Option '$1' is not recognized. Valid options are '-f' and '-s'."
 fi
+