summaryrefslogtreecommitdiff
path: root/debian/mdadm.preinst
diff options
context:
space:
mode:
authorMichael Tokarev <mjt@tls.msk.ru>2014-12-20 08:48:44 +0000
committerMichael Tokarev <mjt@tls.msk.ru>2014-12-20 08:48:44 +0000
commit489bea7ee8e1dbecfa517b8415568044ab57c73a (patch)
tree44d4878d4c7da3f4908ea9a765ef9b8f9c141756 /debian/mdadm.preinst
mdadm (3.3.2-5) unstable; urgency=medium
* use-tempnode-not-devnode.patch: change udev rules file to use $tempnode which works both on wheezy and jessie udev, instead of $devnode which only works in jessie. At this stage it is better to make rules file compatible with old version instead of adding versioned dependency. Should be removed for jessie+1. (Closes: #770883) * fix Closes: list in previous entry (Closes: #771852) # imported from the archive
Diffstat (limited to 'debian/mdadm.preinst')
-rw-r--r--debian/mdadm.preinst45
1 files changed, 45 insertions, 0 deletions
diff --git a/debian/mdadm.preinst b/debian/mdadm.preinst
new file mode 100644
index 00000000..b90ffb87
--- /dev/null
+++ b/debian/mdadm.preinst
@@ -0,0 +1,45 @@
+#!/bin/sh
+# Copyright © martin f. krafft <madduck@debian.org>
+# Distributed under the terms of the Artistic Licence 2.0
+#
+set -e
+
+# based on idea from http://www.dpkg.org/dpkg/ConffileHandling
+rm_conffile() {
+ local conffile md5sum package old_md5sum
+
+ conffile="$1"
+ if [ -e "$conffile" ]; then
+ md5sum=$(md5sum "$conffile" | cut -d' ' -f1)
+ package=$(dpkg -S "$conffile" | cut -d: -f1)
+ old_md5sum=$(dpkg -s $package | sed -rne "s,[[:space:]]+${conffile}[[:space:]]+,,p")
+ if [ "$md5sum" != "$old_md5sum" ]; then
+ echo "Obsolete conffile $conffile has been modified by you."
+ echo "Saving as ${conffile}.dpkg-bak ..."
+ mv -f "$conffile" "$conffile".dpkg-bak
+ else
+ echo "Removing obsolete conffile $conffile ..."
+ rm -f "$conffile"
+ fi
+ fi
+}
+
+case "$1" in
+
+ upgrade|install)
+
+ # migrate old configuration from *way back then*
+ DEBIANCONFIG=/etc/default/mdadm
+ OLDCONFIG=/etc/mdadm/debian.conf
+ if [ -s $OLDCONFIG ] && [ ! -f $DEBIANCONFIG ]; then
+ mv $OLDCONFIG $DEBIANCONFIG
+ fi
+
+ # Used incorrect name s/_/-/, keep all throughout until after jessie is released.
+ rm_conffile /etc/udev/rules.d/65-mdadm.vol_id.rules
+ ;;
+
+ *) :;;
+esac
+
+#DEBHELPER#