summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Cristau <jcristau@debian.org>2008-05-20 18:53:28 +0200
committerJulien Cristau <jcristau@debian.org>2008-05-30 11:54:10 +0200
commitd9066a28b95e1a74e9f6ebac8e71e07fca321cd1 (patch)
tree88b24abdea7e62225d8e87e1dcc05d36ce660c60
parent9d66b3441b36e5a47ffc288ba21f2fd929e869d0 (diff)
downloadxutils-dev-d9066a28b95e1a74e9f6ebac8e71e07fca321cd1.tar.gz
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.
-rw-r--r--debian/xsfbs/xsfbs.sh31
1 files changed, 31 insertions, 0 deletions
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
#