diff options
author | John Klug <john.klug@multitech.com> | 2017-10-03 16:00:14 -0500 |
---|---|---|
committer | John Klug <john.klug@multitech.com> | 2017-10-03 16:00:14 -0500 |
commit | dadd1323eb57cc605760441fed3b69614cf498b7 (patch) | |
tree | 9111aa418cfa10424d3c10854f7c4a5d21f755db /recipes-core/busybox/files | |
parent | e1caf328b57170582ebfd6632f3c081b1880bde8 (diff) | |
download | meta-mlinux-dadd1323eb57cc605760441fed3b69614cf498b7.tar.gz meta-mlinux-dadd1323eb57cc605760441fed3b69614cf498b7.tar.bz2 meta-mlinux-dadd1323eb57cc605760441fed3b69614cf498b7.zip |
Add ifplugd feature to mlinux
Diffstat (limited to 'recipes-core/busybox/files')
-rw-r--r-- | recipes-core/busybox/files/defconfig | 2 | ||||
-rwxr-xr-x | recipes-core/busybox/files/eth0.conf | 3 | ||||
-rwxr-xr-x | recipes-core/busybox/files/eth1.conf.example | 2 | ||||
-rwxr-xr-x | recipes-core/busybox/files/ifplugd.action | 30 | ||||
-rw-r--r-- | recipes-core/busybox/files/ifplugd.default | 3 | ||||
-rwxr-xr-x | recipes-core/busybox/files/ifplugd.init | 62 |
6 files changed, 101 insertions, 1 deletions
diff --git a/recipes-core/busybox/files/defconfig b/recipes-core/busybox/files/defconfig index aa1e514..a24c108 100644 --- a/recipes-core/busybox/files/defconfig +++ b/recipes-core/busybox/files/defconfig @@ -772,7 +772,7 @@ CONFIG_FEATURE_IFCONFIG_STATUS=y CONFIG_FEATURE_IFCONFIG_HW=y # CONFIG_FEATURE_IFCONFIG_BROADCAST_PLUS is not set # CONFIG_IFENSLAVE is not set -# CONFIG_IFPLUGD is not set +CONFIG_IFPLUGD=y CONFIG_IFUPDOWN=y CONFIG_IFUPDOWN_IFSTATE_PATH="/var/run/ifstate" # CONFIG_FEATURE_IFUPDOWN_IP is not set diff --git a/recipes-core/busybox/files/eth0.conf b/recipes-core/busybox/files/eth0.conf new file mode 100755 index 0000000..4ccb2bc --- /dev/null +++ b/recipes-core/busybox/files/eth0.conf @@ -0,0 +1,3 @@ +INTERFACE="eth0" +# An arbitrary script may be specified: +ARGS="-fI -i ${INTERFACE} -u 0 -d 10 -r /etc/ifplugd/ifplugd.action" diff --git a/recipes-core/busybox/files/eth1.conf.example b/recipes-core/busybox/files/eth1.conf.example new file mode 100755 index 0000000..eb2337f --- /dev/null +++ b/recipes-core/busybox/files/eth1.conf.example @@ -0,0 +1,2 @@ +INTERFACE="eth1" +ARGS="-fI -i ${INTERFACE} -u 0 -d 10 -r /etc/ifplugd/ifplugd.action" diff --git a/recipes-core/busybox/files/ifplugd.action b/recipes-core/busybox/files/ifplugd.action new file mode 100755 index 0000000..e7184c7 --- /dev/null +++ b/recipes-core/busybox/files/ifplugd.action @@ -0,0 +1,30 @@ +#!/bin/sh +# $Id: ifplugd.action 99 2004-02-08 20:17:59Z lennart $ + +# This file is part of ifplugd. +# +# ifplugd is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 of the License, or (at your +# option) any later version. +# +# ifplugd is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License +# along with ifplugd; if not, write to the Free Software Foundation, +# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + +set -e + +if [ -z "$1" ] || [ -z "$2" ] ; then + echo "Wrong arguments" > /dev/stderr + exit 1 +fi + +[ "$2" = "up" ] && exec /sbin/ifup $1 +[ "$2" = "down" ] && exec /sbin/ifdown $1 + +exit 0 diff --git a/recipes-core/busybox/files/ifplugd.default b/recipes-core/busybox/files/ifplugd.default new file mode 100644 index 0000000..a19632e --- /dev/null +++ b/recipes-core/busybox/files/ifplugd.default @@ -0,0 +1,3 @@ +ENABLED="yes" +#PIDFILE="/run/ifplugd.${INTERFACE}.pid" + diff --git a/recipes-core/busybox/files/ifplugd.init b/recipes-core/busybox/files/ifplugd.init new file mode 100755 index 0000000..97d6970 --- /dev/null +++ b/recipes-core/busybox/files/ifplugd.init @@ -0,0 +1,62 @@ +#! /bin/bash +# +# ifplugd init.d script +[[ -x /usr/sbin/ifplugd ]] || exit 0 +[[ -r /etc/default/ifplugd ]] && . /etc/default/ifplugd + + +#Functions to do individual actions +startdaemon(){ + # Start the application + echo -n "Starting ifplugd: " + CONFS=($(find /etc/ifplugd -name '*.conf')) + ((i=0)) + logger -p daemon.info "Found ${#CONFS[@]} Configurations" + while ((i < ${#CONFS[@]})) ; do + unset ARGS INTERFACE + . ${CONFS[$i]} + logger -p daemon.info "Starting Interface ${INTERFACE}" + ((i++)) + /usr/sbin/start-stop-daemon -Svp /run/ifplugd.${INTERFACE}.pid -a /usr/sbin/ifplugd -- ${ARGS} + done + if ((${#CONFS[@]} == 0)) ; then + /usr/sbin/start-stop-daemon -n ifplugd -Sv -x /usr/sbin/ifplugd -- ${ARGS} + fi + echo "done" +} +stopdaemon(){ + echo -n "Stopping ifplugd: " + PIDS=($(find /run -name 'ifplugd.*.pid')) + ((i=0)) + while ((i < ${#PIDS[@]})) ; do + PF=${PIDS[$i]} + [[ $PF =~ /ifplugd\.([^.]*)\.pid ]] + IF=${BASH_REMATCH[1]} + logger -p user.info "Shutting down interface $IF" + /usr/sbin/start-stop-daemon -n ifplugd -Kqp $PF + ((i++)) + done + echo "done" +} + +case "$1" in + start) + [[ ${ENABLED} == "yes" ]] || exit 0 + startdaemon + ;; + stop) + stopdaemon + ;; + restart|force-reload) + stopdaemon + sleep 2 + startdaemon + ;; + *) + echo "Usage: /etc/init.d/ifplugd { start | stop | restart | force-reload }" >&2 + exit 1 + ;; +esac + +exit 0 + |