-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: remove old-style bash backticks
- Loading branch information
1 parent
65a0d81
commit b10384b
Showing
3 changed files
with
70 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,7 +24,7 @@ | |
# scripts | ||
*.bat | ||
*.cmd | ||
*.sh | ||
#*.sh | ||
|
||
# windows thumbnail cache files | ||
Thumbs.db | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
#!/usr/bin/env bash | ||
|
||
echo "Xmas compile.sh script" | ||
|
||
FSUFFIX="zZz_XMAS_EVENT_v23_pak" | ||
ZIPSPLIT=134217728 # 128 MiB | ||
PAK=0 | ||
|
||
# 7z command varies depending on distro | ||
ZIPCOMMAND=`command -v 7z` | ||
if [[ -z "$ZIPCOMMAND" ]]; then | ||
ZIPCOMMAND=`command -v 7za` | ||
fi | ||
if [[ -z "$ZIPCOMMAND" ]]; then | ||
ZIPCOMMAND=`command -v 7zz` | ||
fi | ||
if [[ -z "$ZIPCOMMAND" ]]; then | ||
echo "7zip not available" | ||
exit | ||
fi | ||
|
||
# remove any existing pk3s | ||
if [[ -f "$FSUFFIX$PAK.pk3" ]]; then | ||
rm *.pk3 | ||
fi | ||
|
||
echo "Compiling data..." | ||
ZIPOUTPUT=$($ZIPCOMMAND a -tzip "$FSUFFIX$PAK.pk3" "./data/"*) #>/dev/null 2>&1 | ||
|
||
# read in map list | ||
MAPSRAW=() | ||
while IFS='' read -r L; do | ||
if [[ "${L:0:1}" == '#' || -z "$L" ]]; then | ||
continue | ||
fi | ||
|
||
if [[ ! -d "maps/maps/$L" ]]; then | ||
echo "Directory (maps/\"$L\") from maplist does not exist" | ||
continue | ||
fi | ||
|
||
MAPSRAW+=("$L") | ||
done < maps/maplist | ||
|
||
# reverse sort | ||
MAPS=() | ||
readarray -td '' MAPS < <(printf '%s\0' "${MAPSRAW[@]}" | sort -r -z) | ||
|
||
echo "Found ${#MAPS[@]} maps in maplist" | ||
echo "Compiling map pk3s..." | ||
|
||
# build | ||
i=1 | ||
for MAP in "${MAPS[@]}"; do | ||
MAPSIZE=$(du -s -b "maps/maps/$MAP" | cut -f1) | ||
printf "%2i / %-2i %-32s %-4s %10d KiB \n" $i ${#MAPS[@]} $MAP "pak$PAK" $(($MAPSIZE / 1024)) | ||
|
||
ZIPSIZE=0 | ||
if [[ -f "$FSUFFIX$PAK.pk3" ]]; then | ||
ZIPSIZE=$(du -s -b "$FSUFFIX$PAK.pk3" | cut -f1) | ||
fi | ||
ZIPSIZE=$((ZIPSIZE + "$MAPSIZE")) | ||
ZIPOUTPUT=$($ZIPCOMMAND a -tzip "$FSUFFIX$PAK.pk3" "./maps/maps/$MAP/"*) #>/dev/null 2>&1 | ||
|
||
if [[ "$ZIPSIZE" -gt "$ZIPSPLIT" ]]; then | ||
PAK=$((PAK + 1)) | ||
fi | ||
i=$((i+1)) | ||
done |