#!/bin/bash EXT=pk3 VERSION=0.1 #default values UPDATE=1 VERBOSE=0 GenPK3_Usage() { echo "Usage: $0 mapname (without extension)" exit 1 } if ! test -d "./maps"; then echo "$0 must be in the base dir" exit 1 fi while true do case "$1" in --version | -v) echo GenPK3 version $VERSION exit 0 ;; --only-new) UPDATE=0 shift ;; --verbose) VERBOSE=1 shift ;; *) break ;; esac done ZIP_PARM=-9 if test "$UPDATE" == 1; then ZIP_PARM+=u fi if test "$VERBOSE" == 1; then ZIP_PARM+=v else ZIP_PARM+=q fi if test $# -lt 1; then GenPK3_Usage else mapname=`basename "$1"` echo "Generating $mapname.pk3" echo ".. zip options: $ZIP_PARM" for daynight in `echo "d n"`; do if test -f "maps/$1$daynight.bsp"; then if test -f "maps/$1$daynight.map"; then zip $ZIP_PARM $mapname.$EXT maps/$1$daynight.map maps/$1$daynight.bsp else echo "$1$daynight.map (source map) does not exist." exit 1 fi else echo "$1$daynight.bsp (compiled map) does not exist." exit 1 fi done fi