#!/bin/sh

releaseversion=22775
plugin_short="tobayer01"
plugin_type="swapskin"
plugin_target="/var/swap/titanskins"

plugin_dir="$plugin_target/$plugin_short"
plugin="$plugin_short $plugin_type"

imageversion=`cat /etc/version | cut -d "_" -f2 | sed 's/M//'`;


### FUNCTIONS ###

RES_COL=60									# column number to place the status message
MOVE_TO_COL="echo -en \\033[${RES_COL}G"	# command to move to the configured column number

echo_success() {							# function to print the SUCCESS status
	$MOVE_TO_COL; echo -n "[  OK  ]"; echo
}

echo_failure() {
	$MOVE_TO_COL; echo -n "[FAILED]"; echo	# function to print the FAILED status message
}



### MAIN ###

sync
SPACE=`getfreespace $plugin_target`
FREE=`expr $SPACE - 100`
echo
echo "New free space: $FREE kB"


if [ "$imageversion" -gt "$releaseversion" ]; then
	echo "Successfully installed $plugin (non-release version)."
	# ==> rm skin_release.xml
	rm $plugin_dir/skin_release.xml
else
	echo "Successfully installed $plugin (release version)."
	# ==> mv skin_release.xml skin.xml"
	mv $plugin_dir/skin_release.xml $plugin_dir/skin.xml
fi

exit 0
