add a comment to indicate the options
[divverent/netradiant.git] / download-gamepacks.sh
1 #!/bin/sh
2
3 # Usage:
4 #   sh download-gamepack.sh
5 #   LICENSEFILTER=GPL BATCH=1 sh download-gamepack.sh
6
7 pack()
8 {
9         pack=$1; shift
10         license=$1; shift
11         sourcetype=$1; shift
12         source=$1; shift
13
14         if [ -d "games/$pack" ]; then
15                 echo "Updating $pack..."
16                 case "$sourcetype" in
17                         svn)
18                                 svn update "games/$pack" "$@"
19                                 ;;
20                 esac
21                 return
22         fi
23
24         echo
25         echo "Available pack: $pack"
26         echo "  License: $license"
27         echo "  Download via $sourcetype from $source"
28         echo
29         case " $PACKFILTER " in
30                 "  ")
31                         ;;
32                 *" $pack "*)
33                         ;;
34                 *)
35                         echo "Pack $pack rejected because it is not in PACKFILTER."
36                         return
37                         ;;
38         esac
39         case " $LICENSEFILTER " in
40                 "  ")
41                         ;;
42                 *" $license "*)
43                         ;;
44                 *)
45                         echo "Pack $pack rejected because its license is not in LICENSEFILTER."
46                         return
47                         ;;
48         esac
49         case "$BATCH" in
50                 '')
51                         while :; do
52                                 echo "Download this pack? (y/n)"
53                                 read -r P
54                                 case "$P" in
55                                         y*)
56                                                 break
57                                                 ;;
58                                         n*)
59                                                 return
60                                                 ;;
61                                 esac
62                         done
63                         ;;
64                 *)
65                         ;;
66         esac
67         
68         echo "Downloading $pack..."
69         case "$sourcetype" in
70                 svn)
71                         svn checkout "$source" "games/$pack" "$@"
72                         ;;
73         esac
74 }
75
76 mkdir -p games
77 pack NexuizPack      GPL         svn svn://svn.icculus.org/nexuiz/trunk/misc/netradiant-NexuizPack
78 pack Quake2WorldPack GPL         svn svn://jdolan.dyndns.org/quake2world/trunk/gtkradiant
79 pack DarkPlacesPack  GPL         svn https://zerowing.idsoftware.com/svn/radiant.gamepacks/DarkPlacesPack/branches/1.5/
80 pack WarsowPack      GPL         svn http://opensvn.csie.org/warsowgamepack/netradiant/games/WarsowPack/
81 pack Q3Pack          proprietary svn https://zerowing.idsoftware.com/svn/radiant.gamepacks/Q3Pack/trunk/ -r29
82 pack UFOAIPack       proprietary svn https://zerowing.idsoftware.com/svn/radiant.gamepacks/UFOAIPack/branches/1.5/