]> git.xonotic.org Git - xonotic/xonotic.git/blobdiff - misc/tools/xonotic-map-compiler-autobuild
add curl as a backup for wget, needed on OSX
[xonotic/xonotic.git] / misc / tools / xonotic-map-compiler-autobuild
index 672489ff3de62e899d1317c1ef9afbe3ca83c2b3..9e218f8f12f54d34eb264b4bd42e700402131d93 100755 (executable)
@@ -125,12 +125,12 @@ buildthemap()
        if [ -n "$IRCSPAM" ]; then
                pre2spam "$M" "$url$M-$blobhash.pk3" "$REFNAME" "$HASH" | $IRCSPAM
        fi
-       t0=`date +$s`
+       t0=`date +%s`
        (
                cd maps
                ../../../misc/tools/xonotic-map-compiler "$M" `grep ^- "$M.map.options" | cut -d '#' -f 1` $override > "$M.log"
        )
-       t1=`date +$s`
+       t1=`date +%s`
        dt=$(($t1 - $t0))
        status=$?
        if [ -n "$IRCSPAM" ]; then
@@ -154,9 +154,11 @@ getthemap()
                continue
        fi
        if ! wget -O "$bspdir/$M-$blobhash.pk3" "$url$M-$blobhash.pk3"; then
-               rm -f "$bspdir/$M-$blobhash.pk3"
-               echo "WARNING: could not download $url$M-$blobhash.pk3, maybe not ready yet"
-               return 0
+               if ! curl -o "$bspdir/$M-$blobhash.pk3" "$url$M-$blobhash.pk3"; then
+                       rm -f "$bspdir/$M-$blobhash.pk3"
+                       echo "WARNING: could not download $url$M-$blobhash.pk3, maybe not ready yet"
+                       return 0
+               fi
        fi
        if ! unzip -l "$bspdir/$M-$blobhash.pk3"; then
                rm -f "$bspdir/$M-$blobhash.pk3"
@@ -173,14 +175,18 @@ case "$1" in
                git for-each-ref 'refs/remotes' | while read -r HASH TYPE REFNAME; do
                        git reset --hard
                        git clean -xfd
-                       git checkout "$HASH"
+                       git checkout -f "$HASH"
                        allmaps buildthemap "$REFNAME" "$HASH" "$url" "$bspoutdir"
                done
-               git checkout master
+               git checkout -f master
                ;;
        download)
                mkdir -p "$bspdir" "$bspdir.old"
-               mv "$bspdir"/*-????????????????????????????????????????-????????????????????????????????????????.pk3 "$bspdir.old"/ || true
+               for b in "$bspdir"/*-????????????????????????????????????????-????????????????????????????????????????.pk3; do
+                       if [ -e "$b" ]; then
+                               mv "$b" "$bspdir.old"/
+                       fi
+               done
                cd data/xonotic-maps.pk3dir
                allmaps getthemap "$url" "$bspdir.old" "$bspdir"
                echo "List of maps that got deleted (if any) and currently are in $bspdir.old:"