-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild-deb
More file actions
executable file
·88 lines (69 loc) · 1.73 KB
/
build-deb
File metadata and controls
executable file
·88 lines (69 loc) · 1.73 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
#!/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=mobnode
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/mobnode
mkdir -p ~/debs/mobnode/etc/systemd/system
echo "[Unit]
Description=
After=network.target nss-lookup.target
[Service]
ExecStart=/usr/bin/npm start
WorkingDirectory=/usr/lib/mobnode
Restart=always
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=mobnode
User=root
[Install]
WantedBy=multi-user.target" >> ~/debs/mobnode/etc/systemd/system/mobnode.service
mkdir -p ~/debs/mobnode/usr/lib
cd ..
cp -r mobnode ~/debs/mobnode/usr/lib/mobnode
cd ~/debs
mkdir mobnode/DEBIAN
echo "Package: Mobnode
Architecture: all
Maintainer: mobdata
Depends:
Priority: optional
Version: $RELEASE
Description: Mobdata app for monitoring and adding rules to nodes" >> mobnode/DEBIAN/control
sudo chown -R root:root mobnode
sudo dpkg-deb --build mobnode
echo "package built int ~/debs"