aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'eclass/alternatives-2.eclass')
-rw-r--r--eclass/alternatives-2.eclass16
1 files changed, 9 insertions, 7 deletions
diff --git a/eclass/alternatives-2.eclass b/eclass/alternatives-2.eclass
index dd16f6aa6..b053de988 100644
--- a/eclass/alternatives-2.eclass
+++ b/eclass/alternatives-2.eclass
@@ -108,16 +108,17 @@ cleanup_old_alternatives_module() {
alternatives-2_pkg_postinst() {
local a alt provider module_version="20090908"
+ local EAUTO="${EROOT%/}/usr/share/eselect/modules/auto"
for a in "${ALTERNATIVES_PROVIDED[@]}"; do
alt="${a%:*}"
provider="${a#*:}"
- if [[ ! -f "${EROOT%/}/usr/share/eselect/modules/auto/${alt}.eselect" \
- || "$(source "${EROOT%/}/usr/share/eselect/modules/auto/${alt}.eselect" &>/dev/null; echo "${VERSION}")" \
+ if [[ ! -f "${EAUTO}/${alt}.eselect" \
+ || "$(source "${EAUTO}/${alt}.eselect" &>/dev/null; echo "${VERSION}")" \
-ne "${module_version}" ]]; then
- if [[ ! -d ${EROOT%/}/usr/share/eselect/modules/auto ]]; then
- install -d "${EROOT%/}"/usr/share/eselect/modules/auto || eerror "Could not create eselect modules dir"
+ if [[ ! -d ${EAUTO} ]]; then
+ install -d "${EAUTO}" || eerror "Could not create eselect modules dir"
fi
- cat > "${EROOT%/}/usr/share/eselect/modules/auto/${alt}.eselect" <<-EOF
+ cat > "${EAUTO}/${alt}.eselect" <<-EOF
# This module was automatically generated by alternatives.eclass
DESCRIPTION="Alternatives for ${alt}"
VERSION="${module_version}"
@@ -139,6 +140,7 @@ alternatives-2_pkg_postinst() {
alternatives-2_pkg_prerm() {
local a alt provider ignore
+ local EAUTO="${EROOT%/}/usr/share/eselect/modules/auto"
[[ -n ${REPLACED_BY_ID} ]] || ignore=" --ignore"
for a in "${ALTERNATIVES_PROVIDED[@]}"; do
alt="${a%:*}"
@@ -149,8 +151,8 @@ alternatives-2_pkg_prerm() {
0) : ;;
2)
einfo "Cleaning up unused alternatives module for ${alt}"
- rm "${EROOT%/}/usr/share/eselect/modules/auto/${alt}.eselect" || \
- eerror rm "${EROOT%/}/usr/share/eselect/modules/auto/${alt}.eselect" failed
+ rm "${EAUTO}/${alt}.eselect" || \
+ eerror rm "${EAUTO}/${alt}.eselect" failed
;;
*)
eerror eselect "${alt}" update "${provider}" returned $?