Hi Michael,

On Saturday 03 March 2007 12:22, Michael Biebl wrote:
> Hi,
>
> you will also very likely need the attached patch:
> Debian does not use pam_console but uses group membership to control
> access to D-Bus. Activating both options in the conf file makes it work
> on Debian and Ubuntu.

Thanks very much.

>
> About activating the service, you will very likely have to provide a
> D-Bus init script (for /etc/dbus-1/event.d/) comparable to the one from
> dhcdbd.

Ok. How would the sequnce number of the wpa_supplicant event.d scriplet be 
determined?

Attached is the patch I recently commited to SVN, can you please check it?

Also, an experimental package has been prepared at:

http://users.tpg.com.au/sigm/debian/pkg-wpa/wpasupplicant_0.6.0~cvs20070224-1.dsc

> I don't think that NetworkManager uses D-Bus's service autostart
> activation, but you can install the attached wpa_supplicant.service to
> /usr/share/dbus-1/service/ anyway, for applications that use that
> mechanism.

Added.

Thanks, Kel.
Index: debian/changelog
===================================================================
--- debian/changelog	(revision 799)
+++ debian/changelog	(working copy)
@@ -29,13 +29,16 @@
   * Install a service file to /usr/share/dbus-1/services/ for dbus aware
     applications that may take advantage of that in the future (Michael
     Biebl).
+  * Add a dbus event hook for starting wpa_supplicant as a system service.
+  * Add prerm and postinst handling for reloading dbus daemon, and restarting
+    or stopping the wpa_supplicant dbus daemon on configure/remove.
   * Add support to ifupdown.sh for `wpa-mode' and `wpa-frequency' options used
     in IBSS mode. Note that ifupdown.sh does not do any sanity checking for
     the other many requirements for using wpa_supplicant in IBSS mode.
   * Update XS-Vcs-* fields in control file, add Vcs-Browser token.
   * Move debian spcific ifupdown sh glue into debian/ifupdown/.
 
- -- Kel Modderman <[EMAIL PROTECTED]>  Sun,  4 Mar 2007 14:06:46 +1000
+ -- Kel Modderman <[EMAIL PROTECTED]>  Sun,  4 Mar 2007 15:17:27 +1000
 
 wpasupplicant (0.5.5-4) unstable; urgency=low
 
Index: debian/rules
===================================================================
--- debian/rules	(revision 799)
+++ debian/rules	(working copy)
@@ -25,6 +25,8 @@
 		debian/wpasupplicant/sbin/wpa_action
 	install --mode=644 -D dbus-wpa_supplicant.conf \
 		debian/wpasupplicant/etc/dbus-1/system.d/wpa_supplicant.conf
+	install --mode=755 -D debian/dbus/wpa_supplicant.dbus-event \
+		debian/wpasupplicant/etc/dbus-1/event.d/23wpa_supplicant
 	install --mode=644 -D debian/dbus/wpa_supplicant.service \
 		debian/wpasupplicant/usr/share/dbus-1/services/wpa_supplicant.service
 	dh_installinit --name=wpa-ifupdown --no-start \
Index: debian/dbus/wpa_supplicant.dbus-event
===================================================================
--- debian/dbus/wpa_supplicant.dbus-event	(revision 0)
+++ debian/dbus/wpa_supplicant.dbus-event	(revision 0)
@@ -0,0 +1,56 @@
+#!/bin/sh
+#
+# wpa_supplicant D-Bus daemon
+#
+# Debian/Ubuntu wpasupplicant Maintainers <[EMAIL PROTECTED]>
+#
+
+set -e
+
+PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
+DESC="wpa_supplicant D-Bus daemon"
+NAME="wpa_supplicant"
+PIDFILE="/var/run/$NAME.dbus.pid"
+DAEMON="/sbin/$NAME"
+DAEMON_OPTS="-u -B -P $PIDFILE"
+SCRIPTNAME="/etc/dbus-1/event.d/23$NAME"
+
+test -x $DAEMON || exit 0
+
+. /lib/lsb/init-functions
+
+d_start() {
+	start-stop-daemon --start --quiet --pidfile $PIDFILE \
+		--exec $DAEMON -- $DAEMON_OPTS
+}
+
+d_stop() {
+	start-stop-daemon --stop --quiet --pidfile $PIDFILE \
+		 --oknodo --exec $DAEMON
+}
+
+case "$1" in
+	start)
+        	log_daemon_msg "Starting $DESC" "$NAME"
+		d_start
+		log_end_msg $?
+		;;
+	stop)
+		log_daemon_msg "Stopping $DESC" "$NAME"
+		d_stop
+		log_end_msg $?
+		;;
+	restart|force-reload)
+		log_daemon_msg "Restarting $DESC" "$NAME"
+		d_stop
+		sleep 5
+		d_start
+		log_end_msg $?
+		;;
+	*)
+		echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
+		exit 1
+		;;
+esac
+
+exit 0
Index: debian/wpasupplicant.postinst
===================================================================
--- debian/wpasupplicant.postinst	(revision 796)
+++ debian/wpasupplicant.postinst	(working copy)
@@ -43,6 +43,16 @@
 	if dpkg --compare-versions "$2" lt "0.4.8-1"; then
 	    rm_init_script
 	fi
+
+	# Ask the bus to reload the config file
+	if [ -x /etc/init.d/dbus ]; then
+		invoke-rc.d dbus force-reload || true
+	fi
+
+	# Restart wpa_supplicant D-Bus service
+	if [ -x /etc/dbus-1/event.d/23wpa_supplicant ]; then
+		 /etc/dbus-1/event.d/23wpa_supplicant restart
+	fi
 	;;
 
     abort-upgrade|abort-deconfigure|abort-remove)
Index: debian/wpasupplicant.prerm
===================================================================
--- debian/wpasupplicant.prerm	(revision 0)
+++ debian/wpasupplicant.prerm	(revision 0)
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+# summary of how this script can be called:
+#        * <postrm> `remove'
+#        * <postrm> `purge'
+#        * <old-postrm> `upgrade' <new-version>
+#        * <new-postrm> `failed-upgrade' <old-version>
+#        * <new-postrm> `abort-install'
+#        * <new-postrm> `abort-install' <old-version>
+#        * <new-postrm> `abort-upgrade' <old-version>
+#        * <disappearer's-postrm> `disappear' <overwriter>
+#          <overwriter-version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+set -e
+
+if [ "$1" = "remove" ]; then
+	# Stop dhcdbd service on removal
+	if [ -x /etc/dbus-1/event.d/23wpa_supplicant ]; then
+		/etc/dbus-1/event.d/23wpa_supplicant stop 
+	fi
+fi
+
+#DEBHELPER#
+exit 0
+

Reply via email to