#sudo apt-get install gdebi # installation of gdebi
#
#
#if [ $? -ne 0 ]; then
# echo "gdebi installation failed.... dependencies will not be installed without gdebi"
# read -p "Do you wish to continue without gdebi? [Yes/No] " yn
# case $yn in
# [Yy]* ) echo "Continueing without gdebi.....";;
# [Nn]* ) echo "Try to resolve errors and re-run the script.";
# exit;;
# * ) exit;;
# esac
#fi
#
#
#for f in ./wso2-raspi-alarm_1.0_armhf.deb; do
# ## Check if the glob gets expanded to existing files.
# ## If not, f here will be exactly the pattern above
# ## and the exists test will evaluate to false.
# # [ -e "$f" ] && echo "'wso2-raspi-alarm_1.0_armhf.deb' file found and installing" || echo "'wso2-raspi-alarm_1.0_armhf.deb' file does not exist in current path"; exit;
# if [ -e "$f" ]; then
# echo "'wso2-raspi-alarm_1.0_armhf.deb' file found and installing now...."
# else
# echo "'wso2-raspi-alarm_1.0_armhf.deb' file does not exist in current path. \nExiting installation...";
# exit;
# fi
# ## This is all we needed to know, so we can break after the first iteration
# break
#done
#
#echo "Installing the 'wso2-raspi-alarm deb package'"
#sudo gdebi wso2-raspi-alarm_1.0_armhf.deb
#
#if [ $? -ne 0 ]; then
# echo "Installation Failed...."
# exit;
#fi
sudo killall -9 python
for f in ./RaspberryAgent.zip;do
## Check if the glob gets expanded to existing files.
## If not, f here will be exactly the pattern above
## and the exists test will evaluate to false.
# [ -e "$f" ] && echo "'wso2-raspi-alarm_1.0_armhf.deb' file found and installing" || echo "'wso2-raspi-alarm_1.0_armhf.deb' file does not exist in current path"; exit;
if[ -e "$f"];then
echo"'wso2-raspi-alarm_1.0_armhf.deb' file found and installing now...."
echo"Agent files found......"
sudo rm -rf /usr/local/src/RaspberryAgent
sudo unzip RaspberryAgent.zip -d /usr/local/src/
else
echo"'wso2-raspi-alarm_1.0_armhf.deb' file does not exist in current path. \nExiting installation...";
exit;
echo"'RaspberryAgent.zip' file does not exist in current path. \nInstalling without upgrading agent...";
fi
## This is all we needed to know, so we can break after the first iteration
break
done
echo"Installing the 'wso2-raspi-alarm deb package'"
sudo gdebi wso2-raspi-alarm_1.0_armhf.deb
if[$? -ne 0];then
echo"Installation Failed...."
exit;
for f in /usr/local/src/RaspberryAgent/rc.local;do
## Check if the glob gets expanded to existing files.
## If not, f here will be exactly the pattern above
## This is all we needed to know, so we can break after the first iteration
break
done
for f in ./deviceConfigs.cfg;do
## Check if the glob gets expanded to existing files.
## If not, f here will be exactly the pattern above
## and the exists test will evaluate to false.
# [ -e "$f" ] && echo "'wso2-raspi-alarm_1.0_armhf.deb' file found and installing" || echo "'wso2-raspi-alarm_1.0_armhf.deb' file does not exist in current path"; exit;
if[ -e "$f"];then
echo"Configuration file found......"
else
@ -87,6 +118,9 @@ for f in ./deviceConfigs.cfg; do
break
done
echo"Altering Configuration file"
sed -i 's|[/,]||g' deviceConfigs.cfg
echo"Copying configurations file to /usr/local/src/RaspberryAgent"