From 715368e54fdb4a4ccdc2e155a918eae23c479e45 Mon Sep 17 00:00:00 2001 From: Laurent Bigonville Date: Sun, 13 Jan 2013 17:36:52 +0100 Subject: [PATCH] Only remove /etc/init.d/nut from previous versions of nut in nut-server postinst if there are no local changes. * Only remove /etc/init.d/nut from previous versions of nut in nut-server postinst if there are no local changes. * Also remove /etc/init.d/nut in nut-client postinst. Thanks to Laurent Bigonville for the hint. --- debian/changelog | 6 +++++- debian/nut-client.postinst | 10 ++++++++++ debian/nut-server.postinst | 9 +++++++-- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/debian/changelog b/debian/changelog index eaf9c73..35237fa 100644 --- a/debian/changelog +++ b/debian/changelog @@ -13,8 +13,12 @@ nut (2.6.5-2) UNRELEASED; urgency=low [ Ivo De Decker ] * Only fix permissions of configfiles on first install. + * Only remove /etc/init.d/nut from previous versions of nut in nut-server + postinst if there are no local changes. + * Also remove /etc/init.d/nut in nut-client postinst. Thanks to + Laurent Bigonville for the hint. - -- Laurent Bigonville Sun, 13 Jan 2013 17:31:15 +0100 + -- Laurent Bigonville Sun, 13 Jan 2013 17:36:13 +0100 nut (2.6.5-1) experimental; urgency=low diff --git a/debian/nut-client.postinst b/debian/nut-client.postinst index e4743f5..bac6721 100644 --- a/debian/nut-client.postinst +++ b/debian/nut-client.postinst @@ -41,6 +41,16 @@ case "$1" in chmod 770 /var/run/nut [ -x /sbin/restorecon ] && /sbin/restorecon /var/run/nut fi + + if dpkg --compare-versions "$2" le "2.6.4-2~" && + [ -f /etc/init.d/nut ] ; then + if [ "`md5sum /etc/init.d/nut | cut -d ' ' -f 1`" = 72f1dbc6b92cb4407f26605d05b12681 ]; then + rm -f /etc/init.d/nut + else + mv /etc/init.d/nut /etc/init.d/nut.dpkg-old + fi + update-rc.d nut remove >/dev/null + fi ;; abort-upgrade) diff --git a/debian/nut-server.postinst b/debian/nut-server.postinst index 0c653da..4a718aa 100644 --- a/debian/nut-server.postinst +++ b/debian/nut-server.postinst @@ -54,8 +54,13 @@ case "$1" in # 557178 udevadm trigger --subsystem-match=usb - if dpkg --compare-versions "$2" le "2.6.4-2~" ; then - rm -f /etc/init.d/nut + if dpkg --compare-versions "$2" le "2.6.4-2~" && + [ -f /etc/init.d/nut ] ; then + if [ "`md5sum /etc/init.d/nut | cut -d ' ' -f 1`" = 72f1dbc6b92cb4407f26605d05b12681 ]; then + rm -f /etc/init.d/nut + else + mv /etc/init.d/nut /etc/init.d/nut.dpkg-old + fi update-rc.d nut remove >/dev/null fi ;;