WiiFlow_Lite/scripts/svnrev.sh
fledge68 d623770a49 - patched the revision number that somehow got out of sync. think it had something to do with getting r1076 from github.
- changed the way coverloader checks for a matching cover .wfc cache file. coverloader still acts strange sometimes or occasionally causes DSI exception.
2016-04-06 16:43:51 +00:00

44 lines
1.0 KiB
Bash

#!/bin/bash
#
echo svnrev.sh
rev_new_raw=$(svnversion -n . 2>/dev/null | tr '\n' ' ' | tr -d '\r')
[ -n "$rev_new_raw" ] || rev_new_raw=$(SubWCRev . 2>/dev/null | tr '\n' ' ' | tr -d '\r')
if [ "$rev_new_raw" == "exported" ];
then
echo This copy of wiiflow is not under source control
exit
fi
rev_new_raw=$(echo $rev_new_raw | sed 's/[^0-9]*\([0-9]*\)\(.*\)/\1 \2/')
rev_new=0
a=$(echo $rev_new_raw | sed 's/\([0-9]*\).*/\1/')
let "a+=0"
#find max rev
while [ "$a" ]; do
[ "$a" -gt "$rev_new" ] && rev_new=$a
rev_new_raw=$(echo -n $rev_new_raw | sed 's/[0-9]*[^0-9]*\([0-9]*\)\(.*\)/\1 \2/')
a=$(echo $rev_new_raw | sed 's/\([0-9]*\).*/\1/')
done
rev_old=$(cat ./source/svnrev.h 2>/dev/null | tr -d '\n' | sed 's/[^0-9]*\([0-9]*\).*/\1/')
rev_new=`expr $rev_new + 1`
if [ "$rev_new" != "$rev_old" ] || [ ! -f ./source/svnrev.h ]; then
cat <<EOF > ./source/svnrev.h
#define SVN_REV "$rev_new"
EOF
if [ -n "$rev_old" ]; then
echo "Changed Rev $rev_old to $rev_new" >&2
fi
rev_new=`expr $rev_new + 1`
rev_date=`date +%Y%m%d%H%M -u`
fi