etc-update: fix logic bug with protected files
authorMike Frysinger <vapier@gentoo.org>
Sun, 11 Mar 2012 19:39:50 +0000 (15:39 -0400)
committerMike Frysinger <vapier@gentoo.org>
Sun, 11 Mar 2012 19:41:42 +0000 (15:41 -0400)
The rewrite introduced a slight bug with protected files.  Fix that,
and rework the code slightly to make it obvious that we want a diff
set of options for files and dirs.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
bin/etc-update

index 644512a96dc3d7dd7b143be81663618b6f49913d..75c6ba1b5e9e29ccf8d2afbed6cde954db4ebde8 100755 (executable)
@@ -75,13 +75,14 @@ scan() {
 
                [[ -w ${path} ]] || die "Need write access to ${path}"
 
-               # Do not traverse hidden directories such as .svn or .git.
-               find_opts=( -name '.*' -type d -prune -o -name '._cfg????_*' )
                if [[ ! -d ${path} ]] ; then
                        [[ ! -f ${path} ]] && continue
                        local my_basename="${path##*/}"
                        path="${path%/*}"
-                       find_opts+=( -maxdepth 1 -name "._cfg????_${my_basename}" )
+                       find_opts=( -maxdepth 1 -name "._cfg????_${my_basename}" )
+               else
+                       # Do not traverse hidden directories such as .svn or .git.
+                       find_opts=( -name '.*' -type d -prune -o -name '._cfg????_*' )
                fi
                find_opts+=( ! -name '.*~' ! -iname '.*.bak' -print )