freebsd-update

Dan Lukes dan at obluda.cz
Mon Dec 8 13:37:20 CET 2014


On 12/08/14 13:22, Zbyněk Burget:
>> Proste jsem do jeho konfigurace pridal informaci, ktere soubory ja
>> urcite nikdy rucne nemenim a tudiz je i v interaktivnim rezimu ma
>>
>> P.S. Ten seznam souboru u me je:
>> APPROVED_FILES='/etc/rc.d/* /etc/defaults/* /etc/mtree/*
>> /etc/periodic/*/* /etc/security/* /var/named/etc/namedb/named.root
>> /etc/mail/freebsd.* /etc/mail/submit.* /COPYRIGHT /etc/netstart
>> /etc/network.subr /etc/rc.initdiskless /etc/rc.subr /etc/services
>> /etc/gss/mech /etc/rc /etc/pf.os'
>
> To vypada uzitecne - ale to ten mergemaster mas nejak priohnuty, ne?
> Zadnou volbu APPROVED_FILES jsem v koniguraci mergemasteru nezahlidl.

Aha, to mi z textu vypadlo. Ano, ja mam ledacos upraveny aby to slo 
pouzivat lip (s ohledem na to, co od toho potrebuju ja).

Dan



-------------- next part --------------
--- usr.sbin/mergemaster/mergemaster.sh.orig	2014-07-09 16:18:54.000000000 +0200
+++ usr.sbin/mergemaster/mergemaster.sh	2014-07-09 16:19:03.000000000 +0200
@@ -51,6 +51,21 @@
   echo '* The -a option causes mergemaster to run without prompting.'
 }
 
+# Check if $1 match any pattern of $2 ... $n
+gmatch() {
+        local F
+
+        F="$1"
+        shift
+
+        while [ $# -gt 0 ] && ! eval [ \"\${F##$1}\" = \"\" ] ; do
+                shift
+        done
+
+        [ $# -gt 0 ]
+        return $?
+}
+
 # Loop allowing the user to use sdiff to merge files and display the merged
 # file.
 merge_loop () {
@@ -117,6 +132,26 @@
   while [ "${HANDLE_COMPFILE}" = "v" -o "${HANDLE_COMPFILE}" = "V" -o \
     "${HANDLE_COMPFILE}" = "NOT V" ]; do
     if [ -f "${DESTDIR}${COMPFILE#.}" -a -f "${COMPFILE}" ]; then
+      set -f
+      if gmatch "${COMPFILE#.}" $APPROVED_FILES ; then
+	  set +f
+          echo ''
+          echo "  *** ${COMPFILE} upgrade is auto-approved."
+          echo ''
+
+          if mm_install "${COMPFILE}"; then
+            echo "   *** ${COMPFILE} upgraded successfully"
+            echo ''
+            # Make the list print one file per line
+            AUTO_APPROVED_FILES="${AUTO_APPROVED_FILES}      ${DESTDIR}${COMPFILE#.}
+"
+          else
+            echo "   *** Problem upgrading ${COMPFILE}, it will remain to merge by hand"
+          fi
+          return
+      else
+          set +f
+      fi
       if [ -n "${AUTO_UPGRADE}" -a -n "${CHANGED}" ]; then
         case "${CHANGED}" in
         *:${DESTDIR}${COMPFILE#.}:*) ;;		# File has been modified
@@ -1209,6 +1244,28 @@
   ;;
 esac
 
+case "${AUTO_APPROVED_FILES}" in
+'') ;;
+*)
+  case "${AUTO_RUN}" in
+  '')
+    (
+      echo ''
+      echo '*** You approved the automatic upgrade of some files.'
+      echo '    The following were upgraded for you:'
+      echo "${AUTO_APPROVED_FILES}"
+    ) | ${PAGER}
+    ;;
+  *)
+    echo ''
+    echo '*** You approved the automatic upgrade of some files.'
+    echo '    The following were upgraded for you:'
+    echo "${AUTO_APPROVED_FILES}"
+    ;;
+  esac
+  ;;
+esac
+
 case "${AUTO_UPGRADED_FILES}" in
 '') ;;
 *)


More information about the Users-l mailing list