summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2006-04-11 09:29:34 +0000
committerZac Medico <zmedico@gentoo.org>2006-04-11 09:29:34 +0000
commit1e68875612c2a00e2c66b186e09485617b57131f (patch)
tree83f9c86199aad95fc3775ab6e7c412465b4bc401
parent4d9a290a8533f57e1adf7d689d5bab044a80347c (diff)
downloadportage-1e68875612c2a00e2c66b186e09485617b57131f.tar.gz
portage-1e68875612c2a00e2c66b186e09485617b57131f.tar.bz2
portage-1e68875612c2a00e2c66b186e09485617b57131f.zip
Make etc-update play nice with symlinks for bug #129515. Thanks to Patrick McLean for the initial patch.
svn path=/main/trunk/; revision=3130
-rwxr-xr-xbin/etc-update7
1 files changed, 6 insertions, 1 deletions
diff --git a/bin/etc-update b/bin/etc-update
index d2946c3a0..234a6bd34 100755
--- a/bin/etc-update
+++ b/bin/etc-update
@@ -40,11 +40,16 @@ function scan() {
exit 1
fi
+ # `readlink -f` is not supported on all systems, so it's necessary to test
+ # for the alternative "realpath" program.
+ local realpath_cmd="$(type -p "realpath")"
+ [ -z "${realpath_cmd}" ] && realpath_cmd="readlink -q -f"
+
for path in ${CONFIG_PROTECT} ; do
[ ! -d ${path} ] && continue
ofile=""
- for file in `find ${path}/ -iname "._cfg????_*" |
+ for file in `find -L ${path}/ -iname "._cfg????_*" -exec ${realpath_cmd} '{}' ';' | uniq |
sed -e "s:\(^.*/\)\(\._cfg[0-9]*_\)\(.*$\):\1\2\3\%\2\%\3:" |
sort -t'%' -k3 -k2 | LANG=POSIX LC_ALL=POSIX cut -f1 -d'%'`; do
rpath=`echo "${file/\/\///}" | sed -e "s:/[^/]*$::"`