www.nico.schottelius.org/software/cinit/browse_source/cinit-0.3pre19/bin/cinit-conf.get-confdir

50 lines
1.6 KiB
Bash
Executable File

#!/bin/sh
#
# 2005-2009 Nico Schottelius (nico-cinit-conf at schottelius.org)
#
# This file is part of cinit-conf.
#
# cinit-conf is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# cinit-conf is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with cinit-conf. If not, see <http://www.gnu.org/licenses/>.
#
# cinit: read configuration into variables
# Date: 2005-05-24 (Last Changed: 2005-08-08)
#
set -x
################################################################################
# standard vars stolen from cconf
__pwd="$(pwd -P)"
__mydir="${0%/*}"; __abs_mydir="$(cd "$__mydir" && pwd -P)"
__myname=${0##*/}; __abs_myname="$__abs_mydir/$__myname"
# try environment first
if [ "$CINIT_CONF_CONF_DIR" ]; then
CONFDIR="$CINIT_CONF_CONF_DIR"
elif [ -d "${__abs_mydir}/../conf/" ]; then
CONFDIR="${__abs_mydir}/../conf/"
elif [ -d "${HOME}/.cinit-conf/" ]; then
CONFDIR="${HOME}/.cinit-conf/"
elif [ -d "/etc/cinit/build-conf/" ]; then
CONFDIR="/etc/cinit/build-conf/"
else
echo 'Did not find cinit-conf configuration!' >&2
echo "Please set the variable CINIT_CONF_CONF_DIR" >&2
exit 1
fi
CONFDIR=$(cd "${CONFDIR}" && pwd -P)
echo $CONFDIR