#!/bin/bash
#
#Rockey2 uninstall script
#

echo
echo Uninstalling Rockey2 SDK...
echo

#Check whether the current user is root
if test $(id -ur) != 0; then
	echo
	echo "You should logon as root user!"
	echo
	exit -1
fi

if [ ! -f /usr/local/include/rockey2.h ]; then
	if [ ! -f /usr/local/lib/libRockey2.a ]; then
        if [ ! -f /usr/local/lib/libJRockey2.so ]; then
            if [ ! -f /usr/local/lib/libRockey2.so ]; then
                echo
                echo "The file that this program was about to uninstall doesn't exist already!"
                echo
                exit -1
            fi
        fi
    fi
fi

#Delete Rockey2 libs
rm -f /usr/local/include/rockey2.h
rm -f /usr/local/lib/*Rockey2*

/sbin/ldconfig

echo Uninstall finished!
