-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild-deb
More file actions
executable file
·89 lines (70 loc) · 1.72 KB
/
build-deb
File metadata and controls
executable file
·89 lines (70 loc) · 1.72 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
#!/bin/bash
read -r -d '' USAGE <<'EOF'
Usage: build-deb [-n project_name]
Example: build-deb
Example: build-deb -n mobnode-testbuild
EOF
NODE_PROJECT=mobboss
RELEASE=
PROJECT_DIR=
while getopts n: opt; do
case $opt in
n)
NODE_PROJECT="$OPTARG"
PROJECT_DIR="$NODE_PROJECT`date +%Y%m%d%H%M`"
;;
\?)
echo "${USAGE}" >&2
exit 1
;;
esac
done
NPM_ENV="client/.env.default"
if [ -e $NPM_ENV ]; then
if ! grep -q REACT_APP_TAG $NPM_ENV; then
echo "REACT_APP_TAG must be in $NPM_ENV" >&2
exit 2
fi
RELEASE=`grep REACT_APP_TAG $NPM_ENV | awk -F "=" '{print $2}' | tr -d '"'`
#RELEASE=`grep REACT_APP_TAG $NPM_ENV | awk -F "=" '{print $2}' | tr -d '"' | awk -F "-" '{print $2}'`
if [ -z "$RELEASE" ]; then
echo "Cannot determine release value from REACT_APP_TAG" >&2
exit 3
fi
else
echo "$NPM_ENV must exist and contain REACT_APP_TAG" >&2
exit 4
fi
echo $RELEASE
mkdir ~/debs
sudo rm -r ~/debs/mobboss
mkdir -p ~/debs/mobboss/etc/systemd/system
echo "[Unit]
Description=
After=network.target nss-lookup.target
[Service]
ExecStart=/usr/bin/npm start
WorkingDirectory=/usr/lib/mobboss
Restart=always
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=mobboss
User=root
[Install]
WantedBy=multi-user.target
" >> ~/debs/mobnode/etc/systemd/system/mobboss.service
mkdir -p ~/debs/mobboss/usr/lib
cd ..
cp -r mobboss ~/debs/mobboss/usr/lib/mobboss
cd ~/debs
mkdir mobboss/DEBIAN
echo "Package: Mobboss
Architecture: all
Maintainer: mobdata
Depends:
Priority: optional
Version: $RELEASE
Description: Mobdata app for monitoring nodes and replication" >> mobboss/DEBIAN/control
sudo chown -R root:root mobboss
sudo dpkg-deb --build mobboss
echo "package built int ~/debs"