diff options
author | Eric Andersen <andersen@codepoet.org> | 2006-12-12 22:13:41 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2006-12-12 22:13:41 +0000 |
commit | b3d71710a3066f27ab254572dddff11572785f19 (patch) | |
tree | 473905d8c597bc830015ccaf56bef3d9470ff28a /package/netplug | |
parent | 52e3eee8b918742a58e8a50dcb064955725f08ce (diff) | |
download | buildroot-novena-b3d71710a3066f27ab254572dddff11572785f19.tar.gz buildroot-novena-b3d71710a3066f27ab254572dddff11572785f19.zip |
add netplug package
Diffstat (limited to 'package/netplug')
-rw-r--r-- | package/netplug/Config.in | 8 | ||||
-rwxr-xr-x | package/netplug/init-netplug | 69 | ||||
-rwxr-xr-x | package/netplug/netplug-script | 57 | ||||
-rw-r--r-- | package/netplug/netplug.mk | 53 |
4 files changed, 187 insertions, 0 deletions
diff --git a/package/netplug/Config.in b/package/netplug/Config.in new file mode 100644 index 000000000..5c3ef95ff --- /dev/null +++ b/package/netplug/Config.in @@ -0,0 +1,8 @@ +config BR2_PACKAGE_NETPLUG + bool "netplug" + default n + help + A Linux daemon that manages network interfaces in + response to network cables being plugged in and out. + + http://www.red-bean.com/~bos/ diff --git a/package/netplug/init-netplug b/package/netplug/init-netplug new file mode 100755 index 000000000..791e14b88 --- /dev/null +++ b/package/netplug/init-netplug @@ -0,0 +1,69 @@ +#!/bin/sh +# +# netplugd This shell script takes care of starting and stopping +# the network plug management daemon. +# +# chkconfig: - 11 89 +# description: netplugd is a daemon for managing non-static network \ +# interfaces. +# processname: netplugd +# pidfile: /var/run/netplugd.pid + +# Copyright 2003 Key Research, Inc. + +# Source function library. +if [ -f /etc/init.d/functions ]; then + . /etc/init.d/functions +elif [ -f /etc/rc.d/init.d/functions ]; then + . /etc/rc.d/init.d/functions +fi + +# Source networking configuration. +if [ -f /etc/sysconfig/network ]; then + . /etc/sysconfig/network + + # Check that networking is up. + [ ${NETWORKING} = "no" ] && exit 0 +elif [ ! -f /etc/network/interfaces ]; then + # No network support + exit 0 +fi + +[ -x /sbin/netplugd ] || exit 0 + +if [ -f /etc/sysconfig/netplugd ]; then + . /etc/sysconfig/netplugd +fi + +# See how we were called. +case "$1" in + start) + # Start daemon. + echo -n $"Starting network plug daemon: " + start-stop-daemon --start --quiet --pidfile /var/run/netplugd.pid --exec /sbin/netplugd ${NETPLUGDARGS} + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && touch /var/lock/subsys/netplugd + ;; + stop) + # Stop daemon. + echo -n $"Shutting down network plug daemon: " + start-stop-daemon --stop --name netplugd + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/netplugd + ;; + restart|reload) + $0 stop + $0 start + ;; + condrestart) + [ -f /var/lock/subsys/netplugd ] && $0 restart || : + ;; + *) + echo $"Usage: $0 {start|stop|restart}" + RETVAL=1 + ;; +esac + +exit $RETVAL diff --git a/package/netplug/netplug-script b/package/netplug/netplug-script new file mode 100755 index 000000000..1af714d69 --- /dev/null +++ b/package/netplug/netplug-script @@ -0,0 +1,57 @@ +#!/bin/sh +# +# netplug - policy agent for netplugd +# +# Copyright 2003 Key Research, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License, version 2, as +# published by the Free Software Foundation. You are forbidden from +# redistributing or modifying it under the terms of any other license, +# including other versions of the GNU General Public License. +# +# This program 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. + + +PATH=/usr/bin:/bin:/usr/sbin:/sbin +export PATH + +dev="$1" +action="$2" + +case "$action" in +in) + if [ -x /sbin/ifup ]; then + exec /sbin/ifup $dev + else + echo "Please teach me how to plug in an interface!" 1>&2 + exit 1 + fi + ;; +out) + if [ -x /sbin/ifdown ]; then + # At least on Fedora Core 1, the call to ip addr flush infloops + # /sbin/ifdown $dev && exec /sbin/ip addr flush $dev + exec /sbin/ifdown $dev + else + echo "Please teach me how to unplug an interface!" 1>&2 + exit 1 + fi + ;; +probe) + # exec /sbin/ip link set $dev up >/dev/null 2>&1 + if [ -x /sbin/ifconfig ]; then + exec /sbin/ifconfig $dev up >/dev/null 2>&1 + else + echo "Failed to probe an interface!" 1>&2 + exit 1 + fi + ;; +*) + echo "I have been called with a funny action of '%s'!" 1>&2 + exit 1 + ;; +esac diff --git a/package/netplug/netplug.mk b/package/netplug/netplug.mk new file mode 100644 index 000000000..010f60674 --- /dev/null +++ b/package/netplug/netplug.mk @@ -0,0 +1,53 @@ +############################################################# +# +# netplug +# +############################################################# +NETPLUG_VER=1.2.9 +NETPLUG_SOURCE=netplug-$(NETPLUG_VER).tar.bz2 +NETPLUG_SITE=http://www.red-bean.com/~bos/netplug +NETPLUG_DIR=$(BUILD_DIR)/netplug-$(NETPLUG_VER) +NETPLUG_CAT:=bzcat +NETPLUG_BINARY:=netplugd +NETPLUG_TARGET_BINARY:=sbin/netplugd + +$(DL_DIR)/$(NETPLUG_SOURCE): + $(WGET) -P $(DL_DIR) $(NETPLUG_SITE)/$(NETPLUG_SOURCE) + +netplug-source: $(DL_DIR)/$(NETPLUG_SOURCE) + +$(NETPLUG_DIR)/.unpacked: $(DL_DIR)/$(NETPLUG_SOURCE) + $(NETPLUG_CAT) $(DL_DIR)/$(NETPLUG_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) - + toolchain/patch-kernel.sh $(NETPLUG_DIR) package/netplug/ netplug\*.patch + touch $(NETPLUG_DIR)/.unpacked + +$(NETPLUG_DIR)/$(NETPLUG_BINARY): $(NETPLUG_DIR)/.unpacked + $(MAKE) CC=$(TARGET_CC) -C $(NETPLUG_DIR) + $(STRIP) $(NETPLUG_DIR)/$(NETPLUG_BINARY) + +$(TARGET_DIR)/$(NETPLUG_TARGET_BINARY): $(NETPLUG_DIR)/$(NETPLUG_BINARY) + $(INSTALL) -m 644 -D $(NETPLUG_DIR)/etc/netplugd.conf $(TARGET_DIR)/etc/netplug/netplugd.conf + $(INSTALL) -m 755 -D package/netplug/netplug-script $(TARGET_DIR)/etc/netplug.d/netplug + $(INSTALL) -m 755 -D package/netplug/init-netplug $(TARGET_DIR)/etc/init.d/S29netplug + $(INSTALL) -m 755 -D $(NETPLUG_DIR)/$(NETPLUG_BINARY) $(TARGET_DIR)/$(NETPLUG_TARGET_BINARY) + touch -c $(TARGET_DIR)/$(NETPLUG_TARGET_BINARY) + +netplug: uclibc $(TARGET_DIR)/$(NETPLUG_TARGET_BINARY) + +netplug-clean: + rm -f $(TARGET_DIR)/$(NETPLUG_TARGET_BINARY) + rm -rf $(TARGET_DIR)/etc/netplug* + rm -f $(TARGET_DIR)/etc/init.d/S*netplug + -$(MAKE) -C $(NETPLUG_DIR) clean + +netplug-dirclean: + rm -rf $(NETPLUG_DIR) + +############################################################# +# +# Toplevel Makefile options +# +############################################################# +ifeq ($(strip $(BR2_PACKAGE_NETPLUG)),y) +TARGETS+=netplug +endif |