File: mktarball.sh

package info (click to toggle)
hibernate 2.0+15+g88d54a8-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, jessie, jessie-kfreebsd, sid, stretch, wheezy
  • size: 740 kB
  • ctags: 114
  • sloc: sh: 1,223; makefile: 17
file content (32 lines) | stat: -rwxr-xr-x 608 bytes parent folder | download | duplicates (3)
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
set -eu

VERSION="$(sed -rne 's,^VERSION="(.+)",\1,p' hibernate.sh)"
PREFIX="hibernate-script-"

TARGETDIR="../$PREFIX$VERSION"
TARBALL="../$PREFIX$VERSION.tar.gz"

if [ -f "$TARBALL" ]; then
  echo "E: $TARBALL already exists." >&2
  exit 1
fi

if [ -d .git ] && [ -f .git/config ]; then
  git archive --prefix=$PREFIX$VERSION/ HEAD | gzip -9 > $TARBALL
  exit 0
fi

if [ -d "$TARGETDIR" ]; then
  echo "E: $TARGETDIR already exists." >&2
  exit 1
fi

svn export --quiet . "$TARGETDIR"
tar -czC .. -f "$TARBALL" "${TARGETDIR#../}"

echo "tarball created: $TARBALL" >&2

rm -r "$TARGETDIR"

exit 0