Skip to content

Commit

Permalink
config-lib: exit on deprecated variable errors
Browse files Browse the repository at this point in the history
  • Loading branch information
mariux committed Feb 8, 2012
1 parent d55dbc6 commit 09d6d5c
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions src/beelib.config.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -90,21 +90,33 @@ function deprecated_mv() {
}

function config_handle_deprecated_config() {

local exit_deprecated=0

if [ ! -z "${DOTBEERC}" ] ; then
print_error "ERROR: deprecated variable DOTBEERC is set."
print_error "ERROR: please use BEE_USER_CONFIG_FILE=${DOTBEERC}"
exit_deprecated=1
fi

if [ ! -z "${BEE_REPOSITORY_BUILDARCHIVEDIR}" ] ; then
print_error "ERROR: deprecated variable BEE_REPOSITORY_BUILDARCHIVEDIR is set."
print_error "ERROR: please use BEE_BUILDARCHIVEDIR=${BEE_REPOSITORY_BUILDARCHIVEDIR}"
exit_deprecated=1
fi

if [ ${exit_deprecated} == 1 ] ; then
print_error "ERROR: please fix depracted variable errors before continuing."
exit 1
fi

deprecated_mv "DOTBEERC" "${HOME}/.beerc" "${XDG_CONFIG_HOME}/bee/beerc"
deprecated_mv "BEE_REPOSITORY_PREFIX" "${XDG_DATA_HOME}/beeroot" "${BEE_REPOSITORY_PREFIX}"
deprecated_mv "BEE_METADIR" "${XDG_DATA_HOME}/beemeta" "${BEE_METADIR}"
deprecated_mv "BEE_REPOSITORY_BEEDIR" "${BEE_REPOSITORY_PREFIX}/bees" "${BEE_REPOSITORY_BEEDIR}"
deprecated_mv "BEE_REPOSITORY_PKGDIR" "${BEE_REPOSITORY_PREFIX}/pkgs" "${BEE_REPOSITORY_PKGDIR}"
deprecated_mv "BEE_DOWNLOADDIR" "${BEE_REPOSITORY_PREFIX}/downloads" "${BEE_DOWNLOADDIR}"
deprecated_mv "BEE_TMP_BUILDROOT" "${BEE_TMP_TMPDIR}/beeroot-${USER}" "${BEE_TMP_BUILDROOT}"

if [ ! -z "${BEE_REPOSITORY_BUILDARCHIVEDIR}" ] ; then
print_error "WARNING: ignored deprecated variable BEE_REPOSITORY_BUILDARCHIVEDIR please use BEE_BUILDARCHIVEDIR=${BEE_REPOSITORY_BUILDARCHIVEDIR}"
fi

if [ ! -z "${DOTBEERC}" ] ; then
print_error "WARNING: ignored deprecated variable DOTBEERC please use BEE_USER_CONFIG_FILE=${DOTBEERC}"
fi
}

# load config: (bee/beerc)
Expand Down

0 comments on commit 09d6d5c

Please sign in to comment.