#!/bin/bash
#
# @(#) Copyright 1994-2022 Pincoder Diagnostics Inc.
#

TMP=/tmp/tmp.revupgrade.$$
rm -f $TMP.*

EXIT() {
	trap "" 0 1 2 15
	rm -f $TMP.*
}
trap EXIT 0 1 2 15

echo
echo "[32mDownloading reversion-client.deb[0m"
wget -O /tmp/reversion-client.deb "https://pub.reversion.ca/Reversion/reversion-client.deb" > $TMP.log 2>&1
if [ $? -ne 0 ]; then
	cat $TMP.log
	echo "[31m** Download failed[0m"
	echo
	exit 1
fi

echo "[32mInstalling reversion-client.deb[0m"
dpkg -i /tmp/reversion-client.deb > $TMP.log 2>&1
if [ $? -ne 0 ]; then
	cat $TMP.log
	echo "[31m** Installation failed[0m"
	echo
	exit 1
fi

echo "[32mInstallation successful[0m"
echo

exit 0
