getmap.sh 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #!/usr/bin/env bash
  2. #########
  3. # this simple shellscript just gets the .zip from the server and
  4. # puts the .bsp, which comes out of it (./maps/) to the current directory.
  5. #
  6. # Just put this script into your map-directory.
  7. # Try: ./getmap.sh cliff2
  8. # This is where you get your maps from...
  9. # Set this with trailing slash pls:
  10. # by Haudrauf
  11. MAPSERVER=http://aq2maps.quadaver.org/
  12. #########
  13. # just the name of the zip
  14. MAP2GET=$1
  15. CWD=$(pwd)
  16. ACTIONDIR=$CWD/../
  17. MAPDIR=$ACTIONDIR/maps
  18. MTEMP=$CWD/maptemp
  19. function getMap {
  20. cd $MTEMP
  21. wget $MAPSERVER$MAP2GET.zip
  22. }
  23. function unzipMap {
  24. cd $MTEMP
  25. unzip $MAP2GET.zip *bsp
  26. }
  27. function copyBSP {
  28. cd $MTEMP
  29. THEMAP=`find | grep -i \.bsp`
  30. cp -u $THEMAP $MAPDIR
  31. }
  32. function makeTemp {
  33. mkdir $MTEMP
  34. cd $MTEMP
  35. }
  36. function killTemp {
  37. cd $CWD
  38. rm -rf $MTEMP
  39. }
  40. function main {
  41. if [ "$1" != "" ]; then
  42. makeTemp
  43. getMap
  44. unzipMap
  45. copyBSP
  46. killTemp
  47. else
  48. echo "Usage: $0 <mapname>"
  49. fi
  50. if [ -x ./make_maplist.sh ]; then
  51. ./make_maplist.sh
  52. fi
  53. }
  54. main $*