File: gitinfo.sh

package info (click to toggle)
nethack 3.6.7-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 21,468 kB
  • sloc: ansic: 266,495; cpp: 13,652; yacc: 2,903; perl: 1,426; lex: 581; sh: 535; xml: 372; awk: 98; makefile: 68; fortran: 51; sed: 11
file content (32 lines) | stat: -rwxr-xr-x 1,173 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/sh
# NetHack 3.6  gitinfo.sh	$NHDT-Date: 1524689450 2018/04/25 20:50:50 $  $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.2 $
# Copyright (c) 2018 by Robert Patrick Rankin
# NetHack may be freely redistributed.  See license for details.

# bring dat/gitinfo.txt up to date; called from Makefile.src

#
# gitinfo.txt is used during development to augment the version number
# (for nethack's 'v' command) with more specific information.  That is not
# necessary when building a released version and it is perfectly OK for
# this script to be skipped or to run but fail to generate dat/gitinfo.txt.
#

# 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 [ $rungit -eq 1 ]; then
  ( cd $prefix; \
    perl -IDEVEL/hooksdir -MNHgithook -e '&NHgithook::nhversioning' \
      2> /dev/null ) \
  || true
fi
exit 0