raidiator-4.2-to-os-6/install.sh
2022-07-25 20:10:41 +00:00

49 lines
1.1 KiB
Bash

#!/bin/bash
ADDON_HOME=/etc/frontview/addons
bye() {
. /frontview/bin/functions
cd /
rm -rf $orig_dir
echo -n ": $1 "
log_status "$1" 1
exit 1
}
orig_dir=`pwd`
name=`awk -F'!!' '{ print $1 }' addons.conf`
friendly_name=`awk -F'!!' '{ print $2 }' $orig_dir/addons.conf`
stop=`awk -F'!!' '{ print $5 }' addons.conf`
run=`awk -F'!!' '{ print $4 }' addons.conf`
version=`awk -F'!!' '{ print $3 }' addons.conf`
if grep -q ${name} $ADDON_HOME/addons.conf; then
orig_vers=`awk -F'!!' '/PREPR4TOR6/ { print $3 }' $ADDON_HOME/addons.conf | cut -f1 -d'.'`
fi
[ -z "$name" ] && bye "ERROR: No addon name!"
# Remove old versions of our addon
if [ -f "$ADDON_HOME/${name}.remove" ]; then
sh $ADDON_HOME/${name}.remove -upgrade &>/dev/null
fi
# Extract program files
cd / || bye "ERROR: Could not change working directory."
tar xfz $orig_dir/files.tgz || bye "ERROR: Could not extract files properly."
########### Addon specific action go here ###########
chmod 777 /frontview/bin/fv_upgrade.sh
chattr +i /frontview/bin/fv_upgrade.sh
######################################################
# Remove the installation files
cd /
rm -rf $orig_dir
exit 0