    installerlog='/var/log/sut/sut_installer.log'
    if [ "$1" = "remove" ] || [ "$1" = "purge" ]; then
	    echo $(date) "SUT is uninstalling" >> $installerlog;

        #remove aes key files if it exists
        rm -f /opt/sut/bin/sut_aes >> $installerlog 2>&1 ;
        rm -f /opt/sut/bin/ilorest.lock >> $installerlog 2>&1 ;
        rm -f /opt/sut/ondemand.lock >> $installerlog 2>&1 ;
        rm -f /opt/sut/config/backup_cfg.dat >> $installerlog 2>&1 ;
        #remove DB folder if it exists
        rm -rf /opt/sut/6_5_0_0 >> $installerlog  2>&1 ;

	    #Remove remaining empty directories since rpm removes only the installed files
	    find /opt/sut/ -type d -empty -delete

	    #Remove staging directory on uninstallation of rpm

	    if [ -d /var/tmp/sut/stagingdirectory ];
	    then
		    rm -rf /var/tmp/sut/stagingdirectory >> $installerlog  2>&1;
		    if [ $? = 0 ];
		    then
			    echo $(date) "Staging Directory is removed successfully" >> $installerlog;
		    else
			    echo $(date) "Staging Directory removal failed" >> $installerlog;
		    fi;
	    fi
	    #Checking if sut link exists and remove the link

	    rm -f /usr/sbin/sut >> $installerlog  2>&1
		if [ $? = 0 ];
		then
			echo $(date) "SUT Symbolic link is removed successfully" >> $installerlog;
		else
			echo $(date) "SUT symbolic link clean up is failed" >> $installerlog;
		fi


	    #removing ilorest folder (debranded) if it exists
	    if [ -d /opt/sut/rest ];
	    then
		    rm -rf /opt/sut/rest >> $installerlog  2>&1:
		    if [ $? = 0 ];
		    then
		    	echo $(date) "rest Directory is removed successfully" >> $installerlog;
		    else
			    echo $(date) "rest Directory removal failed" >> $installerlog;
		    fi
	    fi
	    if [ -d /usr/local/sut/sut_cfg_bkp.dat ];
	    then
		    rm -rf /usr/local/sut/sut_cfg_bkp.dat >> $installerlog  2>&1;
		    if [ $? = 0 ];
		    then
		    	echo $(date) "sut_cfg_bkp.dat is removed successfully" >> $installerlog;
		    else
			    echo $(date) "sut_cfg_bkp.dat removal failed" >> $installerlog;
		    fi;
	    fi
	    #remove the GPG key file
	    #rm -rf /opt/sut/.GPGimportkeys
    fi