#!/bin/sh cd /home/quake/q2/opentdm map=$1 if [ -z $map ]; then echo "usage: $0 (without the .bsp)" exit 1 fi # map not found in filesystem, grab it if [ ! -f "maps/$map.bsp" ]; then wget http://q2.packetflinger.com/dl/baseq2/maps/$map.bsp -O maps/$map.bsp chown quake:quake maps/$map.bsp # 404, blank file saved, remove it if [ "`du maps/$map.bsp | cut -f1`" = "0" ]; then unlink maps/$map.bsp fi fi # map not in the maplist file if [ -z "`cat maps.txt | grep $map`" -a -f "maps/$map.bsp" ]; then echo "$map" >> maps.txt fi