diff --git a/polymer/eduke32/build/src/util/checkdefs.sh b/polymer/eduke32/build/src/util/checkdefs.sh index a6d9fc416..eb4490244 100755 --- a/polymer/eduke32/build/src/util/checkdefs.sh +++ b/polymer/eduke32/build/src/util/checkdefs.sh @@ -1,7 +1,7 @@ #!/bin/bash if [ -z "$1" ]; then - echo 'Usage: checkdefs.sh [[] -patch]' + echo 'Usage: checkdefs.sh [[] {-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 [[] -patch]' + if [ "$3" != "-patch" -a "$3" != "-con" -a "$3" != "-conpatch" ]; then + echo 'Usage: checkdefs.sh [[] {-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"