summaryrefslogtreecommitdiffstats
path: root/bin/etc-update
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2006-10-10 02:59:48 +0000
committerZac Medico <zmedico@gentoo.org>2006-10-10 02:59:48 +0000
commit0032c5b936d94930679be50f6311531ec2b8ea85 (patch)
tree51ceb15140fd59a2c74d4ef912aa038571c09a39 /bin/etc-update
parent521f18a8ff54915aff5e2f8c375c657a39b77eed (diff)
downloadportage-0032c5b936d94930679be50f6311531ec2b8ea85.tar.gz
portage-0032c5b936d94930679be50f6311531ec2b8ea85.tar.bz2
portage-0032c5b936d94930679be50f6311531ec2b8ea85.zip
Add $ROOT and $PORTAGE_CONFIGROOT support for etc-update. Thanks to Jonathan Adamczewski <jadamcze@utas.edu.au> for this patch from bug #150370.
svn path=/main/trunk/; revision=4645
Diffstat (limited to 'bin/etc-update')
-rwxr-xr-xbin/etc-update14
1 files changed, 9 insertions, 5 deletions
diff --git a/bin/etc-update b/bin/etc-update
index 6fffc0f38..3c9d87eff 100755
--- a/bin/etc-update
+++ b/bin/etc-update
@@ -21,7 +21,7 @@ function get_config() {
# item. If there's more than one of the same configuration item,
# then allow the last setting to take precedence.
local result
- result=$(cut -d'#' -f1-1 /etc/etc-update.conf | \
+ result=$(cut -d'#' -f1-1 ${PORTAGE_CONFIGROOT}etc/etc-update.conf | \
sed -ne "s/^ *$item *= *\([\"']\{0,1\}\)\(.*\)\1/\2/p" |sed -e '$p;d')
eval echo $result
}
@@ -43,6 +43,7 @@ function scan() {
fi
for path in ${CONFIG_PROTECT} ; do
+ path="${ROOT}${path}"
find_opts="-iname ._cfg????_*"
if [ ! -d "${path}" ]; then
[ ! -f "${path}" ] && continue
@@ -59,6 +60,7 @@ function scan() {
rpath=$(echo "${file/\/\///}" | sed -e "s:/[^/]*$::")
rfile=$(echo "${file/\/\///}" | sed -e "s:^.*/::")
for mpath in ${CONFIG_PROTECT_MASK}; do
+ mpath="${ROOT}${path}"
if [[ "${rpath}" == "${mpath}"* ]]; then
mv ${rpath}/${rfile} ${rpath}/${rfile:10}
break
@@ -187,14 +189,14 @@ configuration file is followed by a list of possible replacement files."
}
function user_special() {
- if [ -r /etc/etc-update.special ]; then
+ if [ -r ${PORTAGE_CONFIGROOT}etc/etc-update.special ]; then
if [ -z "$1" ]; then
echo "ERROR: user_special() called without arguments"
return 1
fi
while read pat; do
echo ${1} | grep "${pat}" > /dev/null && return 0
- done < /etc/etc-update.special
+ done < ${PORTAGE_CONFIGROOT}etc/etc-update.special
fi
return 1
}
@@ -434,10 +436,12 @@ scriptname=$(basename $0)
trap die term
-[ -w /etc ] || die "Need root priviledges for write access to /etc" 1
-eval $(/usr/lib/portage/bin/portageq envvar -v PORTAGE_TMPDIR CONFIG_PROTECT CONFIG_PROTECT_MASK)
+eval $(/usr/lib/portage/bin/portageq envvar -v CONFIG_PROTECT \
+ CONFIG_PROTECT_MASK PORTAGE_CONFIGROOT PORTAGE_TMPDIR ROOT)
export PORTAGE_TMPDIR
+
+[ -w ${PORTAGE_CONFIGROOT}etc ] || die "Need write access to ${PORTAGE_CONFIGROOT}etc" 1
#echo $PORTAGE_TMPDIR
#echo $CONFIG_PROTECT
#echo $CONFIG_PROTECT_MASK