]> git.xonotic.org Git - xonotic/xonotic.git/blobdiff - all
detect not having cksum, and prefer md5sum
[xonotic/xonotic.git] / all
diff --git a/all b/all
index e5260071168ef9e79bd7cf6e8db36a37f9f458a0..5e713f9c3d0164670f499badd7562e3230af5f25 100755 (executable)
--- a/all
+++ b/all
@@ -21,7 +21,7 @@ case "$0" in
                        MINGW*)
                                # Windows hates users. So this script has to copy itself elsewhere first...
                                tname=
-                               cp "$0" ../all.xonotic.sh
+                               cp "$SELF" ../all.xonotic.sh
                                exec ../all.xonotic.sh "$@"
                                ;;
                esac
@@ -33,10 +33,23 @@ msg()
        echo "\e[1m$*\e[m"
 }
 
-self=`cksum "$SELF"`
+checksum()
+{
+       if [ -x /usr/bin/md5sum ]; then
+               /usr/bin/md5sum "$@"
+       elif [ -x /bin/md5sum ]; then
+               /bin/md5sum "$@"
+       elif [ -x /usr/bin/cksum ]; then
+               /usr/bin/cksum "$@"
+       else
+               echo "NOCHECKSUM"
+       fi
+}
+
+self=`checksum "$SELF"`
 checkself()
 {
-       self_new=`cksum "$SELF"`
+       self_new=`checksum "$SELF"`
        if [ x"$self" != x"$self_new" ]; then
                msg "./all has changed."
                if [ -z "$XONOTIC_FORBID_RERUN_ALL" ]; then
@@ -105,7 +118,7 @@ case "$cmd" in
                                                fi
                                                ;;
                                esac
-                               verbose git pull
+                               verbose git pull || true # errors if the branch is not tracking anything
                                cd "$d00"
                                checkself "$SELF" "$@"
                                cd "$d0/$d"