#!/bin/bash

users=`whoami`			# name of the currunt user
PATHE="`pwd`"			# path of the currunt directory
cd $PATHE
echo "installer path=$PATHE================"
echo "===================="
echo "Extracting Files..."
echo "===================="

dd if=Files.enjay | openssl des3 -d -k tig674 | tar zxf -	
if [ "$?" -ne 0 ];	
then
	echo "Error: Extracting Failed"
	exit
fi

existing=`grep ^sudo /etc/group | grep -w ''$users''`
if [ -n "$existing" ];
then
						
	gksudo "$PATHE"/runme "$users"	
else
	users=`whoami`
	if [ "$users" == "root" ];
	then		
		"$PATHE"/runme "$users"
	export DIALOG='
	<window title="Error" decorated="false" allow-grow="false">
  		<vbox>  
			<pixmap>
                		<input file>/usr/bin/sysman/images/bottom2_image.jpg</input>
  			</pixmap> 
			<text use-markup="true">
				<label>"<b>Error : User '$users' is not in Sudo group.</b>"</label>
			</text> 
			<hbox>
				<button>
					<label>Ok</label>
					<action type="exit">exit 0</action>
				</button>
			</hbox>
			<progressbar visible="false">
   				<input>M=1;while [ $M -lt 100 ]; do sleep 5; M=100;   echo $M;  done</input>
   				<action type="exit">exit 0</action>
  			</progressbar>
  		</vbox>
	</window>'
	gtkdialog --center --program=DIALOG
	fi
fi
