add support to prevent auto-processing for user-special files that match a pattern...
authorMarius Mauch <genone@gentoo.org>
Wed, 19 Jul 2006 11:41:41 +0000 (11:41 -0000)
committerMarius Mauch <genone@gentoo.org>
Wed, 19 Jul 2006 11:41:41 +0000 (11:41 -0000)
svn path=/main/trunk/; revision=3936

bin/etc-update

index d0b7b7b1849d7b6b12be30251f74956a13e3a7e0..340be9eb7e9c13877a0e6d6331cb52c15fc17835 100755 (executable)
@@ -177,6 +177,20 @@ configuration file is followed by a list of possible replacement files."
        done
 }
 
+function user_special() {
+       if [ -r /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
+       else
+               return 1
+       fi
+}
+
 function do_file() {
        echo
        local -i my_input
@@ -259,9 +273,9 @@ function do_cfg() {
        local -i my_input=0
        
        until (( ${my_input} == -1 )) || [ ! -f ${file} ]; do
-               if [ "${OVERWRITE_ALL}" == "yes" ]; then
+               if [[ "${OVERWRITE_ALL}" == "yes" && ! user_special ${ofile} ]]; then
                        my_input=1
-               elif [ "${DELETE_ALL}" == "yes" ]; then
+               elif [[ "${DELETE_ALL}" == "yes" && ! user_special ${ofile} ]]; then
                        my_input=2
                else
                  showdiffcmd=$(echo "${diff_command}" |