partial-repo.sh has a -i flag (incremental) to avoid doing the stuff over again
authorThierry Parmentelat <thierry.parmentelat@inria.fr>
Tue, 17 Mar 2015 08:46:30 +0000 (09:46 +0100)
committerThierry Parmentelat <thierry.parmentelat@inria.fr>
Tue, 17 Mar 2015 08:46:30 +0000 (09:46 +0100)
useful for tests and bonding plcs

partial-repo.sh

index 06da266..810c9b3 100755 (executable)
@@ -8,19 +8,34 @@ function usage () {
     exit 1
 }
 
-[[ -n "$@" ]] || usage
-case "$1" in *-h*) usage ;; esac
+    OPTS=$(getopt -o "ih" -- "$@")
+    if [ $? != 0 ]; then usage; fi
+    eval set -- "$OPTS"
+    while true; do
+       case $1 in
+           -i) INCREMENTAL=true; shift;;
+           -h) usage;;
+            --) shift; break ;;
+       esac
+    done
 
 set -e 
 
 for rpms_dir in $(find "$@" -name RPMS) ; do
     pushd $rpms_dir >& /dev/null
     cd ..
-    echo "==================== Dealing with repo $(pwd)"
+    echo "============================== Dealing with repo $(pwd)"
+    if [ -d PARTIAL-RPMS -a -n "$INCREMENTAL" ]; then
+       echo "$COMMAND - incremental mode"
+       echo "repo $rpms_dir already has a PARTIAL-RPMS - skipped"
+       popd >& /dev/null
+       continue
+    fi
     mkdir -p PARTIAL-RPMS
+    echo "========== rsyncing relevant rpms into PARTIAL-RPMS"
     rsync --archive --verbose $(find RPMS -type f | egrep '/(bootcd|bootstrapfs|nodeimage|noderepo|slicerepo)-.*-.*-.*-.*rpm') PARTIAL-RPMS/
-    echo "==================== building packages index in $(pwd) .."
+    echo "========== building packages index (i.e. running createrepo) in $(pwd)/PARTIAL-RPMS"
     createrepo PARTIAL-RPMS
-    echo '==================== DONE'
+    echo "========== DONE"
     popd >& /dev/null
 done