Skip to content

Commit

Permalink
config-lib: change handling of defaults of SYSCONFDIR/LOCALSTATEDIR
Browse files Browse the repository at this point in the history
first set SYSCONFDIR/LOCALSTATEDIR to 'DEFAULT' and if this value is still set when
variables are expanded change the value to the preffered defaults:

when PREFIX != /usr{,/local} set to /etc and /var
else set to ${PREFIX}/etc and ${PREFIX}/var
  • Loading branch information
mariux committed Jul 15, 2011
1 parent 40e2953 commit 3f83157
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 11 deletions.
30 changes: 28 additions & 2 deletions src/beelib.config.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ function config_verify_builtin_prefixes() {
: ${BINDIR:='${EPREFIX}/bin'}
: ${SBINDIR:='${EPREFIX}/sbin'}
: ${LIBEXECDIR:='${EPREFIX}/lib/${PKGNAME}'}
: ${SYSCONFDIR:=/etc}
: ${LOCALSTATEDIR:=/var}
: ${SYSCONFDIR:=DEFAULT}
: ${LOCALSTATEDIR:=DEFAULT}
: ${SHAREDSTATEDIR:='${LOCALSTATEDIR}'}
: ${LIBDIR:='${EPREFIX}/lib'}
: ${INCLUDEDIR:='${PREFIX}/include'}
Expand All @@ -155,6 +155,32 @@ function config_verify_builtin_prefixes() {
: ${LOCALEDIR:='${DATAROOTDIR}/locale'}
}

function expand_prefix_variables() {
if [ "${SYSCONFDIR}" = "DEFAULT" ] ; then
SYSCONFDIR="/etc"
if [ "${PREFIX}" != "/usr" -a "${PREFIX}" != "/usr/local" ] ; then
SYSCONFDIR="${PREFIX}${SYSCONFDIR}"
fi
fi

if [ "${LOCALSTATEDIR}" = "DEFAULT" ] ; then
LOCALSTATEDIR="/var"
if [ "${PREFIX}" != "/usr" -a "${PREFIX}" != "/usr/local" ] ; then
LOCALSTATEDIR="${PREFIX}${LOCALSTATEDIR}"
fi
fi

BEE_AUTO_EXCLUDE=""
for var in PREFIX EPREFIX BINDIR SBINDIR LIBEXECDIR SYSCONFDIR \
SHAREDSTATEDIR LOCALSTATEDIR LIBDIR INCLUDEDIR \
DATAROOTDIR DATADIR INFODIR LOCALEDIR MANDIR DOCDIR ; do
eval eval ${var}=\${${var}}
eval 'BEE_AUTO_EXCLUDE="${BEE_AUTO_EXCLUDE} \${${var}}"'
done

eval "BEE_AUTO_EXCLUDE=\"${BEE_AUTO_EXCLUDE}\""
}

function config_init() {
config_init_base_config
config_handle_deprecated_config
Expand Down
10 changes: 1 addition & 9 deletions src/beesh.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -590,15 +590,7 @@ PKGALLPKG=
# since PKGARCH is now known reconstruct PKGALLPKG
: ${PKGALLPKG:=${PKGFULLPKG}.${PKGARCH}}

# expand variables
for var in prefix eprefix bindir sbindir libexecdir sysconfdir \
sharedstatedir localstatedir libdir includedir \
datarootdir datadir infodir localedir mandir docdir ; do
eval eval ${var^^}=\${${var^^}}
eval 'BEE_AUTO_EXCLUDE="${BEE_AUTO_EXCLUDE} \${${var^^}}"'
done

eval "BEE_AUTO_EXCLUDE=\"${BEE_AUTO_EXCLUDE}\""
expand_prefix_variables

###############################################################################

Expand Down

0 comments on commit 3f83157

Please sign in to comment.