Skip to content

Commit 8758dda

Browse files
committed
Add tct installer build script
1 parent 07d5605 commit 8758dda

File tree

2 files changed

+66
-0
lines changed

2 files changed

+66
-0
lines changed

installer/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/tct-installer-*

installer/build.sh

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
#!/bin/bash
2+
3+
TCT_DIR=..
4+
VERSION=$(sed -n "s/^version = \"\(.*\)\"$/\1/p" $TCT_DIR/build.gradle)
5+
INSTALLER=tct-installer-$VERSION.bsx
6+
STAGE_DIR=stage
7+
PAYLOAD_DIR=payload
8+
9+
# stage new version for deployment
10+
rm -rf $STAGE_DIR
11+
mkdir -p $STAGE_DIR/usr/local/lib
12+
mkdir -p $STAGE_DIR/usr/local/bin
13+
14+
cp -c $TCT_DIR/build/libs/tct-$VERSION.jar $STAGE_DIR/usr/local/lib/tct.jar
15+
cp -c $TCT_DIR/script/tct $STAGE_DIR/usr/local/bin/tct
16+
17+
# tar staged files
18+
rm -rf $PAYLOAD_DIR
19+
mkdir $PAYLOAD_DIR
20+
tar -C $STAGE_DIR -c -f $PAYLOAD_DIR/files.tar usr
21+
22+
# create installer
23+
cat <<END > $PAYLOAD_DIR/installer
24+
echo ""
25+
echo "Installing Third Coast TCT $VERSION"
26+
echo ""
27+
tar xvf ./files.tar -C / --touch
28+
echo ""
29+
END
30+
31+
chmod +x $PAYLOAD_DIR/installer
32+
tar -C $PAYLOAD_DIR --options "gzip:compression-level=9" -c -z -f payload.tgz files.tar installer
33+
34+
# tar and compress payload
35+
cat <<'DECOMPRESS_END' > $INSTALLER
36+
export TMPDIR=`mktemp -d /tmp/selfextract.XXXXXX`
37+
38+
ARCHIVE=`awk '/^__ARCHIVE_BELOW__/ {print NR + 1; exit 0; }' $0`
39+
40+
tail -n+$ARCHIVE $0 | tar xz -C $TMPDIR --touch
41+
42+
CDIR=`pwd`
43+
cd $TMPDIR
44+
./installer
45+
46+
cd $CDIR
47+
rm -rf $TMPDIR
48+
49+
exit 0
50+
51+
__ARCHIVE_BELOW__
52+
DECOMPRESS_END
53+
54+
# make installer
55+
#cat decompress payload.tgz > $INSTALLER
56+
cat payload.tgz >> $INSTALLER
57+
chmod +x $INSTALLER
58+
59+
# clean up
60+
rm payload.tgz
61+
rm -rf $PAYLOAD_DIR
62+
rm -rf $STAGE_DIR
63+
64+
echo "$INSTALLER created"
65+
exit 0

0 commit comments

Comments
 (0)