diff options
| -rw-r--r-- | baseq3/server.cfg | 19 | ||||
| -rwxr-xr-x | fetchpk3.sh | 60 |
2 files changed, 49 insertions, 30 deletions
diff --git a/baseq3/server.cfg b/baseq3/server.cfg deleted file mode 100644 index d4b4f98..0000000 --- a/baseq3/server.cfg +++ /dev/null | |||
| @@ -1,19 +0,0 @@ | |||
| 1 | set sv_hostname "Q3Plus 3v3 Philw Tournament Server" | ||
| 2 | set g_motd "GL & HF" | ||
| 3 | |||
| 4 | set sv_maxclients "6" | ||
| 5 | set sv_fps "125" | ||
| 6 | set sv_timeout "200" | ||
| 7 | |||
| 8 | set g_gametype "4" | ||
| 9 | set timelimit "20" | ||
| 10 | set fraglimit "0" | ||
| 11 | |||
| 12 | set g_warmup "20" | ||
| 13 | set g_doWarmup "1" | ||
| 14 | |||
| 15 | set sv_pure "1" | ||
| 16 | set sv_strictAuth "1" | ||
| 17 | |||
| 18 | |||
| 19 | map q3dm6 | ||
diff --git a/fetchpk3.sh b/fetchpk3.sh index 7c2394e..fae9520 100755 --- a/fetchpk3.sh +++ b/fetchpk3.sh | |||
| @@ -5,15 +5,53 @@ | |||
| 5 | exit 1 | 5 | exit 1 |
| 6 | } | 6 | } |
| 7 | 7 | ||
| 8 | mkdir -p "$DIR" | 8 | SCRIPT_DIR=$(cd "$(dirname "$0")" 2>/dev/null && pwd) |
| 9 | 9 | DIR="$SCRIPT_DIR/$DIR" | |
| 10 | wget -nc -nd -r -l1 --no-parent -A '*.pk3' -P "$DIR" "$URL" \ | 10 | |
| 11 | || { | 11 | setup() { |
| 12 | echo "wget not present, fallback to curl..." | 12 | mkdir -p "$DIR" |
| 13 | curl -s "$URL" \ | 13 | command -v wget >/dev/null 2>&1 \ |
| 14 | | grep -o 'href="[^"]*\.pk3"' \ | 14 | || command -v curl >/dev/null 2>&1 \ |
| 15 | | cut -d'"' -f2 \ | 15 | || { |
| 16 | | while read -r f; do | 16 | echo "Error: neither wget nor curl is installed." |
| 17 | [ -f "$DIR/$f" ] || curl -# -o "$DIR/$f" "$URL/$f" | 17 | echo "Please install wget or curl." |
| 18 | done | 18 | exit 1 |
| 19 | } | ||
| 20 | } | ||
| 21 | |||
| 22 | fetch_pk3() { | ||
| 23 | SRC_URL="$1" | ||
| 24 | echo "Source: $SRC_URL" | ||
| 25 | command -v wget >/dev/null 2>&1 \ | ||
| 26 | && wget -nc -nd -r -l1 --no-parent -A '*.pk3' -P "$DIR" "$SRC_URL" \ | ||
| 27 | && return | ||
| 28 | echo "wget not available, using curl..." | ||
| 29 | curl -s "$SRC_URL" \ | ||
| 30 | | grep '\.pk3"' \ | ||
| 31 | | cut -d'"' -f2 \ | ||
| 32 | | while read -r f; do | ||
| 33 | TARGET="$DIR/$f" | ||
| 34 | [ -s "$TARGET" ] && echo "✓ exists: $f" && continue | ||
| 35 | echo "↓ downloading: $f" | ||
| 36 | curl -s -o "$TARGET" "$SRC_URL/$f" | ||
| 37 | done | ||
| 38 | } | ||
| 39 | |||
| 40 | game() { | ||
| 41 | echo "Fetching base game pk3 files..." | ||
| 42 | fetch_pk3 "$URL" | ||
| 19 | } | 43 | } |
| 44 | |||
| 45 | maps() { | ||
| 46 | echo "Fetching baseq3 pk3 files (maps + base)..." | ||
| 47 | fetch_pk3 "$MAP_URL" | ||
| 48 | } | ||
| 49 | |||
| 50 | main() { | ||
| 51 | setup | ||
| 52 | game | ||
| 53 | maps | ||
| 54 | echo "All pk3 files fetched into $DIR" | ||
| 55 | } | ||
| 56 | |||
| 57 | main | ||
