-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall-local.sh
More file actions
executable file
·57 lines (42 loc) · 1.17 KB
/
install-local.sh
File metadata and controls
executable file
·57 lines (42 loc) · 1.17 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
#!/bin/bash
set -e
# Check if running as root
if [ "$EUID" -ne 0 ]; then
echo "This script must be run as root"
exit 1
fi
INSTALL_DIR=/opt/DWE_OS_2
SCRIPT_RUN_DIR=$PWD
tar -xvzf release.tar.gz
if [ -d "$INSTALL_DIR" ]; then
echo "$INSTALL_DIR exists, updating files."
rm -rf $INSTALL_DIR
fi
mkdir -p ${INSTALL_DIR}
cp -r release/* ${INSTALL_DIR}
cd ${INSTALL_DIR}
# Comment the next two lines and uncomment the one after if you are developing locally and already have an install
if [ "$1" != "--local" ]; then
sh install_requirements.sh &&
sh create_venv.sh
else
cp -r $SCRIPT_RUN_DIR/.venv $INSTALL_DIR
fi
# check if the service is already running, and stop it if necessary
if systemctl is-active --quiet dwe_os_2; then
echo "Stopping currently running dwe_os_2 service..."
systemctl stop dwe_os_2
fi
# copy and enable service
cp ${INSTALL_DIR}/service/* /etc/systemd/system/
systemctl enable dwe_os_2
systemctl start dwe_os_2
# cleanup
cd $SCRIPT_RUN_DIR
rm -rf release
rm release.tar.gz
if [ "$VERSION" == "latest" ]; then
echo "Successfully installed DWE_OS 2 (latest version)"
else
echo "Successfully installed DWE_OS 2 ($VERSION)"
fi