aboutsummaryrefslogtreecommitdiff
path: root/hooks
diff options
context:
space:
mode:
authorAvatar David Leverton <levertond@googlemail.com> 2007-08-12 15:05:41 +0000
committerAvatar David Leverton <levertond@googlemail.com> 2007-08-12 15:05:41 +0000
commita613b16bb6af396ab612c294e5f8c8874bbac515 (patch)
tree927ce52d03035c0b4bc5c2b450e9ae402906f8f1 /hooks
parentc95bc893846259e3120cc5811533805115401f89 (diff)
downloadpaludis-a613b16bb6af396ab612c294e5f8c8874bbac515.tar.gz
paludis-a613b16bb6af396ab612c294e5f8c8874bbac515.tar.xz
Fix config protect handling for PMS compliance and ${ROOT}!=/.
Diffstat (limited to 'hooks')
-rwxr-xr-xhooks/find_config_updates.hook22
1 files changed, 14 insertions, 8 deletions
diff --git a/hooks/find_config_updates.hook b/hooks/find_config_updates.hook
index 9a7b618b8..cd842e2ee 100755
--- a/hooks/find_config_updates.hook
+++ b/hooks/find_config_updates.hook
@@ -31,21 +31,27 @@ check_for_config_updates()
echo
einfo_unhooked "Searching for configuration files requiring action..."
- dir_count=0
- for dir in /etc ${CONFIG_PROTECT} ; do
- [[ -d "${ROOT%/}/${dir}" ]] || continue
- c=$(find "${ROOT%/}/${dir}" -iname '._cfg????_*' | wc -l )
+ local c dir dirs=""
+ for prot in /etc ${CONFIG_PROTECT} ; do
+ if [[ -d "${ROOT%/}/${prot}" ]]; then
+ dir="${prot}"
+ c=$(find "${ROOT%/}/${dir}" -iname '._cfg????_*' | wc -l )
+ else
+ dir="${prot%/*}"
+ [[ -d "${ROOT%/}/${dir}" ]] || continue
+ c=$(find "${ROOT%/}/${dir}" -maxdepth 1 -iname "._cfg????_${prot##*/}" | wc -l )
+ fi
if [[ ${c} -gt 0 ]] ; then
- einfo_unhooked "Found ${c} files in ${ROOT%%+(/)}/${dir}"
- dir_count=$((dir_count + 1))
+ einfo_unhooked "Found ${c} files in ${ROOT%%+(/)}/${dir##+(/)}"
+ dirs="${dirs:+${dirs}$'\n'}${dir}"
fi
done
- if [[ 0 -eq "${dir_count}" ]] ; then
+ if [[ -z "${dirs}" ]] ; then
einfo_unhooked "No configuration file updates required"
exit 0
else
- ewarn "Found files in ${dir_count} directories"
+ ewarn "Found files in $(sort -u <<<"${dirs}" | wc -l ) directories"
ewarn "Your action is required"
exit 0
fi