checkdefs.sh: check first and second args, handle definelevelname.

git-svn-id: https://svn.eduke32.com/eduke32@4009 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2013-08-12 15:18:11 +00:00
parent d095ebf9b2
commit 41793193f5

View file

@ -1,17 +1,32 @@
#!/bin/bash #!/bin/bash
if [ -z "$1" ]; then function usage ()
{
echo 'Usage: checkdefs.sh <some.def> [[<search_path_base_dir>] {-patch,-con,-conpatch}]' echo 'Usage: checkdefs.sh <some.def> [[<search_path_base_dir>] {-patch,-con,-conpatch}]'
exit 1 exit 1
}
if [ -z "$1" ]; then
usage
fi fi
deffn="$1" deffn="$1"
if [ ! -f "$deffn" ]; then
echo "Error: First argument must be a name of an existing DEF or CON file."
usage
fi
if [ -z "$2" ]; then if [ -z "$2" ]; then
thedir=. thedir=.
else else
thedir="$2" thedir="$2"
fi fi
if [ ! -d "$thedir" ]; then
echo "Error: Second argument must be a name of an existing directory."
usage
fi
dopatch="" dopatch=""
docon="" docon=""
if [ -n "$3" ]; then if [ -n "$3" ]; then
@ -34,7 +49,10 @@ if [ -z $docon ]; then
files=$(grep -E "\".*\..*\"" "$deffn" | sed 's/.*"\(.*\..*\)".*/\1/g') files=$(grep -E "\".*\..*\"" "$deffn" | sed 's/.*"\(.*\..*\)".*/\1/g')
else else
# con... this is awful # 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') files=$(grep -E -i '(include *.*\.con)|(definesound.*(voc|wav|ogg))|(definelevelname.*\.map)' "$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;
s/.*[ \t]([^ \t].+\.([mM][aA][pP])).*/\1/g;')
fi fi
exfiles=$(find "$thedir" -type f) exfiles=$(find "$thedir" -type f)