#!/bin/sh # Bash script which is executed in case of an update (if this plugin is already # installed on the system). This script is executed as very last step (*AFTER* # postinstall) and can be for example used to save back or convert saved # userfiles from /tmp back to the system. Use with caution and remember, that # all systems may be different! # # Exit code must be 0 if executed successfull. # Exit code 1 gives a warning but continues installation. # Exit code 2 cancels installation. # # Will be executed as user "loxberry". # # You can use all vars from /etc/environment in this script. # # We add 5 additional arguments when executing this script: # command # # For logging, print to STDOUT. You can use the following tags for showing # different colorized information during plugin installation: # # This was ok!" # This is just for your information." # This is a warning!" # This is an error!" # This is a fail!" # 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 # 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 PTEMPDIR # To use important variables from command line use the following code: ARGV0=$0 # Zero argument is shell command # echo " Command is: $ARGV0" ARGV1=$1 # First argument is temp folder during install # echo " Temporary folder is: $ARGV1" ARGV2=$2 # Second argument is Plugin-Name for scipts etc. # echo " (Short) Name is: $ARGV2" ARGV3=$3 # Third argument is Plugin installation folder # echo " Installation folder is: $ARGV3" ARGV4=$4 # Forth argument is Plugin version # echo " Installation folder is: $ARGV4" ARGV5=$5 # Fifth argument is Base folder of LoxBerry # echo " Base folder is: $ARGV5" echo " Copy back existing config files" cp -v -r /tmp/$ARGV1\_upgrade/config/$ARGV3/* $ARGV5/config/plugins/$ARGV3/ echo " Copy back existing log files" cp -v -r /tmp/$ARGV1\_upgrade/log/$ARGV3/* $ARGV5/log/plugins/$ARGV3/ echo " Remove temporary folders" rm -r /tmp/$ARGV1\_upgrade exit 0