[SCM] UNNAMED PROJECT branch, debian-unstable, updated. 3ee9d5a018d873823da8cc9551a66bd401d167af

Julien Cristau jcristau at debian.org
Fri Mar 27 05:21:09 UTC 2009


The following commit has been merged in the debian-unstable branch:
commit d9066a28b95e1a74e9f6ebac8e71e07fca321cd1
Author: Julien Cristau <jcristau at debian.org>
Date:   Tue May 20 18:53:28 2008 +0200

    xsfbs.sh: add remove_conffile_lookup
    
    This variant of remove_conffile_prepare looks for the given conffile's
    canonical md5sum in dpkg's status database itself instead of using
    provided values.

diff --git a/debian/xsfbs/xsfbs.sh b/debian/xsfbs/xsfbs.sh
index a90ff7d..0c7607a 100644
--- a/debian/xsfbs/xsfbs.sh
+++ b/debian/xsfbs/xsfbs.sh
@@ -514,6 +514,37 @@ remove_conffile_prepare () {
   fi
 }
 
+remove_conffile_lookup () {
+  # syntax: remove_conffile_lookup package filename
+  #
+  # Lookup the md5sum of a conffile in dpkg's database, and prepare for removal
+  # if it matches the actual file's md5sum.
+  #
+  # Call this function when you would call remove_conffile_prepare but only
+  # want to check against dpkg's status database instead of known checksums.
+
+  local package conffile old_md5sum
+
+  # validate arguments
+  if [ $# -ne 2 ]; then
+    usage_error "remove_conffile_lookup() called with wrong number of" \
+                "arguments; expected 1, got $#"
+    exit $SHELL_LIB_USAGE_ERROR
+  fi
+
+  package="$1"
+  conffile="$2"
+
+  if ! [ -e "$conffile" ]; then
+    return
+  fi
+  old_md5sum="$(dpkg-query -W -f='${Conffiles}' "$package" | \
+    awk '{ if (match($0, "^ '"$conffile"' ")) print $2}')"
+  if [ -n "$old_md5sum" ]; then
+    remove_conffile_prepare "$conffile" "$old_md5sum"
+  fi
+}
+
 remove_conffile_commit () {
   # syntax: remove_conffile_commit filename
   #

-- 
UNNAMED PROJECT



More information about the debian-science-commits mailing list