Commit 39d69f26d22db93caf096198df8e1f9d31e76411

initial commit of netplug
targets/dss11/recipes/netplug/files/init
(35 / 0)
  
1#! /bin/sh
2#
3# This is an init script for openembedded
4# Copy it to /etc/init.d/netplugd and type
5# > update-rc.d ntpclient defaults 60
6#
7netplugd=/usr/bin/netplugd
8test -x "$netplugd" || exit 0
9
10case "$1" in
11 start)
12 echo -n "Starting netplugd"
13 start-stop-daemon --start --quiet --background --make-pidfile \
14 --pidfile /var/run/netplugd.pid --exec $netplugd
15 echo "."
16 ;;
17 stop)
18 echo -n "Stopping netplugd"
19 start-stop-daemon --stop --quiet --pidfile /var/run/netplugd.pid
20 echo "."
21 ;;
22 reload|force-reload)
23 start-stop-daemon --stop --quiet --signal 1 --exec $netplugd
24 ;;
25 restart)
26 $0 stop
27 sleep 1
28 $0 start
29 ;;
30 *)
31 echo "Usage: /etc/init.d/netplugd {start|stop|reload|restart|force-reload}"
32 exit 1
33esac
34
35exit 0
targets/dss11/recipes/netplug/files/netplug
(48 / 0)
  
1#!/bin/sh
2#
3# netplug - policy agent for netplugd
4#
5# Copyright 2003 Key Research, Inc.
6#
7# Adapted for dss11/OE by Johannes Winkelmann
8#
9# This program is free software; you can redistribute it and/or modify
10# it under the terms of the GNU General Public License, version 2, as
11# published by the Free Software Foundation. You are forbidden from
12# redistributing or modifying it under the terms of any other license,
13# including other versions of the GNU General Public License.
14#
15# This program is distributed in the hope that it will be useful, but
16# WITHOUT ANY WARRANTY; without even the implied warranty of
17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18# General Public License for more details.
19
20
21PATH=/usr/bin:/bin:/usr/sbin:/sbin
22export PATH
23
24dev="$1"
25action="$2"
26
27case "$action" in
28in)
29 /sbin/ifup $dev
30 ;;
31out)
32 /sbin/ifdown $dev
33
34 # we only detect link changes if the device is up; unfortunately, netplugd
35 # doesn't like having the interface up'ed during 'out', so we have to
36 # stop it temporarily :-(
37 /etc/init.d/netplugd stop
38 ifconfig $dev up
39 /etc/init.d/netplugd start
40 ;;
41probe)
42 ifconfig $dev up >/dev/null 2>&1
43 ;;
44*)
45 echo "I have been called with a funny action of '%s'!" 1>&2
46 exit 1
47 ;;
48esac
targets/dss11/recipes/netplug/files/netplugd.conf
(1 / 0)
  
1eth0
targets/dss11/recipes/netplug/netplug_1.2.9.2.bb
(28 / 0)
  
1DESCRIPTION = "daemon that responds to network link events"
2SECTION = "console/network"
3LICENSE = "GPL"
4
5SRC_URI = "http://www.red-bean.com/~bos/${PN}/${PN}-${PV}.tar.bz2 \
6 file://init file://netplugd.conf file://netplug"
7
8CFLAGS_append = ' -std=gnu99 -DNP_VERSION="1" -DNP_ETC_DIR="/etc" -DNP_SCRIPT_DIR="/etc/netplug.d"'
9
10INITSCRIPT_NAME = "netplugd"
11INITSCRIPT_PARAMS = "defaults 65"
12inherit update-rc.d
13
14do_configure() {
15 sed -i -e 's|$(prefix)||g' Makefile
16 sed -i -e 's|rc.d/||g' Makefile
17}
18
19do_compile() {
20 make
21}
22
23do_install() {
24 make install DESTDIR=${D}
25 install -D -m 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/netplugd
26 install -D -m 0755 ${WORKDIR}/netplugd.conf ${D}${sysconfdir}/netplug/netplugd.conf
27 install -D -m 0755 ${WORKDIR}/netplug ${D}${sysconfdir}/netplug.d/netplug
28}