allow undo “make detail/structural”, <3 @SpiKe, thanks @Garux, fix #76
[xonotic/netradiant.git] / download-gamepacks.sh
index e15ded9..75c1c3d 100755 (executable)
@@ -2,16 +2,16 @@
 
 # Usage:
 #   sh download-gamepack.sh
-#   LICENSEFILTER=GPL BATCH=1 sh download-gamepack.sh
+#   LICENSEFILTER=GPL,BSD BATCH=1 sh download-gamepack.sh
 
 : ${GIT:=git}
 : ${SVN:=svn}
 : ${WGET:=wget}
 : ${ECHO:=echo}
 : ${MKDIR:=mkdir}
-: ${RM_R:=rm -r}
+: ${RM_R:=rm -f -r}
 : ${MV:=mv}
-: ${UNZIP:=unzip}
+: ${UNZIPPER:=unzip}
 
 set -e
 
@@ -35,29 +35,29 @@ pack()
                $ECHO "Updating $pack..."
                case "$sourcetype" in
                        svn)
-                               $SVN update "games/$pack" "$@"
+                               $SVN update "games/$pack" "$@" || true
                                ;;
                        zip1)
                                $RM_R zipdownload
                                $MKDIR zipdownload
                                cd zipdownload
-                               $WGET "$source" "$@"
-                               $UNZIP *
+                               $WGET "$source" "$@" || true
+                               $UNZIPPER *.zip || true
                                cd ..
                                $RM_R "games/$pack"
                                $MKDIR "games/$pack"
-                               $MV zipdownload/*/* "games/$pack/"
+                               $MV zipdownload/*/* "games/$pack/" || true
                                $RM_R zipdownload
                                ;;
                        gitdir)
                                $RM_R "games/$pack"
                                cd games
-                               $GIT archive --remote="$source" --prefix="$pack/" "$2":"$1" | tar xvf -
+                               $GIT archive --remote="$source" --prefix="$pack/" "$2":"$1" | tar xvf - || true
                                cd ..
                                ;;
                        git)
                                cd "games/$pack"
-                               $GIT pull
+                               $GIT pull || true
                                cd ../..
                                ;;
                esac
@@ -83,11 +83,12 @@ pack()
        case " $LICENSEFILTER " in
                "  ")
                        ;;
-               *" $license "*)
-                       ;;
                *)
-                       $ECHO "Pack $pack rejected because its license is not in LICENSEFILTER."
-                       return
+                       if ! echo "$LICENSEFILTER" | tr ',' '\n' | grep -F -q -x "$license"
+                       then
+                               $ECHO "Pack $pack rejected because its license is not in LICENSEFILTER."
+                               return
+                       fi
                        ;;
        esac
        case "$BATCH" in
@@ -112,42 +113,67 @@ pack()
        $ECHO "Downloading $pack..."
        case "$sourcetype" in
                svn)
-                       $SVN checkout "$source" "games/$pack" "$@"
+                       $SVN checkout "$source" "games/$pack" "$@" || true
                        ;;
                zip1)
                        $RM_R zipdownload
                        $MKDIR zipdownload
                        cd zipdownload
-                       $WGET "$source" "$@"
-                       $UNZIP *
+                       $WGET "$source" "$@" || true
+                       $UNZIPPER *.zip || true
                        cd ..
                        $MKDIR "games/$pack"
-                       $MV zipdownload/*/* "games/$pack/"
+                       $MV zipdownload/*/* "games/$pack/" || true
                        $RM_R zipdownload
                        ;;
                gitdir)
                        cd games
-                       $GIT archive --remote="$source" --prefix="$pack/" "$2":"$1" | tar xvf -
+                       $GIT archive --remote="$source" --prefix="$pack/" "$2":"$1" | tar xvf - || true
                        cd ..
                        ;;
                git)
                        cd games
-                       $GIT clone "$source" "$pack"
+                       $GIT clone "$source" "$pack" || true
                        cd ..
                        ;;
        esac
        extra_urls "games/$pack"
+       good=false
+       for D in "games/$pack"/*.game; do
+               if [ -d "$D" ]; then
+                       good=true
+               fi
+       done
+       $good || rm -rf "$D"
 }
 
 mkdir -p games
-pack DarkPlacesPack  GPL         svn    https://zerowing.idsoftware.com/svn/radiant.gamepacks/DarkPlacesPack/branches/1.5/
-pack NexuizPack      GPL         gitdir git://git.icculus.org/divverent/nexuiz.git misc/netradiant-NexuizPack master
-pack OpenArenaPack   unknown     zip1   http://ingar.satgnu.net/files/gtkradiant/gamepacks/OpenArenaPack.zip
-pack Q3Pack          proprietary svn    https://zerowing.idsoftware.com/svn/radiant.gamepacks/Q3Pack/trunk/ -r29
-pack Quake2Pack      proprietary zip1   http://ingar.satgnu.net/files/gtkradiant/gamepacks/Quake2Pack.zip
-pack Quake2WorldPack GPL         svn    svn://jdolan.dyndns.org/quake2world/trunk/gtkradiant
-pack QuakePack       proprietary zip1   http://ingar.satgnu.net/files/gtkradiant/gamepacks/QuakePack.zip
-pack TremulousPack   proprietary zip1   http://ingar.satgnu.net/files/gtkradiant/gamepacks/TremulousPack.zip
-pack UFOAIPack       proprietary svn    https://zerowing.idsoftware.com/svn/radiant.gamepacks/UFOAIPack/branches/1.5/
-pack WarsowPack      GPL         svn    http://opensvn.csie.org/warsowgamepack/netradiant/games/WarsowPack/
-pack XonoticPack     GPL         git    git://git.xonotic.org/xonotic/netradiant-xonoticpack.git
+pack DarkPlacesPack    GPL         svn    svn://svn.icculus.org/gtkradiant-gamepacks/DarkPlacesPack/branches/1.5/
+pack Doom3Pack         proprietary svn    svn://svn.icculus.org/gtkradiant-gamepacks/Doom3Pack/branches/1.5/
+pack ETPack            proprietary svn    svn://svn.icculus.org/gtkradiant-gamepacks/ETPack/branches/1.5/
+pack Heretic2Pack      proprietary svn    svn://svn.icculus.org/gtkradiant-gamepacks/Her2Pack/branches/1.5/
+pack JediAcademyPack   proprietary svn    svn://svn.icculus.org/gtkradiant-gamepacks/JAPack/branches/1.5/
+pack NeverballPack     proprietary zip1   http://ingar.intranifty.net/files/netradiant/gamepacks/NeverballPack.zip
+pack NexuizPack        GPL         gitdir git://git.icculus.org/divverent/nexuiz.git misc/netradiant-NexuizPack master
+#pack OpenArenaPack    unknown     zip1   http://ingar.satgnu.net/files/netradiant/gamepacks/OpenArenaPack.zip
+pack OpenArenaPack     GPL         git    https://github.com/NeonKnightOA/oagamepack.git
+pack OsirionPack       GPL         zip1   http://ingar.intranifty.net/files/netradiant/gamepacks/OsirionPack.zip
+pack PreyPack          proprietary svn    svn://svn.icculus.org/gtkradiant-gamepacks/PreyPack/trunk/
+pack Q3Pack            proprietary svn    svn://svn.icculus.org/gtkradiant-gamepacks/Q3Pack/trunk/ -r29
+pack Quake2Pack        proprietary svn    svn://svn.icculus.org/gtkradiant-gamepacks/Q2Pack/branches/1.5/
+pack Quake4Pack        proprietary svn    svn://svn.icculus.org/gtkradiant-gamepacks/Q4Pack/branches/1.5/
+#pack QuakePack        proprietary zip1   http://ingar.intranifty.net/files/netradiant/gamepacks/QuakePack.zip
+pack QuakePack         GPL         zip1   http://ingar.intranifty.net/files/netradiant/gamepacks/Quake1Pack.zip
+#pack Quake2WorldPack  GPL         svn    svn://jdolan.dyndns.org/quake2world/trunk/gtkradiant
+pack QuetooPack        GPL         svn    svn://svn.icculus.org/gtkradiant-gamepacks/QuetooPack/branches/1.5/
+#pack TremulousPack    proprietary svn    svn://svn.icculus.org/gtkradiant-gamepacks/TremulousPack/branches/1.5/
+pack TremulousPack     proprietary zip1   http://ingar.intranifty.net/files/netradiant/gamepacks/TremulousPack.zip
+pack TurtleArenaPack   proprietary git    https://github.com/Turtle-Arena/turtle-arena-radiant-pack.git
+pack UFOAIPack         proprietary svn    svn://svn.icculus.org/gtkradiant-gamepacks/UFOAIPack/branches/1.5/
+#pack UnvanquishedPack unknown     zip1   http://ingar.intranifty.net/gtkradiant/files/gamepacks/UnvanquishedPack.zip
+pack UnvanquishedPack  BSD         svn    https://github.com/Unvanquished/unvanquished-mapeditor-support.git/trunk/build/netradiant
+#pack WarsowPack       GPL         svn    https://svn.bountysource.com/wswpack/trunk/netradiant/games/WarsowPack/
+#pack WarsowPack       GPL         zip1   http://ingar.intranifty.net/files/netradiant/gamepacks/WarsowPack.zip
+pack WarsowPack        GPL         git    https://github.com/Warsow/NetRadiantPack.git
+pack WolfPack          proprietary svn    svn://svn.icculus.org/gtkradiant-gamepacks/WolfPack/branches/1.5/
+pack XonoticPack       GPL         git    https://gitlab.com/xonotic/netradiant-xonoticpack.git