aboutsummaryrefslogtreecommitdiff
path: root/network/sntpc/git2tarxz.sh
diff options
context:
space:
mode:
authorB. Watson <yalhcru@gmail.com>2022-01-26 15:33:58 -0500
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2022-01-30 08:36:00 +0700
commitd17bca972e018b295b8f887af0c3967ba99d4cf5 (patch)
treeebbe2f9db0d1046ede7433762faed3ba3b892f1d /network/sntpc/git2tarxz.sh
parentb5e76f14590bd2128436521f7c44a1100e6fb02a (diff)
network/sntpc: Added (simple NTP client).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'network/sntpc/git2tarxz.sh')
-rw-r--r--network/sntpc/git2tarxz.sh44
1 files changed, 44 insertions, 0 deletions
diff --git a/network/sntpc/git2tarxz.sh b/network/sntpc/git2tarxz.sh
new file mode 100644
index 000000000000..08bbd6a48998
--- /dev/null
+++ b/network/sntpc/git2tarxz.sh
@@ -0,0 +1,44 @@
+#!/bin/sh
+
+# Create source tarball from git repo, with generated version
+# number.
+
+# Note that this script doesn't need to be run as root. It does
+# need to be able to write to the current directory it's run from.
+
+# Takes one optional argument, which is the commit or tag to create
+# a tarball of. With no arg, HEAD is used.
+
+PRGNAM=sntpc
+CLONE_URL=https://github.com/ghewgill/sntpc
+
+set -e
+
+GITDIR=$( mktemp -dt $PRGNAM.git.XXXXXX )
+rm -rf $GITDIR
+git clone $CLONE_URL $GITDIR
+
+CWD="$( pwd )"
+cd $GITDIR
+
+if [ "$1" != "" ]; then
+ git reset --hard "$1" || exit 1
+fi
+
+GIT_SHA=$( git rev-parse --short HEAD )
+
+DATE=$( git log --date=format:%Y%m%d --format=%cd | head -1 )
+
+VERSION=${DATE}_${GIT_SHA}
+
+rm -rf .git
+find . -name .gitignore -print0 | xargs -0 rm -f
+
+cd "$CWD"
+rm -rf $PRGNAM-$VERSION $PRGNAM-$VERSION.tar.xz
+mv $GITDIR $PRGNAM-$VERSION
+tar cvfJ $PRGNAM-$VERSION.tar.xz $PRGNAM-$VERSION
+
+echo
+echo "Created tarball: $PRGNAM-$VERSION.tar.xz"
+echo "VERSION=$VERSION"