-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·97 lines (63 loc) · 2.5 KB
/
build.sh
File metadata and controls
executable file
·97 lines (63 loc) · 2.5 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#!/bin/bash
set -e
# Set variables
export NPROCS=$(nproc)
export RELEASE="development"
export BUILDVER="$(date +%Y)$(date +%m)$(date +%d)"
export BUILDITERATION=999
export OS=$(lsb_release -sc)
export ARCH=$(dpkg --print-architecture)
export DIST=$(grep ^ID= /etc/*release | awk -F'=' '{ print $2 }')
export FULLBUILDVER="${BUILDVER}.${BUILDITERATION}+${RELEASE}~${OS}"
export VENDOR="Syncwerk GmbH"
export VENDOREMAIL="support@syncwerk.com"
export MAINTAINER="${VENDOR} <${VENDOREMAIL}>"
export DATERFC=$(date --rfc-2822)
export PUBLISHONPUBILCREPO=False
lsb_release -si | grep -qi "debian" && export DEBSTDVER=3.9.8
lsb_release -si | grep -qi "ubuntu" && export DEBSTDVER=3.9.7
function build {
cat <<EOF
Creating syncwerk-server-restapi_${FULLBUILDVER}_${ARCH}.deb
------------------------------------------------------------------------------------------------------
EOF
cat debian/control.template | envsubst | sed 's/\\\$/$/g' > debian/control
cat debian/changelog.template | envsubst > debian/changelog
cat debian/copyright.template | envsubst > debian/copyright
sed -i "s/^SYNCWERK_VERSION.*/SYNCWERK_VERSION = \"${FULLBUILDVER}\"/g" fhs/usr/share/python/syncwerk/restapi/restapi/settings.py
debuild -us -uc
}
function install {
cat <<EOF
Installing ../syncwerk-server-restapi_${FULLBUILDVER}_${ARCH}.deb
------------------------------------------------------------------------------------------------------
EOF
dpkg -i ../syncwerk-server-restapi_${FULLBUILDVER}_${ARCH}.deb
cat <<EOF
Killing web-service process to trigger watchguard restart
------------------------------------------------------------------------------------------------------
EOF
pkill -ef web-service
cat <<EOF
Showing current server.log entries for 10 seconds
------------------------------------------------------------------------------------------------------
EOF
(tail -f /var/log/syncwerk/server.log & PID=$! ; sleep 10 ; kill -9 ${PID})
cat <<EOF
New process IDs of web-service
------------------------------------------------------------------------------------------------------
EOF
pidof web-service
cat <<EOF
Finished, execution time:
------------------------------------------------------------------------------------------------------
EOF
}
# Get options and execute task
while true ; do
case "$1" in
build-stable) time (export RELEASE="stable" ; build) ; echo ; break ;;
build-unstable) time (export RELEASE="unstable" ; build) ; echo ; break ;;
*) time (build ; install) ; echo ; break ;;
esac
done