updateCS_Icons()
{
	if [ "$_FC_PLATFORM" != "Mac OS X" ]; then
		sudo rm "$KDESKTOP/csstart.desktop" &> /dev/null
		sudo rm "$KDESKTOP/csstop.desktop" &> /dev/null
		sudo rm "$GDESKTOP/csstart.desktop" &> /dev/null
		sudo rm "$GDESKTOP/csstop.desktop" &> /dev/null
		sudo rm "$GDESKTOP/fcstatus.desktop" &> /dev/null
		sudo rm "$GDESKTOP/fctools.desktop" &> /dev/null
		sleep 1
	
		if [ -e "$FCSD_PATH" ]; then
			tar xzf "$CSDESKTOP_TAR" -C "$SERVICE_FOLDER"
		fi
		if [ -e "$CTL_FOLDER/fcsctl" ] ; then
			sudo chmod 770 "$CTL_FOLDER/fcsctl" &> /dev/null
			sudo chown $MY_USER:$MY_GROUP "$CTL_FOLDER/fcsctl" &> /dev/null
		fi
		if [ -d "$SERVICE_FOLDER/desktop" ] ; then	
			sudo chmod -R 770 "$SERVICE_FOLDER/desktop" &> /dev/null
			sudo chown -R $MY_USER:$MY_GROUP "$SERVICE_FOLDER/desktop" &> /dev/null
			if [ -d "$KDESKTOP" ]; then
				if [ -e "$SERVICE_FOLDER/desktop/csstart.desktop" ] ; then
					cp -p "$SERVICE_FOLDER/desktop/csstart.desktop" "$KDESKTOP" &> /dev/null
				fi
				if [ -e "$SERVICE_FOLDER/desktop/csstop.desktop" ] ; then
					cp -p "$SERVICE_FOLDER/desktop/csstop.desktop" "$KDESKTOP" &> /dev/null
				fi
				if [ -e "$SERVICE_FOLDER/desktop/fcstatus.desktop" ] ; then
					cp -p "$SERVICE_FOLDER/desktop/fcstatus.desktop" "$KDESKTOP" &> /dev/null
				fi
			fi
			if [ -d "$GDESKTOP" ]; then
				if [ -e "$SERVICE_FOLDER/desktop/csstart.desktop" ] ; then
					cp -p "$SERVICE_FOLDER/desktop/csstart.desktop" "$GDESKTOP" &> /dev/null
				fi
				if [ -e "$SERVICE_FOLDER/desktop/csstop.desktop" ] ; then
					cp -p "$SERVICE_FOLDER/desktop/csstop.desktop" "$GDESKTOP" &> /dev/null
				fi
				if [ -e "$SERVICE_FOLDER/desktop/fcstatus.desktop" ] ; then
					cp -p "$SERVICE_FOLDER/desktop/fcstatus.desktop" "$GDESKTOP" &> /dev/null
				fi
			fi
		fi
	fi

}

updateIS_Icons()
{
	if [ "$_FC_PLATFORM" != "Mac OS X" ]; then
		sudo rm "$KDESKTOP/isstart.desktop" &> /dev/null
		sudo rm "$KDESKTOP/isstop.desktop" &> /dev/null
		sudo rm "$KDESKTOP/fcstatus.desktop" &> /dev/null
		sudo rm "$GDESKTOP/isstart.desktop" &> /dev/null
		sudo rm "$GDESKTOP/isstop.desktop" &> /dev/null
		sudo rm "$GDESKTOP/fcstatus.desktop" &> /dev/null
		sleep 1
		
		if [ -e "$FCISD_PATH" ]; then
			tar xzf "$ISDESKTOP_TAR" -C "$SERVICE_FOLDER"
		fi
		
		if [ -e "$CTL_FOLDER/fcisctl" ] ; then
			sudo chmod 770 "$CTL_FOLDER/fcisctl" &> /dev/null
			sudo chown $MY_USER:$MY_GROUP "$CTL_FOLDER/fcisctl" &> /dev/null
		fi
		
		if [ -d "$SERVICE_FOLDER/desktop" ] ; then	
			sudo chmod -R 770 "$SERVICE_FOLDER/desktop" &> /dev/null
			sudo chown -R $MY_USER:$MY_GROUP "$SERVICE_FOLDER/desktop" &> /dev/null
			if [ -d "$KDESKTOP" ]; then
				if [ -e "$SERVICE_FOLDER/desktop/isstart.desktop" ] ; then
					cp -p "$SERVICE_FOLDER/desktop/isstart.desktop" "$KDESKTOP" &> /dev/null
				fi
				if [ -e "$SERVICE_FOLDER/desktop/isstop.desktop" ] ; then
					cp -p "$SERVICE_FOLDER/desktop/isstop.desktop" "$KDESKTOP" &> /dev/null
				fi
				if [ -e "$SERVICE_FOLDER/desktop/fcstatus.desktop" ] ; then
					cp -p "$SERVICE_FOLDER/desktop/fcstatus.desktop" "$KDESKTOP" &> /dev/null
				fi
			fi
			if [ -d "$GDESKTOP" ]; then
				if [ -e "$SERVICE_FOLDER/desktop/isstart.desktop" ] ; then
					cp -p "$SERVICE_FOLDER/desktop/isstart.desktop" "$GDESKTOP" &> /dev/null
				fi
				if [ -e "$SERVICE_FOLDER/desktop/isstop.desktop" ] ; then
					cp -p "$SERVICE_FOLDER/desktop/isstop.desktop" "$GDESKTOP" &> /dev/null
				fi
				if [ -e "$SERVICE_FOLDER/desktop/fcstatus.desktop" ] ; then
					cp -p "$SERVICE_FOLDER/desktop/fcstatus.desktop" "$GDESKTOP" &> /dev/null
				fi
			fi
		fi
	fi

}

updateDesktop()
{
	if [ "$_FC_PLATFORM" != "Mac OS X" ]; then
		echo -n "[`$NOW`] Installing or updating desktop shortcut icons ... "
	
			if [ "$PRODUCT_BRAND" != "FirstClass" ]; then
				if [ -e "$MY_FILES/${PRODUCT_BRAND}_csdesk.tar.gz" ]; then
					CSDESKTOP_TAR="$MY_FILES/${PRODUCT_BRAND}_csdesk.tar.gz"
				fi
				if [ -e "$MY_FILES/${PRODUCT_BRAND}_isdesk.tar.gz" ]; then
					ISDESKTOP_TAR="$MY_FILES/${PRODUCT_BRAND}_isdesk.tar.gz"
				fi
			fi
	
		sudo rm "$KDESKTOP/fctools.desktop" &> /dev/null
		sudo rm "$GDESKTOP/fctools.desktop" &> /dev/null
		
		sleep 1
	
		if [ ! -e "$SERVICE_FOLDER" ]; then mkdir -p "$SERVICE_FOLDER"; fi
	
		if [ ! -d "$KICONS16" ]; then
			sudo mkdir -p "$KICONS16"
		fi
		sudo tar xzf "$MY_FILES/icons16.tar.gz" -C "$KICONS16"
		sudo chmod -R a+rX "$KICONS" &> /dev/null
		if [ ! -d "$KICONS" ]; then
			sudo mkdir -p "$KICONS"
		fi
		sudo tar xzf "$MY_FILES/icons32.tar.gz" -C "$KICONS"
		sudo chmod -R a+rX "$GICONS" &> /dev/null
		if [ ! -d "$GICONS" ]; then
			sudo mkdir -p "$GICONS"
		fi
		sudo tar xzf "$MY_FILES/icons32.tar.gz" -C "$GICONS"
		sudo chmod -R a+rX "$GICONS" &> /dev/null
		
		if [ "$INSTALL_CS" -eq "1" ] ; then
			updateCS_Icons
		fi
		
		if [ "$INSTALL_IS" -eq "1" ] ; then
			updateIS_Icons
		fi
		
		sudo rm "$SERVICE_FOLDER/desktop"/*.desktop &> /dev/null
		echo "done."
	fi
}

