~ chicken-core (chicken-5) /identify.sh
Trap1#!/bin/sh -e2#3# identify.sh - check for .git directory and obtain checked out revision and branch4#5# usage: identify.sh SOURCEDIR678# make sure file exists anyway, since branchname is a special case9if test \! -f "buildbranch"; then10 touch buildbranch11fi1213rev0=`cat buildid || echo ""`14branchname0=`cat buildbranch || echo ""`15buildtime=`date +%Y-%m-%d`16host=`hostname`17usys=`uname`1819if test -d "$1/.git"; then20 rev=`GIT_DIR="$1/.git" git rev-parse --short HEAD 2>/dev/null`21 branchname=`GIT_DIR="$1/.git" git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'`22elif test -d "$1/manual-html"; then23 # Assume this is a snapshot or release build; don't touch24 # identifying files to avoid a rebuild which needs chicken25 exit26else27 branchname=${branchname:-"custom"}28fi2930case "${branchname}" in31 "") branchname="";;32 "(no branch)") branchname="";;33 "master") branchname="";;34 "release") branchname="";;35esac36if test "x${rev0}" \!= "x${rev}"; then37 echo ${rev} >buildid38fi39if test "x${branchname0}" \!= "x${branchname}"; then40 echo ${branchname} >buildbranch41fi