mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-14 08:30:58 +00:00
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:
parent
44e29613f1
commit
2f14c6dbed
1 changed files with 31 additions and 7 deletions
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
if [ -z "$1" ]; then
|
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
|
exit 1
|
||||||
fi
|
fi
|
||||||
deffn="$1"
|
deffn="$1"
|
||||||
|
@ -12,14 +12,30 @@ else
|
||||||
thedir="$2"
|
thedir="$2"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
dopatch=""
|
||||||
|
docon=""
|
||||||
if [ -n "$3" ]; then
|
if [ -n "$3" ]; then
|
||||||
if [ "$3" != "-patch" ]; then
|
if [ "$3" != "-patch" -a "$3" != "-con" -a "$3" != "-conpatch" ]; then
|
||||||
echo 'Usage: checkdefs.sh <some.def> [[<some_dir>] -patch]'
|
echo 'Usage: checkdefs.sh <some.def> [[<some_dir>] {-patch,-con,-conpatch}]'
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
if [ "$3" == "-patch" ]; then
|
||||||
|
dopatch=1
|
||||||
|
elif [ "$3" == "-con" ]; then
|
||||||
|
docon=1
|
||||||
|
else
|
||||||
|
docon=1
|
||||||
|
dopatch=1
|
||||||
|
fi
|
||||||
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)
|
exfiles=$(find "$thedir" -type f)
|
||||||
|
|
||||||
|
@ -32,15 +48,23 @@ for i in $files; do
|
||||||
match=$(echo "$exfiles" | grep -i "^$fn$")
|
match=$(echo "$exfiles" | grep -i "^$fn$")
|
||||||
|
|
||||||
if [ -z "$match" ]; then
|
if [ -z "$match" ]; then
|
||||||
|
if [ -z "$docon" ]; then # avoid spamming files not found that are in GRPs...
|
||||||
echo "$fn"
|
echo "$fn"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo "$fn --> $match"
|
echo "$fn --> $match"
|
||||||
|
if [ -n "$dopatch" ]; then
|
||||||
|
if [ -z "$docon" ]; then
|
||||||
sedcmd="$sedcmd;s|\"$i\"|\"${match#$thedir/}\"|g"
|
sedcmd="$sedcmd;s|\"$i\"|\"${match#$thedir/}\"|g"
|
||||||
|
else
|
||||||
|
sedcmd="$sedcmd;s|$i|${match#$thedir/}|g"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ -n "$3" ]; then
|
if [ -n "$dopatch" ]; then
|
||||||
if [ -n "$sedcmd" ]; then
|
if [ -n "$sedcmd" ]; then
|
||||||
echo "Patching $deffn"
|
echo "Patching $deffn"
|
||||||
# echo "$sedcmd"
|
# echo "$sedcmd"
|
||||||
|
|
Loading…
Reference in a new issue