Browse Source

Install native systemd units, udev rules, and if-up.d hook to trigger discovery. (Closes: #796585)

This also installs a modules-load.d configuration and
deprecates /etc/defaults/aoetools.
Christian Hofstaedtler 6 years ago
parent
commit
80ad8670e3

+ 11 - 0
debian/60-aoe.rules

@@ -0,0 +1,11 @@
+# These rules tell udev what device nodes to create for aoe support.
+
+# aoe char devices
+SUBSYSTEM=="aoe", KERNEL=="discover",	NAME="etherd/%k", GROUP="disk", MODE="0220"
+SUBSYSTEM=="aoe", KERNEL=="err",	NAME="etherd/%k", GROUP="disk", MODE="0440"
+SUBSYSTEM=="aoe", KERNEL=="interfaces",	NAME="etherd/%k", GROUP="disk", MODE="0220"
+SUBSYSTEM=="aoe", KERNEL=="revalidate",	NAME="etherd/%k", GROUP="disk", MODE="0220"
+SUBSYSTEM=="aoe", KERNEL=="flush",	NAME="etherd/%k", GROUP="disk", MODE="0220"
+
+# run discover once the module is loaded
+SUBSYSTEM=="aoe", KERNEL=="discover", ACTION=="add", TAG+="systemd", ENV{SYSTEMD_WANTS}+="aoe-discover.service"

+ 9 - 0
debian/NEWS.Debian

@@ -0,0 +1,9 @@
+aoetools (36-1.1) unstable; urgency=medium
+
+  * When run under systemd, the init script is no longer executed.
+    If you previously have restricted the used network interfaces,
+    please look at /usr/lib/modules-load.d/aoetools.conf on how to
+    upgrade this configuration.
+    As a new default, all network interfaces are used.
+
+ -- Christian Hofstaedtler <zeha@debian.org>  Mon, 4 Jul 2016 16:01:00 +0200

+ 10 - 0
debian/aoetools.aoe-discover.service

@@ -0,0 +1,10 @@
+[Unit]
+Description=ATA over Ethernet discovery
+BindsTo=sys-devices-virtual-aoe-discover.device
+DefaultDependencies=no
+Conflicts=shutdown.target
+After=network-online.target
+
+[Service]
+Type=oneshot
+ExecStart=/sbin/aoe-discover

+ 4 - 0
debian/aoetools.default

@@ -1,5 +1,9 @@
 # Configuration file for aoetools.
 
+## NOTE: This file is NOT READ under systemd.
+## If you need to restrict the used interfaces, please read /usr/lib/modules-load.d/aoetools.conf
+## Filesystems can be mounted using /etc/fstab.
+
 # Enter the list of network interfaces to restrict the AoE discovery to, separated by spaces.
 # It can be blank, i.e. "", if you want to run AoE over all the interfaces.
 # If you do not want AoE discovery at all, enter "none" as the list of interfaces.

+ 2 - 0
debian/aoetools.install

@@ -0,0 +1,2 @@
+debian/modules-load.d/aoetools.conf /usr/lib/modules-load.d/
+debian/60-aoe.rules /lib/udev/rules.d/

+ 2 - 0
debian/aoetools.links

@@ -0,0 +1,2 @@
+dev/null lib/systemd/system/aoetools.service
+usr/sbin/aoe-discover etc/network/if-up.d/aoe-discover

+ 24 - 0
debian/aoetools.postinst

@@ -0,0 +1,24 @@
+#!/bin/sh
+
+set -e
+
+case "$1" in
+configure)
+    if which udevadm >/dev/null; then
+        udevadm control --reload || true
+    fi
+    # load the kernel module (as opposed to letting the init script do it)
+    if [ -d /run/systemd/system ] ; then
+        /lib/systemd/systemd-modules-load aoetools.conf
+    fi
+    ;;
+abort-upgrade|abort-remove|abort-deconfigure)
+    ;;
+*)
+    echo "postinst called with unknown argument '$1'"
+    exit 1
+    ;;
+esac
+
+#DEBHELPER#
+exit 0

+ 1 - 1
debian/control

@@ -4,7 +4,7 @@ Priority: optional
 Maintainer: David Martínez Moreno <ender@debian.org>
 Standards-Version: 3.9.5
 Homepage: http://aoetools.sf.net
-Build-Depends: debhelper (>> 9)
+Build-Depends: debhelper (>> 9), dh-systemd
 Vcs-Browser: http://anonscm.debian.org/gitweb/?p=collab-maint/aoetools.git
 Vcs-Git: git://anonscm.debian.org/collab-maint/aoetools.git
 

+ 6 - 0
debian/modules-load.d/aoetools.conf

@@ -0,0 +1,6 @@
+## If you need to restrict the interfaces aoe will use, copy this
+## file to /etc/modules-load.d/ and use this example:
+# aoe aoe_iflist="eth0,eth1"
+
+## Load aoe driver with no interface restriction:
+aoe

+ 2 - 1
debian/rules

@@ -4,7 +4,7 @@
 # export DH_VERBOSE=1
 
 %:
-	dh $@
+	dh $@ --with systemd
 
 override_dh_auto_install:
 	$(MAKE) install PREFIX=debian/aoetools SBINDIR=debian/aoetools/sbin
@@ -16,3 +16,4 @@ override_dh_installchangelogs:
 
 override_dh_installinit:
 	dh_installinit --no-restart-on-upgrade -u"start 41 S . start 34 0 6 ."
+	dh_systemd_enable --name=aoe-discover