mirror of
https://github.com/NaomiAmethyst/dots.git
synced 2025-04-13 09:30:06 +00:00
cleaned up lots of the "extras", refactored a bunch of it into some common functionality
This commit is contained in:
parent
38af1dbac9
commit
802a234628
5 changed files with 85 additions and 55 deletions
76
commonsh/00_helper
Executable file
76
commonsh/00_helper
Executable file
|
@ -0,0 +1,76 @@
|
|||
#! /bin/sh
|
||||
|
||||
concat_path ()
|
||||
{
|
||||
if [ -z "$1" ] ; then
|
||||
echo "Please give me a value to concatinate to the variable!"
|
||||
exit
|
||||
fi
|
||||
|
||||
local addition
|
||||
|
||||
addition=$1
|
||||
|
||||
if [ -d "${addition}" ] ; then
|
||||
if [ -z "${PATH}" ] ; then
|
||||
PATH=${addition}
|
||||
else
|
||||
PATH=${addition}:${PATH}
|
||||
fi
|
||||
|
||||
export PATH
|
||||
fi
|
||||
}
|
||||
|
||||
concat_manpath ()
|
||||
{
|
||||
if [ -z "$1" ] ; then
|
||||
echo "Please give me a value to concatinate to the variable!"
|
||||
exit
|
||||
fi
|
||||
|
||||
local addition
|
||||
|
||||
addition=$1
|
||||
|
||||
if [ -d "${addition}" ] ; then
|
||||
if [ -z "${MANPATH}" ] ; then
|
||||
MANPATH=${addition}
|
||||
else
|
||||
MANPATH=${addition}:${MANPATH}
|
||||
fi
|
||||
|
||||
export MANPATH
|
||||
fi
|
||||
}
|
||||
|
||||
# we don't have a MANPATH? we can find one.
|
||||
if [ -z "${MANPATH}" ] ; then
|
||||
case `uname -s` in
|
||||
SunOS)
|
||||
# some solaris systems have manpath
|
||||
if ( command -v manpath >/dev/null 2>&1 ) ; then
|
||||
MANPATH=`manpath`
|
||||
export MANPATH
|
||||
else
|
||||
concat_manpath "/usr/share/man"
|
||||
fi
|
||||
;;
|
||||
OpenBSD)
|
||||
concat_manpath "/usr/local/man/old"
|
||||
concat_manpath "/usr/gnu/man/old"
|
||||
concat_manpath "/usr/contrib/man/old"
|
||||
concat_manpath "/usr/X11R6/man/old"
|
||||
concat_manpath "/usr/X11/man/old"
|
||||
concat_manpath "/usr/gnu/man"
|
||||
concat_manpath "/usr/contrib/man"
|
||||
concat_manpath "/usr/X11R6/man"
|
||||
concat_manpath "/usr/X11/man"
|
||||
concat_manpath "/usr/share/man"
|
||||
;;
|
||||
Darwin|Linux|FreeBSD)
|
||||
MANPATH=`manpath`
|
||||
export MANPATH
|
||||
;;
|
||||
esac
|
||||
fi
|
|
@ -1,28 +1,7 @@
|
|||
#! /bin/sh
|
||||
|
||||
if [ -d /opt/local/man ] ; then
|
||||
if [ -z "${MANPATH}" ] ; then
|
||||
MANPATH="/opt/local/man":`manpath`
|
||||
else
|
||||
MANPATH="/opt/local/man:${MANPATH}"
|
||||
fi
|
||||
export MANPATH
|
||||
fi
|
||||
concat_manpath "/opt/local/man"
|
||||
concat_path "/opt/local/bin"
|
||||
concat_path "/opt/local/sbin"
|
||||
concat_path "/opt/local/libexec"
|
||||
|
||||
if [ -d /opt/local/bin ] ; then
|
||||
if [ -z "${PATH}" ] ; then
|
||||
PATH="/opt/local/bin"
|
||||
else
|
||||
PATH="/opt/local/bin:${PATH}"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -d /opt/local/sbin ] ; then
|
||||
PATH="/opt/local/sbin:${PATH}"
|
||||
fi
|
||||
|
||||
if [ -d /opt/local/libexec ] ; then
|
||||
PATH="/opt/local/libexec:${PATH}"
|
||||
fi
|
||||
|
||||
export PATH
|
||||
|
|
|
@ -42,7 +42,7 @@ fix_term ()
|
|||
# sorta hacky, but I cannot find a better way to do this :/
|
||||
fix_terminfo_db ()
|
||||
{
|
||||
if [ `command -v infocmp 2>/dev/null` = "$1/bin/infocmp" ] ; then
|
||||
if [ -d "$1" ] && [ `command -v infocmp 2>/dev/null` = "$1/bin/infocmp" ] ; then
|
||||
TERMINFO="$1/share/terminfo"
|
||||
export TERMINFO
|
||||
fi
|
||||
|
|
|
@ -1,11 +1,4 @@
|
|||
#! /bin/sh
|
||||
|
||||
if [ -d "${HOME}/.cabal/bin" ] ; then
|
||||
if [ -z "${PATH}" ] ; then
|
||||
PATH="${HOME}/.cabal/bin"
|
||||
else
|
||||
PATH="${HOME}/.cabal/bin:${PATH}"
|
||||
fi
|
||||
fi
|
||||
concat_path "${HOME}/.cabal/bin"
|
||||
|
||||
export PATH
|
||||
|
|
|
@ -1,24 +1,6 @@
|
|||
#! /bin/sh
|
||||
|
||||
if [ -d /usr/local/git/man ] ; then
|
||||
if [ -z "${MANPATH}" ] ; then
|
||||
MANPATH="/usr/local/git/man":`manpath`
|
||||
else
|
||||
MANPATH="/usr/local/git/man:${MANPATH}"
|
||||
fi
|
||||
export MANPATH
|
||||
fi
|
||||
concat_manpath "/usr/local/git/man"
|
||||
concat_path "/usr/local/git/bin"
|
||||
concat_path "/usr/local/git/libexec/git-core"
|
||||
|
||||
if [ -d /usr/local/git/bin ] ; then
|
||||
if [ -z "${PATH}" ] ; then
|
||||
PATH="/usr/local/git/bin"
|
||||
else
|
||||
PATH="/usr/local/git/bin:${PATH}"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -d /usr/local/git/libexec/git-core ] ; then
|
||||
PATH="/usr/local/git/libexec/git-core:${PATH}"
|
||||
fi
|
||||
|
||||
export PATH
|
||||
|
|
Loading…
Add table
Reference in a new issue