]> granicus.if.org Git - nethack/commitdiff
sys/unix/gitinfo.sh
authorPatR <rankin@nethack.org>
Fri, 16 Mar 2018 07:39:05 +0000 (00:39 -0700)
committerPatR <rankin@nethack.org>
Fri, 16 Mar 2018 07:39:05 +0000 (00:39 -0700)
Avoid '[[ ... ]]' to cater to a more rudimentary shell.

sys/unix/gitinfo.sh

index 5cdb347152e965489a83c1c29573b677974282ca..770943e25ce3e6a971caf91c72b73f0ea57a0501 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# NetHack 3.6  gitinfo.sh      $NHDT-Date: 1520201830 2018/03/04 22:17:10 $  $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.0 $
+# NetHack 3.6  gitinfo.sh      $NHDT-Date: 1521185933 2018/03/16 07:38:53 $  $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.1 $
 
 # bring dat/gitinfo.txt up to date; called from Makefile.src
 
 # this script to be skipped or to run but fail to generate dat/gitinfo.txt.
 #
 
-always=0
-if [[ $1 -eq 1 || $1 == "force" || $1 == "always" ]]; then always=1; fi
-
 # try to figure out where we are: top, one level down (expected), or sys/unix
 prefix=.
 if [ -f ../sys/unix/gitinfo.sh ]; then prefix=..; fi
 if [ -f ../../sys/unix/gitinfo.sh ]; then prefix=../..; fi
 
+rungit=0
+if [ $1 -eq 1 ]; then rungit=1; fi
+if [ $1 = "force" ]; then rungit=1; fi
+if [ ! -f $prefix/dat/gitinfo.txt ]; then rungit=1; fi
+
 # try to run a perl script which is part of nethack's git repository
-if [[ $always -eq 1 || ! -f $prefix/dat/gitinfo.txt ]]; then
+if [ $rungit -eq 1 ]; then
   ( cd $prefix; \
     perl -IDEVEL/hooksdir -MNHgithook -e '&NHgithook::nhversioning' \
       2> /dev/null ) \