Commit b4fecd23 authored by TomKellyGenetics's avatar TomKellyGenetics
Browse files

check directories

parent e04d265a
Loading
Loading
Loading
Loading
+8 −11
Original line number Diff line number Diff line
@@ -8,6 +8,14 @@ if [[ -z $prefix ]]; then prefix="/usr/local/share"; fi
if [[ $1 == "--prefix" ]]
     then
     prefix=$2
     if [[ ! -d $prefix ]]
        then
        echo "--prefix $prefix must be a directory"
    fi
    if [[ ! -w $prefix ]]
        then
        echo "--prefix $prefix must be a writeable"
    fi
fi

if [[ $prefix=="." ]]
@@ -22,17 +30,6 @@ if [[ "universc" == $(echo $prefix | rev | cut -d'/' -f1 | rev) ]]
    INSTALLDIR=${prefix}/universc
fi

if [[ ! -d $prefix ]]
    then
        echo "--prefix $prefix must be a directory"
        exit 1
fi
if [[ ! -w $prefix ]]
    then
    echo "--prefix $prefix must be a writeable"
    exit 1
fi

if [[ ! -w $prefix ]]
    then
    echo "$prefix must be a writeable directory"
+18 −0
Original line number Diff line number Diff line
@@ -35,10 +35,28 @@ else
    #requires full path
    prefix=$(readlink -f $prefix)
    current_version=$(cat ${prefix}/.version)
    if [[ ! -d $prefix ]]
        then
        echo "--prefix $prefix must be a directory"
    fi
    if [[ ! -w $prefix ]]
        then
        echo "--prefix $prefix must be a writeable"
    fi
fi

echo "uninstalling universc ${current_version} from: $prefix"

if [[ ! -w $prefix ]]
    then
    echo "$prefix must be a writeable directory"
    echo "try running:"
    echo "    sudo bash $( cd -P "$( dirname ${BASH_SOURCE[0]})" >/dev/null 2>&1 && pwd )/REMOVE"
    echo "    sudo make remove"
    exit 1
fi


if [[ $prefix == $(pwd) ]] || [[ $prefix == "." ]] || [ $prefix == "../"* ]] || [[ $prefix == "./"* ]]
   then
   echo "Current directory not removed"