Contents of /trunk/avahi/autoipd.sh
Parent Directory | Revision Log
Revision 773 -
(show annotations)
(download)
(as text)
Tue Apr 28 15:54:39 2009 UTC (15 years, 5 months ago) by niro
File MIME type: application/x-sh
File size: 1271 byte(s)
Tue Apr 28 15:54:39 2009 UTC (15 years, 5 months ago) by niro
File MIME type: application/x-sh
File size: 1271 byte(s)
autoipd scripts from gentoo
1 | # Copyright (c) 2004-2006 Gentoo Foundation |
2 | # Distributed under the terms of the GNU General Public License v2 |
3 | # Contributed by Sven Wegener (swegener@gentoo.org) |
4 | |
5 | # void autoipd_depend(void) |
6 | # |
7 | # Sets up the dependencies for the module |
8 | autoipd_depend() { |
9 | after interface |
10 | } |
11 | |
12 | # void autoipd_expose(void) |
13 | # |
14 | # Expose variables that can be configured |
15 | autoipd_expose() { |
16 | variables autoipd |
17 | } |
18 | |
19 | # bool autoipd_start(char *iface) |
20 | # |
21 | # Tries to configure the interface via avahi-autoipd |
22 | autoipd_start() { |
23 | local iface="${1}" ifvar="$(bash_variable "${iface}")" opts="autoipd_${ifvar}" addr="" |
24 | |
25 | interface_exists "${iface}" true || return 1 |
26 | |
27 | ebegin "Starting avahi-autoipd" |
28 | if /usr/sbin/avahi-autoipd --daemonize --syslog --wait ${!opts} "${iface}" |
29 | then |
30 | eend 0 |
31 | addr="$(interface_get_address "${iface}")" |
32 | einfo "${iface} received address ${addr}" |
33 | return 0 |
34 | fi |
35 | |
36 | eend "${?}" "Failed to get address via avahi-autoipd!" |
37 | } |
38 | |
39 | # bool autoipd_stop(char *iface) |
40 | # |
41 | # Stops a running avahi-autoipd instance |
42 | autoipd_stop() { |
43 | local iface="${1}" |
44 | |
45 | /usr/sbin/avahi-autoipd --check --syslog "${iface}" || return 0 |
46 | |
47 | ebegin "Stopping avahi-autoipd" |
48 | /usr/sbin/avahi-autoipd --kill --syslog "${iface}" |
49 | eend "${?}" "Failed to stop running avahi-autoipd instance!" |
50 | } |
51 | |
52 | # vim: set ts=4 : |