libiir/scripts/paths

65 lines
1.4 KiB
Bash

# libiir/scripts/paths
#
# Copyright: ©2010, Laurence Withers.
# Author: Laurence Withers <l@lwithers.me.uk>
# License: GPLv3
#
# Default path setup. Not meant for editing; use environment variables
# to override values if needed.
#
MY_PREFIX="${PREFIX}"
[ "${MY_PREFIX}" == "/" ] && MY_PREFIX=""
[ -z "${BINDIR}" ] && BINDIR="${PREFIX}/bin"
[ -z "${SBINDIR}" ] && SBINDIR="${PREFIX}/sbin"
[ -z "${LIBDIR}" ] && LIBDIR="${PREFIX}/lib"
if [ -z "${INCLUDEDIR}" ]
then
case "${PREFIX}" in
/) INCLUDEDIR="/usr/include" ;;
*) INCLUDEDIR="${PREFIX}/include" ;;
esac
fi
if [ -z "${CONFIGDIR}" ]
then
case "${PREFIX}" in
/ | /usr) CONFIGDIR="/etc" ;;
/opt*) CONFIGDIR="/etc${PREFIX}" ;;
*) CONFIGDIR="${PREFIX}/etc" ;;
esac
fi
if [ -z "${VARDIR}" ]
then
case "${PREFIX}" in
/ | /usr | /usr/local) VARDIR="/var" ;;
/opt*) VARDIR="/var${PREFIX}" ;;
*) VARDIR="${PREFIX}/var" ;;
esac
fi
if [ -z "${SHAREDIR}" ]
then
case "${PREFIX}" in
/) SHAREDIR="/usr/share" ;;
*) SHAREDIR="${PREFIX}/share" ;;
esac
fi
[ -z "${DOCSDIR}" ] && DOCSDIR="${SHAREDIR}/doc"
if [ -z "${SRVDIR}" ]
then
case "${PREFIX}" in
/ | /usr | /usr/local) SRVDIR="/srv" ;;
*) SRVDIR="${PREFIX}/srv" ;;
esac
fi
[ -z "${WEBDIR}" ] && WEBDIR="${SRVDIR}/http"
[ -z "${CGIDIR}" ] && CGIDIR="${WEBDIR}/cgi-bin"
# kate: replace-trailing-space-save true; space-indent true; tab-width 4;
# vim: syntax=sh:expandtab:ts=4:sw=4