#!/bin/bash

#This will only install the application and its own libraries.  It does not check for missing dependencies.
#Ubuntu and Mint should be fine. Other out-of-the-box distros may require you to install gtk+3, libunwind and/or libwebgitgtk.

#If you prefer another location to /opt, edit this file.  If you do, also edit the 'exec' and 'icon' paths in FTPhoto.desktop.
#If you just want to run FTPhoto in your home directory, you don't even need this script. Simply unpack the tarball and run in place.
if mkdir -p /opt/seafortyone
   
then
#Delete the old version because obsolete libraries may not be overwritten.  We don't want detritus.  If this is a new install, this will throw a harmless error.
    rm -r /opt/seafortyone/Demo-FTPhoto-Client
    #since we renamed the demo,delete its old directory
    rm -r /opt/seafortyone/FTPhoto-Demo-Client
    echo "Found/Created target directory"
    
    if tar -zxvf Demo-FTPhoto-Client.tar.gz -C /opt/seafortyone
       
    then
	
	echo "Application successfully installed."
	
#Copy the .desktop file so it is in your Application menu.  Will be in the Graphics category.
	
	if cp FTPhoto.desktop /usr/share/applications/FTPhoto.desktop
	   
	then
	    
	    echo "FTPhoto is now in your Applications menu, under Graphics."
	    echo "Installation completed.  Enjoy!"
	else
	       echo "An error occurred installing the .desktop file. This will happen if the script was not run under sudo."
	fi
	   
     
     else
	echo "An error occurred during installation."
	exit 1
     fi

 else
	 echo "An error occured accessing the target directory. This may happen if you did not run under sudo."
	 exit 1;
 fi
	   
	       

    


 

       

