-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathpreupgrade.sh
35 lines (29 loc) · 1.13 KB
/
preupgrade.sh
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
#!/bin/bash
# To use important variables from command line use the following code:
COMMAND=$0 # Zero argument is shell command
PTEMPDIR=$1 # First argument is temp folder during install
PSHNAME=$2 # Second argument is Plugin-Name for scipts etc.
PDIR=$3 # Third argument is Plugin installation folder
PVERSION=$4 # Forth argument is Plugin version
#LBHOMEDIR=$5 # Comes from /etc/environment now. Fifth argument is
# Base folder of LoxBerry
PTEMPPATH=$6 # Sixth argument is full temp path during install (see also $1)
# Combine them with /etc/environment
PCGI=$LBPCGI/$PDIR
PHTML=$LBPHTML/$PDIR
PTEMPL=$LBPTEMPL/$PDIR
PDATA=$LBPDATA/$PDIR
PLOG=$LBPLOG/$PDIR # Note! This is stored on a Ramdisk now!
PCONFIG=$LBPCONFIG/$PDIR
PSBIN=$LBPSBIN/$PDIR
PBIN=$LBPBIN/$PDIR
echo "<INFO> Stopping MQTT Gateway service"
pkill mqttgateway.pl
echo "<INFO> Creating temporary folders for upgrading"
mkdir /tmp/$PTEMPDIR\_upgrade
mkdir /tmp/$PTEMPDIR\_upgrade/config
echo "<INFO> Backing up existing config files"
cp -v -r $PCONFIG/ /tmp/$PTEMPDIR\_upgrade/config
cp -v -r $PDATA/ /tmp/$PTEMPDIR\_upgrade/data
# Exit with Status 0
exit 0