summaryrefslogtreecommitdiff
path: root/debian/ifplugd.preinst
diff options
context:
space:
mode:
Diffstat (limited to 'debian/ifplugd.preinst')
-rw-r--r--debian/ifplugd.preinst31
1 files changed, 31 insertions, 0 deletions
diff --git a/debian/ifplugd.preinst b/debian/ifplugd.preinst
new file mode 100644
index 0000000..fe0d24a
--- /dev/null
+++ b/debian/ifplugd.preinst
@@ -0,0 +1,31 @@
+#!/bin/sh
+set -e
+
+case "$1" in
+ upgrade)
+ ### Move old apm hook script if appropriate ###
+ if [ -f /etc/apm/event.d/20ifplugd ] ; then
+ [ -d /etc/apm/scripts.d/ ] || mkdir /etc/apm/scripts.d/
+ if [ -f /etc/apm/scripts.d/ifplugd ] ; then
+ mv -f /etc/apm/event.d/20ifplugd /etc/apm/event.d/20ifplugd.dpkg-old
+ chmod ugo-x /etc/apm/event.d/20ifplugd.dpkg-old
+ else
+ mv -f /etc/apm/event.d/20ifplugd /etc/apm/scripts.d/ifplugd
+ fi
+ for F in /etc/apm/suspend.d/20ifplugd /etc/apm/resume.d/80ifplugd /etc/apm/other.d/50ifplugd ; do
+ [ -e $F ] && { mv -f $F ${F}.dpkg-old ; chmod ugo-x ${F}.dpkg-old ; }
+ ln -nsf ../scripts.d/ifplugd $F
+ done
+ fi
+
+ # rename old script (old typo bug), maybe user changed it:
+ if [ -f /etc/apm/script.d/ifplugd ] ; then
+ mv /etc/apm/script.d/ifplugd /etc/apm/script.d/ifplugd.dpkg-old
+ fi
+
+ ;;
+# install|abort-upgrade)
+ # Nothing to do
+esac
+
+#DEBHELPER#