checkdefs.sh script: hackish support for CON files, only 'include *.con' and

'definesound ... *.(voc|wav|ogg)' commands (missing: 'music', something else?).

git-svn-id: https://svn.eduke32.com/eduke32@2176 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2011-12-12 23:18:00 +00:00
parent 44e29613f1
commit 2f14c6dbed

View file

@ -1,7 +1,7 @@
#!/bin/bash
if [ -z "$1" ]; then
echo 'Usage: checkdefs.sh <some.def> [[<some_dir>] -patch]'
echo 'Usage: checkdefs.sh <some.def> [[<some_dir>] {-patch,-con,-conpatch}]'
exit 1
fi
deffn="$1"
@ -12,14 +12,30 @@ else
thedir="$2"
fi
dopatch=""
docon=""
if [ -n "$3" ]; then
if [ "$3" != "-patch" ]; then
echo 'Usage: checkdefs.sh <some.def> [[<some_dir>] -patch]'
if [ "$3" != "-patch" -a "$3" != "-con" -a "$3" != "-conpatch" ]; then
echo 'Usage: checkdefs.sh <some.def> [[<some_dir>] {-patch,-con,-conpatch}]'
exit 1
fi
if [ "$3" == "-patch" ]; then
dopatch=1
elif [ "$3" == "-con" ]; then
docon=1
else
docon=1
dopatch=1
fi
fi
files=$(grep -E "\".*\..*\"" "$deffn" | sed 's/.*"\(.*\..*\)".*/\1/g')
if [ -z $docon ]; then
# def
files=$(grep -E "\".*\..*\"" "$deffn" | sed 's/.*"\(.*\..*\)".*/\1/g')
else
# con... this is awful
files=$(grep -E -i '(include *.*\.con)|(definesound.*(voc|wav|ogg))' "$deffn" | sed -r 's/.*include[ \t]+([^ \t]+\.[cC][oO][nN]).*/\1/g; s/.*[ \t]([^ \t].+\.([wW][aA][vV]|[vV][oO][cC]|[oO][gG][gG])).*/\1/g')
fi
exfiles=$(find "$thedir" -type f)
@ -32,15 +48,23 @@ for i in $files; do
match=$(echo "$exfiles" | grep -i "^$fn$")
if [ -z "$match" ]; then
echo "$fn"
if [ -z "$docon" ]; then # avoid spamming files not found that are in GRPs...
echo "$fn"
fi
else
echo "$fn --> $match"
sedcmd="$sedcmd;s|\"$i\"|\"${match#$thedir/}\"|g"
if [ -n "$dopatch" ]; then
if [ -z "$docon" ]; then
sedcmd="$sedcmd;s|\"$i\"|\"${match#$thedir/}\"|g"
else
sedcmd="$sedcmd;s|$i|${match#$thedir/}|g"
fi
fi
fi
fi
done
if [ -n "$3" ]; then
if [ -n "$dopatch" ]; then
if [ -n "$sedcmd" ]; then
echo "Patching $deffn"
# echo "$sedcmd"