From e5f537ff2a0b6702bb7d3f1e22ee8e0f164fca07 Mon Sep 17 00:00:00 2001 From: Juerg Haefliger Date: Wed, 9 Apr 2014 13:58:36 +0200 Subject: [PATCH] Add sysv support to elements/dhcp-all-interfaces This patch adds support for sysv init to the dhcp-all-interfaces element. Specifically, it adds a sysv init script and the relevant install/config steps. Tested with Debian jessie/testing. Change-Id: I4ae1d5365bafda188cb65ea1fb72d8ffe2408910 --- .../install.d/50-dhcp-all-interfaces | 3 ++ .../install.d/dhcp-all-interfaces.init | 31 +++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100755 elements/dhcp-all-interfaces/install.d/dhcp-all-interfaces.init diff --git a/elements/dhcp-all-interfaces/install.d/50-dhcp-all-interfaces b/elements/dhcp-all-interfaces/install.d/50-dhcp-all-interfaces index cdaa682ab..5239c07f3 100755 --- a/elements/dhcp-all-interfaces/install.d/50-dhcp-all-interfaces +++ b/elements/dhcp-all-interfaces/install.d/50-dhcp-all-interfaces @@ -11,4 +11,7 @@ if [ "$DIB_INIT_SYSTEM" == "upstart" ]; then elif [ "$DIB_INIT_SYSTEM" == "systemd" ]; then install -D -g root -o root -m 0755 ${SCRIPTDIR}/dhcp-interface@.service /usr/lib/systemd/system/dhcp-interface@.service install -D -g root -o root -m 0644 ${SCRIPTDIR}/dhcp-all-interfaces-udev.rules /etc/udev/rules.d/99-dhcp-all-interfaces.rules +elif [ "$DIB_INIT_SYSTEM" == "sysv" ]; then + install -D -g root -o root -m 0755 ${SCRIPTDIR}/dhcp-all-interfaces.init /etc/init.d/dhcp-all-interfaces + update-rc.d dhcp-all-interfaces defaults fi diff --git a/elements/dhcp-all-interfaces/install.d/dhcp-all-interfaces.init b/elements/dhcp-all-interfaces/install.d/dhcp-all-interfaces.init new file mode 100755 index 000000000..8023e154b --- /dev/null +++ b/elements/dhcp-all-interfaces/install.d/dhcp-all-interfaces.init @@ -0,0 +1,31 @@ +#!/bin/sh -e +### BEGIN INIT INFO +# Provides: dhcp-all-interfaces +# Required-Start: $local_fs +# Required-Stop: $local_fs +# Default-Start: S +# Default-Stop: 0 6 +# X-Start-Before: networking +# Short-Description: Autodetect network interfaces +# Description: Autodetect network interfaces during boot and configure them for DHCP +### END INIT INFO + +NAME=dhcp-all-interfaces +INIT_NAME=/etc/init.d/${NAME} +SCRIPT_NAME=/usr/local/sbin/${NAME}.sh + +[ -x $SCRIPT_NAME ] || exit 0 + +case "$1" in + start) + $SCRIPT_NAME + ;; + stop) + ;; + *) + echo "Usage: $INIT_NAME {start|stop}" + exit 1 + ;; +esac + +exit 0