From 4ad78d9db390d7c68d48fc9017fbec516a68a9fe Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 2 Mar 2009 21:20:29 -0500 Subject: conffile moving idiocy * dh_installmodules: Give files in /etc/modprobe.d a .conf syntax, as required by new module-init-tools. * dh_installmodules: Add preinst and postinst code to handle cleanly renaming the modprobe.d files on upgrade. * Two updates to conffile moving code from wiki: - Support case where the conffile name is a substring of another conffile's name. - Support case where dpkg-query says the file is obsolete. --- autoscripts/postinst-moveconffile | 9 +++++++++ autoscripts/postinst-udev | 9 --------- autoscripts/preinst-moveconffile | 9 +++++++++ autoscripts/preinst-udev | 7 ------- 4 files changed, 18 insertions(+), 16 deletions(-) create mode 100644 autoscripts/postinst-moveconffile delete mode 100644 autoscripts/postinst-udev create mode 100644 autoscripts/preinst-moveconffile (limited to 'autoscripts') diff --git a/autoscripts/postinst-moveconffile b/autoscripts/postinst-moveconffile new file mode 100644 index 00000000..28f061e3 --- /dev/null +++ b/autoscripts/postinst-moveconffile @@ -0,0 +1,9 @@ +if [ "$1" = configure ]; then + if [ -e "#OLD#" ]; then + echo "Preserving user changes to #NEW# ..." + if [ -e "#NEW#" ]; then + mv -f "#NEW#" "#NEW#.dpkg-new" + fi + mv -f "#OLD#" "#NEW#" + fi +fi diff --git a/autoscripts/postinst-udev b/autoscripts/postinst-udev deleted file mode 100644 index 40b953dd..00000000 --- a/autoscripts/postinst-udev +++ /dev/null @@ -1,9 +0,0 @@ -if [ "$1" = configure ]; then - if [ -e "#OLD#" ]; then - echo "Preserving user changes to #RULE# ..." - if [ -e "#RULE#" ]; then - mv -f "#RULE#" "#RULE#.dpkg-new" - fi - mv -f "#OLD#" "#RULE#" - fi -fi diff --git a/autoscripts/preinst-moveconffile b/autoscripts/preinst-moveconffile new file mode 100644 index 00000000..619b4cef --- /dev/null +++ b/autoscripts/preinst-moveconffile @@ -0,0 +1,9 @@ +if [ "$1" = install ] || [ "$1" = upgrade ]; then + if [ -e "#OLD#" ]; then + if [ "`md5sum \"#OLD#\" | sed -e \"s/ .*//\"`" = \ + "`dpkg-query -W -f='${Conffiles}' #PACKAGE# | sed -n -e \"\\\\' #OLD# '{s/ obsolete$//;s/.* //p}\"`" ] + then + rm -f "#OLD#" + fi + fi +fi diff --git a/autoscripts/preinst-udev b/autoscripts/preinst-udev index 2b6ede30..7874fdb7 100644 --- a/autoscripts/preinst-udev +++ b/autoscripts/preinst-udev @@ -1,11 +1,4 @@ if [ "$1" = install ] || [ "$1" = upgrade ]; then - if [ -e "#OLD#" ]; then - if [ "`md5sum \"#OLD#\" | sed -e \"s/ .*//\"`" = \ - "`dpkg-query -W -f='${Conffiles}' #PACKAGE# | sed -n -e \"\\\\' #OLD#'s/.* //p\"`" ] - then - rm -f "#OLD#" - fi - fi if [ -L "#RULE#" ]; then rm -f "#RULE#" fi -- cgit v1.2.3