#!/bin/bash
#
# control_instserv
#    mount external disk and needed iso images
#
# Copyright (c) 2005-2007 Fabian Herschel, Mainz Germany
# GPL v2
#
online=0
isomount=/media/InstallSrv
isobase=$isomount/iso
is_fstab=/etc/is_fstab

#
# progress gui
#
gui=zenity

call_gui()
{
	$gui $@
}

mount | grep -q $isomount && online=1

case $online in
	0 )
	if [ -n "$DISPLAY" ]; then
		guiopts='--progress --pulsate --title="Mounting file systems"'
		guicall="$gui $guiopts"
		mount_mediasets2 --is_fstab $is_fstab | eval "$guicall"
	else
		mount_mediasets2 --is_fstab $is_fstab
	fi
	# sudo /etc/init.d/apache2 start
		;;
	1 )
	if [ -n "$DISPLAY" ]; then
		guiopts='--progress --pulsate --title="Unmounting file systems"'
		guicall="$gui $guiopts"
		umount_mediasets2 --is_fstab $is_fstab | eval "$guicall"
	else
		umount_mediasets2 --is_fstab $is_fstab
	fi
	# sudo /etc/init.d/apache2 stop
		;;
esac

online=0
mount | grep -q $isomount && online=1
case $online in
	0 )
		icon=gnome-suse.png
		;;
	1 )
		icon=gnome-suse-active.png	
		;;
esac
A=$(cat ~/Desktop/InstServ.desktop)
echo "$A" |  sed -e "s/gnome-suse.*png/$icon/" > ~/Desktop/InstServ.desktop
