Commit be255d60 authored by TomKellyGenetics's avatar TomKellyGenetics
Browse files

check for root write access

parent 7dd02326
Loading
Loading
Loading
Loading
+21 −11
Original line number Original line Diff line number Diff line
@@ -4,14 +4,16 @@
## check config for Linux
## check config for Linux
if [[ -f /etc/manpath.config ]]
if [[ -f /etc/manpath.config ]]
    then CONFIG="/etc/manpath.config"
    then CONFIG="/etc/manpath.config"
    MANDIR=`grep "^MANDATORY_MANPATH" /etc/manpath.config | tail -n 1 | cut -f4`
fi
fi
## check config for Mac
## check config for Mac
if [[ -f /etc/manpaths ]]
if [[ -f /etc/manpaths ]]
    then CONFIG="/etc/manpaths"
    then CONFIG="/etc/manpaths"
    MANDIR=`tail -n 1 ${CONFIG}`
fi
fi
if [[ ! -z $CONFIG ]]
if [[ -z $CONFIG ]]
    then MANDIR=`tail -n 1 ${CONFIG}`
    then
else if [[ ! -z $MANPATH ]]
    if [[ ! -z $MANPATH ]]
        then
        then
        SHELL_RC=`echo ~/.${0}rc`
        SHELL_RC=`echo ~/.${0}rc`
        echo "export MANPATH=/usr/local/man" >> $SHELL_RC
        echo "export MANPATH=/usr/local/man" >> $SHELL_RC
@@ -19,8 +21,16 @@ else if [[ ! -z $MANPATH ]]
    fi
    fi
fi
fi
#requires root priviledges
#requires root priviledges
if [[ -w ${MANDIR} ]]
    then
    mkdir -p ${MANDIR}/man1
    mkdir -p ${MANDIR}/man1
    cp man/launch_universc.sh man/launch_universc.sh.1
    cp man/launch_universc.sh man/launch_universc.sh.1
    mv man/launch_universc.sh.1 ${MANDIR}/man1/launch_universc.sh.1
    mv man/launch_universc.sh.1 ${MANDIR}/man1/launch_universc.sh.1
    gzip ${MANDIR}/man1/launch_universc.sh.1
    gzip ${MANDIR}/man1/launch_universc.sh.1
else
    echo "Directory ${MANDIR} not writeable"
    echo "Warning: installing manual requires root priviledges"
    echo "  Try running of the following:"
    echo "      sudo bash $( cd -P "$( dirname ${BASH_SOURCE[0]})" >/dev/null 2>&1 && pwd )/INSTALL"
    echo "      sudo make manual"
fi
+23 −12
Original line number Original line Diff line number Diff line
@@ -4,14 +4,16 @@
## check config for Linux
## check config for Linux
if [[ -f /etc/manpath.config ]]
if [[ -f /etc/manpath.config ]]
    then CONFIG="/etc/manpath.config"
    then CONFIG="/etc/manpath.config"
    MANDIR=`grep "^MANDATORY_MANPATH" /etc/manpath.config | tail -n 1 | cut -f4`
fi
fi
## check config for Mac
## check config for Mac
if [[ -f /etc/manpaths ]]
if [[ -f /etc/manpaths ]]
    then CONFIG="/etc/manpaths"
    then CONFIG="/etc/manpaths"
    MANDIR=`tail -n 1 ${CONFIG}`
fi
fi
if [[ ! -z $CONFIG ]]
if [[ -z $CONFIG ]]
    then MANDIR=`tail -n 1 ${CONFIG}`
    then
else if [[ ! -z $MANPATH ]]
    if [[ ! -z $MANPATH ]]
        then
        then
        SHELL_RC=`echo ~/.${0}rc`
        SHELL_RC=`echo ~/.${0}rc`
        echo "export MANPATH=/usr/local/man" >> $SHELL_RC
        echo "export MANPATH=/usr/local/man" >> $SHELL_RC
@@ -22,6 +24,9 @@ if [[ -f man/launch_universc.sh.1 ]]
    then
    then
    rm man/launch_universc.sh.1
    rm man/launch_universc.sh.1
fi
fi
#requires root priviledges
if [[ -w ${MANDIR} ]]
    then
    if [[ -f ${MANDIR}/man1/launch_universc.sh.1 ]]
    if [[ -f ${MANDIR}/man1/launch_universc.sh.1 ]]
    then
    then
        rm ${MANDIR}/man1/launch_universc.sh.1
        rm ${MANDIR}/man1/launch_universc.sh.1
@@ -30,4 +35,10 @@ if [[ -f ${MANDIR}/man1/launch_universc.sh.1.gz ]]
        then
        then
        rm ${MANDIR}/man1/launch_universc.sh.1.gz
        rm ${MANDIR}/man1/launch_universc.sh.1.gz
    fi
    fi
else
    echo "Directory ${MANDIR} not writeable"
    echo "Warning: installing manual requires root priviledges"
    echo "  Try running of the following:"
    echo "      sudo bash $( cd -P "$( dirname ${BASH_SOURCE[0]})" >/dev/null 2>&1 && pwd )/REMOVE"
    echo "      sudo make manual-clean"
fi