X-Git-Url: http://git.onelab.eu/?p=build.git;a=blobdiff_plain;f=partial-repo.sh;h=810c9b328a466270a9dbdddb09991af2111c1bdd;hp=06da2663713e791d196f9a737b4638e582484428;hb=cc5a9338d1528a7fec60f496bfba7b8b28a80539;hpb=fe95c83578ea97aaa815fc53d915d55eb9facef0 diff --git a/partial-repo.sh b/partial-repo.sh index 06da2663..810c9b32 100755 --- a/partial-repo.sh +++ b/partial-repo.sh @@ -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