summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorY Giridhar Appaji Nag <appaji@debian.org>2009-10-21 17:08:12 +0530
committerAndrew Shadura <andrew.shadura@collabora.co.uk>2016-06-21 11:57:32 +0200
commitfc8d2b558d10d022704545196d295775e9fafe36 (patch)
tree150a5f667b28e093a8e76704615c0e4fc15c3b84
parentc7a986ff92d1a2ba7ab7d7bbf7c12f500dcfda6a (diff)
Imported Debian patch 0.28-16
-rw-r--r--debian/apm/ifplugd22
-rw-r--r--debian/changelog10
-rw-r--r--debian/control2
-rw-r--r--debian/copyright2
-rw-r--r--debian/dirs1
-rw-r--r--debian/ifplugd.config4
-rw-r--r--debian/pm/ifplugd139
-rw-r--r--debian/postinst4
-rw-r--r--debian/prerm4
-rwxr-xr-xdebian/rules3
10 files changed, 163 insertions, 28 deletions
diff --git a/debian/apm/ifplugd b/debian/apm/ifplugd
deleted file mode 100644
index 36e8d39..0000000
--- a/debian/apm/ifplugd
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/bin/sh
-# suspend ifplugd
-
-[ -f /etc/default/ifplugd ] || exit 0
-. /etc/default/ifplugd
-[ "$SUSPEND_ACTION" ] || [ "$SUSPEND_ACTION" != "none" ] || exit 0
-
-if [ "$SUSPEND_ACTION" = "suspend" ] ; then
- RESUME_ACTION="resume"
-elif [ "$SUSPEND_ACTION" = "stop" ] ; then
- RESUME_ACTION="start"
-else
- exit 0
-fi
-
-if [ "$1" = suspend ]; then
- /etc/init.d/ifplugd ${SUSPEND_ACTION}
-elif [ "$1" = resume ] && [ "$2" != standby ]; then
- /etc/init.d/ifplugd ${RESUME_ACTION}
-fi
-
-exit 0
diff --git a/debian/changelog b/debian/changelog
index 0dce3a2..0817e88 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,13 @@
+ifplugd (0.28-16) unstable; urgency=low
+
+ * Install a script for supporting suspend/resume with pm-utils and apmd.
+ Thanks Harald Braumann <harry@unheit.net> for the fix (Closes: #527583
+ Closes: #551530)
+ * Update Standards-Version to 3.8.3 (no changes required)
+ * Fix lintian P:maintainer-script-without-set-e
+
+ -- Y Giridhar Appaji Nag <appaji@debian.org> Wed, 21 Oct 2009 17:08:12 +0530
+
ifplugd (0.28-15) unstable; urgency=low
* Add README.source to be compliant with policy 3.8.0
diff --git a/debian/control b/debian/control
index 835edc1..93595e1 100644
--- a/debian/control
+++ b/debian/control
@@ -3,7 +3,7 @@ Section: net
Priority: optional
Maintainer: Y Giridhar Appaji Nag <appaji@debian.org>
Build-Depends: debhelper (>= 5), dpatch, autotools-dev, libdaemon-dev (>= 0.7), pkg-config, po-debconf
-Standards-Version: 3.8.1
+Standards-Version: 3.8.3
Homepage: http://0pointer.de/lennart/projects/ifplugd/
Vcs-Svn: svn://svn.debian.org/svn/collab-maint/ext-maint/ifplugd/unstable
Vcs-Browser: http://svn.debian.org/wsvn/collab-maint/ext-maint/ifplugd/unstable/?op=log
diff --git a/debian/copyright b/debian/copyright
index 6346e65..588f19b 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -30,6 +30,6 @@ License:
The Debian packaging is
Copyright (C) 2002-2007, Oliver Kurth <oku@masqmail.cx>
-Copyright (C) 2008, Y Giridhar Appaji Nag <giridhar@appaji.net> and
+Copyright (C) 2008-2009, Y Giridhar Appaji Nag <giridhar@appaji.net> and
is licensed under the GNU GPL, either version 2 of the License, or (at
your option) any later version; see `/usr/share/common-licenses/GPL-2'.
diff --git a/debian/dirs b/debian/dirs
index a388f53..7904720 100644
--- a/debian/dirs
+++ b/debian/dirs
@@ -4,6 +4,7 @@ etc/apm/event.d
etc/apm/suspend.d
etc/apm/resume.d
etc/apm/other.d
+etc/pm/sleep.d
lib/udev
etc/ifplugd/action.d/
usr/share/bug/ifplugd/
diff --git a/debian/ifplugd.config b/debian/ifplugd.config
index ab7f46a..12b22bd 100644
--- a/debian/ifplugd.config
+++ b/debian/ifplugd.config
@@ -1,4 +1,6 @@
-#!/bin/bash -e
+#!/bin/bash
+
+set -e
# Source debconf library.
. /usr/share/debconf/confmodule
diff --git a/debian/pm/ifplugd b/debian/pm/ifplugd
new file mode 100644
index 0000000..342376d
--- /dev/null
+++ b/debian/pm/ifplugd
@@ -0,0 +1,139 @@
+#!/bin/sh
+#
+# suspend/resume ifplugd
+
+[ -f /etc/default/ifplugd ] || exit 0
+. /etc/default/ifplugd
+[ "$SUSPEND_ACTION" ] || [ "$SUSPEND_ACTION" != "none" ] || exit 0
+
+if [ "$SUSPEND_ACTION" = "suspend" ] ; then
+ RESUME_ACTION="resume"
+elif [ "$SUSPEND_ACTION" = "stop" ] ; then
+ RESUME_ACTION="start"
+else
+ exit 0
+fi
+
+# Hotplug interfaces
+#
+# ifplugd for interfaces in HOTPLUG_INTERFACES is started by udev.
+# The ifplugd init.d script doesn't touch them. We still want to
+# stop/start these interfaces on suspend/resume. Here is some
+# hackery to do this.
+
+# use pm-utils functions for state save/restore, if available
+[ -f "${PM_FUNCTIONS}" ] && . "${PM_FUNCTIONS}"
+
+# name of the save/restore state
+IFPLUGD_STATE="ifplugd_ifs"
+
+# return 0 if the first parm is an element of the remaining parms
+# or they contain the special value "all"
+elem_of() {
+ local E=$1
+ shift
+ echo $@ | grep -Eq "(\\<all\\>)|(\\<${E}\\>)"
+}
+
+# save state using pm-utils
+save_state() {
+ savestate ${IFPLUGD_STATE} 2>/dev/null
+}
+
+# load saved state using pm-utils
+load_state() {
+ restorestate ${IFPLUGD_STATE} 2>/dev/null
+}
+
+# filter only hotplug interfaces
+filter_hotplug_ifs() {
+ while read L; do
+ for IF in $L; do
+ # interface is managed statically
+ elem_of "${IF}" "${INTERFACES}" && continue
+ # interface is not managed by udev
+ elem_of "${IF}" "${HOTPLUG_INTERFACES}" || continue
+ # ignore lo
+ [ "x${IF}" = "xlo" ] && continue
+ echo -n "${IF} "
+ done
+ done
+ echo ""
+}
+
+# get interfaces of running ifplugds for hotplug IFs
+get_running_ifs() {
+ ps --no-headers -o args -C ifplugd | \
+ sed -e 's/.*-[[:alpha:]]*i[[:space:]]*\([^[:space:]]\+\).*/\1/' | \
+ filter_hotplug_ifs
+}
+
+# get all existing hotplug IFs
+get_hotplug_ifs() {
+ local IFACES=""
+ for IF in /sys/class/net/*; do
+ echo "${IF##*/} "
+ done | filter_hotplug_ifs
+}
+
+# stop all ifplugd instances that where started by udev
+# stop_udev_ifs <action>
+stop_udev_ifs() {
+ local ACTION=$1
+ local IFACES
+ local IF
+
+ IFACES=`get_running_ifs`
+
+ # save list of interfaces we stop, so we can restart them
+ echo "${IFACES}" | save_state || true
+
+ for IF in ${IFACES}; do
+ if [ "x${ACTION}" = "xsuspend" ]; then
+ ifplugd -i ${IF} -S
+ else
+ ifplugd -i ${IF} -k
+ fi
+ # ifplugd started by udev doesn't take down the IF
+ /etc/ifplugd/ifplugd.action ${IF} down
+ done
+}
+
+# start ifplugd for all interfaces that were stopped by us
+# start_udev_ifs <action>
+start_udev_ifs() {
+ local ACTION=$1
+ local IFACES
+ local IF
+
+ # try to load list of interfaces
+ # if it can't be loaded, we just start all hotplug interfaces
+ IFACES=`load_state || get_hotplug_ifs`
+
+ for IF in ${IFACES}; do
+ if [ "x${ACTION}" = "xresume" ] && ifplugd -i ${IF} -c; then
+ ifplugd -i ${IF} -R
+ else
+ # start ifplugd just as udev would
+ INTERFACE=${IF} ACTION=add /lib/udev/ifplugd.agent
+ fi
+ done
+}
+
+
+case "$1" in
+ hibernate|suspend|suspend_hybrid)
+ /etc/init.d/ifplugd ${SUSPEND_ACTION}
+ stop_udev_ifs ${SUSPEND_ACTION}
+ ;;
+ thaw|resume)
+ if [ "x$2" != "xstandby" ]; then
+ start_udev_ifs ${RESUME_ACTION}
+ /etc/init.d/ifplugd ${RESUME_ACTION}
+ fi
+ ;;
+ *) exit 1
+ ;;
+esac
+
+exit 0 \ No newline at end of file
diff --git a/debian/postinst b/debian/postinst
index 9658ad0..12c6932 100644
--- a/debian/postinst
+++ b/debian/postinst
@@ -1,4 +1,6 @@
-#!/bin/sh -e
+#!/bin/sh
+
+set -e
# source debconf library
. /usr/share/debconf/confmodule
diff --git a/debian/prerm b/debian/prerm
index 7ad1c5e..b76b0f9 100644
--- a/debian/prerm
+++ b/debian/prerm
@@ -1,4 +1,6 @@
-#!/bin/sh -e
+#!/bin/sh
+
+set -e
DEFAULTFILE=/etc/default/ifplugd
INTERFACES=""
diff --git a/debian/rules b/debian/rules
index 2d3a6e2..f371fb1 100755
--- a/debian/rules
+++ b/debian/rules
@@ -68,7 +68,8 @@ install: build
install -m 755 debian/ifplugd.udev.agent $(CURDIR)/debian/ifplugd/lib/udev/ifplugd.agent
install -m 755 debian/ifplugd.action $(CURDIR)/debian/ifplugd/etc/ifplugd/
install -m 755 debian/ifupdown.action $(CURDIR)/debian/ifplugd/etc/ifplugd/action.d/ifupdown
- install -m 755 debian/apm/ifplugd $(CURDIR)/debian/ifplugd/etc/apm/scripts.d/
+ install -m 755 debian/pm/ifplugd $(CURDIR)/debian/ifplugd/etc/apm/scripts.d/
+ install -m 755 debian/pm/ifplugd $(CURDIR)/debian/ifplugd/etc/pm/sleep.d/74ifplugd
install -m 755 debian/ifstatus $(CURDIR)/debian/ifplugd/usr/sbin/
install -m 755 debian/bug/script $(CURDIR)/debian/ifplugd/usr/share/bug/ifplugd/