Add help text for attribute S/R.
[qpwmc.git] / makever.sh
blobb541f1a019ab5f4ebed5462eee875e1e00ecc097
1 #!/bin/sh
2 VERSION="$1"
3 if [ $# -eq 2 -a -f "$2/.git/HEAD" ]; then
4 BRANCH="`cut -d / -f 3 $2/.git/HEAD`"
5 VERSION="$VERSION-`cut -b -7 $2/.git/refs/heads/$BRANCH`"
6 fi
8 cat << EOF > "$2/main.h.in"
9 #ifndef MAIN_H
10 #define MAIN_H
12 #define QPWMC_VERSION "$VERSION"
14 #endif
15 EOF
17 cmp --quiet "$2/main.h.in" "$2/main.h"
18 if [ $? != 0 ]; then
19 mv -f "$2/main.h.in" "$2/main.h"
20 else
21 rm -f "$2/main.h.in"
24 if [ $# -ne 3 ]; then
25 exit 0
28 set -e
29 ROOT="qpwmc-`sed -ne '/VERSION/{s/"//g;p;q}' < main.h | \
30 awk '{print $3}'`"
31 TGZ="$ROOT.tar.bz2"
33 echo "Creating $ROOT"
34 mkdir -p $ROOT
36 echo "Updating ChangeLog ..."
37 git log > $ROOT/ChangeLog
39 echo "Copying git controlled files ..."
40 for f in `git ls-files`; do
41 mkdir -p "$ROOT/`dirname $f`"
42 echo "Copying $f"
43 cp -R $f "$ROOT/$f"
44 done
46 tar jcf "$TGZ" "$ROOT"