[arch-releng] [PATCH] Avoid force/rebuild of squashfs images if already updated.

Gerardo Exequiel Pozzi vmlinuz386 at yahoo.com.ar
Mon Nov 9 19:44:23 EST 2009


Check if there are any modification of files/directories inside
the target directory for squashfs image.

Implements in some way this item in TODO:
* Add 'needsupdate' function to check if a squashfs image in the
  iso dir is up to date, if so, skip it; else rebuild it. No more
  need for the -f flag

Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386 at yahoo.com.ar>
---
 archiso/mkarchiso |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/archiso/mkarchiso b/archiso/mkarchiso
index b6d0f54..e71660e 100755
--- a/archiso/mkarchiso
+++ b/archiso/mkarchiso
@@ -159,13 +159,13 @@ _mksquash () {
     sqimg="${work_dir}/iso/$(basename ${1}).sqfs"
     echo "====> Generating SquashFS image for '${1}'"
     if [ -e "${sqimg}" ]; then
-        if [ "${FORCE}" = "y" ]; then
-            echo -n "Removing old SquashFS image..."
+        dirhaschanged=$(find ${1} -newer ${sqimg})
+        if [ "${dirhaschanged}" != "" ]; then
+            echo "SquashFS image '${sqimg}' is not up to date, rebuilding..."
             rm "${sqimg}"
-            echo "done."
         else
-            echo "error: SquashFS image '${sqimg}' already exists, aborting."
-            exit 1
+            echo "SquashFS image '${sqimg}' is up to date, skipping."
+            return
         fi
     fi
 
-- 
1.6.5.2




More information about the arch-releng mailing list