[arch-projects] [PATCH] [mkinitcpio] Don't print success/failure result on same line

Dan McGee dan at archlinux.org
Sun May 15 15:20:41 EDT 2011


Doing the `echo -n` call causes the shell to line-buffer the output
anyway, meaning one doesn't see the first part until 'SUCCESS' or
'FAILURE' is printed. This means the last message on the screen is
'Generating module dependencies' when in fact we are actually generating
the image, which can take a lot of time when XZ, etc. are used.

Print the status on two lines, ensuring buffering is not causing
problems with out output.

Signed-off-by: Dan McGee <dan at archlinux.org>
---
 mkinitcpio |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/mkinitcpio b/mkinitcpio
index 31145d0..0ebf7c9 100755
--- a/mkinitcpio
+++ b/mkinitcpio
@@ -282,14 +282,14 @@ fi
 
 status=0
 if [ -n "${GENIMG}" ]; then
-    echo -n ":: Generating image '${GENIMG}'..."
+    echo ":: Generating image '${GENIMG}'"
     shopt -s -o pipefail
     [ ${COMPRESSION} = "xz" ] && COMPRESSION_OPTIONS="${COMPRESSION_OPTIONS} --check=crc32"
     if ! /sbin/gen_init_cpio ${FILELIST} | ${COMPRESSION} ${COMPRESSION_OPTIONS} > "${GENIMG}"; then
-        echo "FAILED"
+        echo ":: Image generation FAILED"
         status=1
     else
-        echo "SUCCESS"
+        echo ":: Image generation successful"
         status=0
     fi
 
-- 
1.7.5.1



More information about the arch-projects mailing list