Skip to content

Commit

Permalink
Updated Pre- and Post-Installation routines
Browse files Browse the repository at this point in the history
  • Loading branch information
christianTF committed Nov 15, 2018
1 parent 821c8ce commit f607b1a
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 29 deletions.
7 changes: 5 additions & 2 deletions postinstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,16 @@ PBIN=$LBPBIN/$PDIR


echo "<INFO> Copy back existing config files"
cp -f -r /tmp/$ARGV1\_upgrade/config/$ARGV3/* $ARGV5/config/plugins/$ARGV3/
cp -f -r /tmp/$PTEMPDIR\_upgrade/config/$PDIR/* $LBHOMEDIR/config/plugins/$PDIR/

echo "<INFO> Remove temporary folders"
rm -f -r /tmp/$ARGV1\_upgrade
rm -f -r /tmp/$PTEMPDIR\_upgrade

echo "<INFO> Updating configuration"
perl $PBIN/updateconfig.pl

echo "<INFO> Starting MQTT Gateway service"
$PBIN/mqttgateway.pl

# Exit with Status 0
exit 0
4 changes: 3 additions & 1 deletion postroot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@
# Will be executed as user "root".

# Enable auto-start of Mosquitto service
/etc/init.d/mosquitto start
systemctl enable mosquitto
systemctl start mosquitto

exit 0
50 changes: 24 additions & 26 deletions preupgrade.sh
Original file line number Diff line number Diff line change
@@ -1,36 +1,34 @@
#!/bin/bash

# To use important variables from command line use the following code:
ARGV0=$0 # Zero argument is shell command
# echo "<INFO> Command is: $ARGV0"

ARGV1=$1 # First argument is temp folder during install
# echo "<INFO> Temporary folder is: $ARGV1"

ARGV2=$2 # Second argument is Plugin-Name for scipts etc.
# echo "<INFO> (Short) Name is: $ARGV2"

ARGV3=$3 # Third argument is Plugin installation folder
# echo "<INFO> Installation folder is: $ARGV3"

ARGV4=$4 # Forth argument is Plugin version
# echo "<INFO> Installation folder is: $ARGV4"

ARGV5=$5 # Fifth argument is Base folder of LoxBerry
# echo "<INFO> Base folder is: $ARGV5"

ARGV6=$6 # Full path to temporary installation folder
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/$ARGV1\_upgrade
mkdir /tmp/$ARGV1\_upgrade/config
# mkdir /tmp/$ARGV1\_upgrade/log
mkdir /tmp/$PTEMPDIR\_upgrade
mkdir /tmp/$PTEMPDIR\_upgrade/config

echo "<INFO> Backing up existing config files"
cp -v -r $ARGV5/config/plugins/$ARGV3/ /tmp/$ARGV1\_upgrade/config

# echo "<INFO> Backing up existing log files"
# cp -v -r $ARGV5/log/plugins/$ARGV3/ /tmp/$ARGV1\_upgrade/log
cp -v -r $PCONFIG/ /tmp/$PTEMPDIR\_upgrade/config

# Exit with Status 0
exit 0

0 comments on commit f607b1a

Please sign in to comment.