-
Notifications
You must be signed in to change notification settings - Fork 12
/
mkdist.sh
executable file
·47 lines (36 loc) · 982 Bytes
/
mkdist.sh
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash -e
# mkdist.sh - create a distributable gopherbot-*.tar.gz file
trap_handler()
{
ERRLINE="$1"
ERRVAL="$2"
echo "line ${ERRLINE} exit status: ${ERRVAL}"
exit $ERRVAL
}
trap 'trap_handler ${LINENO} $?' ERR
usage(){
cat <<EOF
Usage: mkdist.sh
Generate distributable tar.gz file for Linux
EOF
exit 0
}
if [ "$1" = "-h" -o "$1" = "--help" ]
then
usage
fi
eval `go env`
CONTENTS="conf/ jobs/ lib/ licenses/ plugins/ resources/ robot.skel/ helpers/ \
tasks/ AUTHORS.txt changelog.txt LICENSE README.md setuid-nobody.sh gb-*"
ADIR="build-archive"
BUILDOS="linux"
rm -rf "$ADIR/gopherbot"
mkdir -p "$ADIR/gopherbot"
cp -a gopherbot "$ADIR/gopherbot/gopherbot"
cp -a --parents $CONTENTS "$ADIR/gopherbot"
chmod -R a+rX $ADIR
cd $ADIR
echo "Creating gopherbot-$BUILDOS-$GOARCH.tar.gz (from $(pwd))"
tar --owner=0 --group=0 --exclude *.swp --exclude *.pyc --exclude __pycache__ -czf ../gopherbot-$BUILDOS-$GOARCH.tar.gz gopherbot/
cd -
rm -rf "$ADIR"