newshver #1

  • //
  • guest/
  • sean_nolan/
  • perforce/
  • utils/
  • p4wrapper/
  • newshver
  • View
  • Commits
  • Open Download .zip Download (482 B)
#!/bin/sh

#
#	Compute a new version string for a shell script if the script has
#	been changed since the last time this script was run.
#

[ -x /usr/bin/md5sum ] || exit 0

FILE=$1

old=`grep "^MD5SUM=" $FILE | sed -e 's/.*=//' -e 's/"//g'`
cur=`grep -v "^MD5SUM=" $FILE | md5sum`

if [ "$old" != "$cur" ]; then
ed -s $FILE -- <<EOF
g/^VERSION=/d
g/^MD5SUM=/d
1a
VERSION="`date` <`id -nu`@`hostname`>"
.
w
q
EOF

ed -s $FILE -- <<EOF
1a
MD5SUM="`md5sum <$FILE`"
.
w $FILE
q
EOF
fi
# Change User Description Committed
#1 1985 Sean Nolan my initial branch
//guest/perforce_software/utils/p4wrapper/newshver
#2 797 Rick Richardson Add 'cdiff' command.  By Eric Sybesma.
Install with name 'p5' if /usr/local/bin/p4 already exists.
Don't bother with md5sum on systems that don't have it.
Use -c option on install for BSD.
#1 690 rlo Rick Richardson's "p4wrapper" becomes a public depot utility.
//guest/rick_richardson/perforce/utils/p4wrapper/newshver
#1 665 Rick Richardson Add automatic version stamping.