Commit b4f440f6 authored by TomKellyGenetics's avatar TomKellyGenetics
Browse files

automated install and export to PATH

parent 09a42935
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -41,3 +41,5 @@ remove:
	@bash inst/REMOVE

uninstall: remove clean

reinstall: uninstall install
+33 −26
Original line number Diff line number Diff line
#! /bin/sh

#default install location (root)
if [[ -z $prefix ]]; then prefix="/"; fi
if [[ -z $prefix ]]; then prefix="/usr/local/share"; fi
echo "installing to: $prefix"

if [[ $1 == "--prefix" ]]
@@ -28,37 +28,44 @@ if [[ ! -w $prefix ]]
    exit 1
fi

echo prefix=$prefix

exit 0
if [[ -f /etc/manpath.config ]]
    then 
fi
## check config for Mac
if [[ -f /etc/manpaths ]]
    then CONFIG="/etc/manpaths"
    MANDIR=`tail -n 1 ${CONFIG}`
fi
if [[ -z $CONFIG ]]
if [[ -f inst/.installed ]]
    then
    if [[ ! -z $MANPATH ]]
        then
        SHELL_RC=`echo ~/.${0}rc`
        echo "export MANPATH=/usr/local/man" >> $SHELL_RC
        MANDIR=`echo ${MANPATH} | cut -d: -f1`
    fi
    echo "universc is already installed in `cat inst/.installed`"
    echo "run the following to remove it"
    echo "    make remove"
    exit 1
fi
echo $prefix > inst/.installed

echo prefix=$prefix

version=`cat .version`

# create install directory
INSTALLDIR="${prefix}/universc-${version}"
mkdir -p ${prefix}/universc-${version}


#requires root priviledges
if [[ -w ${MANDIR} ]]
if [[ -w ${INSTALLDIR} ]]
    then
    mkdir -p ${MANDIR}/man1
    cp man/launch_universc.sh man/launch_universc.sh.1
    mv man/launch_universc.sh.1 ${MANDIR}/man1/launch_universc.sh.1
    gzip ${MANDIR}/man1/launch_universc.sh.1
    rsync -arutvxz * ${prefix}/universc-${version}
    export PATH=${prefix}/universc-${version}:$PATH
    echo "universc-${version} added to PATH"
    SHELL_RC=`echo ~/.${0}rc`
    echo "export PATH=${prefix}/universc-${version}:$PATH" >> $SHELL_RC
    echo "universc-${version} added to PATH automatically in new $0 shell session"
    echo "run the following to add it to your shell of choice"
    echo "    export PATH=${prefix}/universc-${version}:$PATH >> ~/.bashrc"
    echo "universc-${version} has been installed it can be run as follows"
    echo "    launch_universc.sh"
    launch_universc.sh --version
    launch_universc.sh --help
    which launch_universc.sh
else
    echo "Directory ${MANDIR} not writeable"
    echo "Directory ${INSTALLDIR} 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"
    echo "      sudo make install"
fi
+16 −1
Original line number Diff line number Diff line
#! /bin/sh

#check for existing install
if [[ ! -f inst/.installed ]]
    then
    echo "universc is not installed"
    echo "run the following to install it"
    echo "    make install"
    exit 1
fi
prefix=`cat inst/.installed`
echo "uninstalling from: $prefix"

exit 0

# add manual directory to PATH if not already found
## check config for Linux
if [[ -f /etc/manpath.config ]]
@@ -40,5 +53,7 @@ else
    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"
    echo "      sudo make remove"
fi

rm inst/.installed