summaryrefslogtreecommitdiff
path: root/debian/postinst
diff options
context:
space:
mode:
authorJoey Hess <joey@kodama.kitenet.net>2008-01-03 21:36:13 -0500
committerJoey Hess <joey@kodama.kitenet.net>2008-01-03 21:36:13 -0500
commit00b7b8c2cb6979af84116abf731e7023aa526497 (patch)
treea07719caeee3db0a3a49b04ff5c4649504995ac7 /debian/postinst
parentef70e3d7e62671d0cadb2731e6965768f73ca290 (diff)
* Add gnarly conffile renaming code.
Diffstat (limited to 'debian/postinst')
-rw-r--r--debian/postinst30
1 files changed, 30 insertions, 0 deletions
diff --git a/debian/postinst b/debian/postinst
index be4bf1f..33891dd 100644
--- a/debian/postinst
+++ b/debian/postinst
@@ -5,3 +5,33 @@ set -e
. /usr/share/debconf/confmodule
#DEBHELPER#
+
+# Move a conffile without triggering a dpkg question
+mv_conffile() {
+ OLDCONFFILE="$1"
+ NEWCONFFILE="$2"
+
+ if [ -e "$OLDCONFFILE" ]; then
+ echo "Preserving user changes to $NEWCONFFILE ..."
+ mv -f "$NEWCONFFILE" "$NEWCONFFILE".dpkg-new
+ mv -f "$OLDCONFFILE" "$NEWCONFFILE"
+ fi
+}
+
+case "$1" in
+configure)
+ if dpkg --compare-versions "$2" le "0.7"; then
+ if [ -d /etc/etckeeper/pre-apt.d ]; then
+ for c in README 50uncommitted-changes; do
+ mv_conffile "/etc/etckeeper/pre-apt.d/$c" "/etc/etckeeper/pre-install.d/$c"
+ done
+ rmdir --ignore-fail-on-non-empty /etc/etckeeper/pre-apt.d
+ fi
+ if [ -d /etc/etckeeper/post-apt.d ]; then
+ for c in README 10git-test 30git-add 40git-rm 50git-commit; do
+ mv_conffile "/etc/etckeeper/post-apt.d/$c" "/etc/etckeeper/post-install.d/$c"
+ done
+ rmdir --ignore-fail-on-non-empty /etc/etckeeper/post-apt.d
+ fi
+ fi
+esac