literal name_enable wherever possible, and ${name}_enable when it's not, to prepare for the demise of set_rcvar(). In cases where I had to hand-edit unusual instances also modify formatting slightly to be more uniform (and in some cases, correct). This includes adding some $FreeBSD$ tags, and most importantly moving rcvar= to right after name= so it's clear that one is derived from the other.
50 lines
940 B
Bash
50 lines
940 B
Bash
#!/bin/sh
|
|
# $FreeBSD$
|
|
#
|
|
# PROVIDE: lvwimax
|
|
# REQUIRE: DAEMON
|
|
#
|
|
# Add the following line to /etc/rc.conf[.local] to enable lvwimax:
|
|
#
|
|
# lvwimax_enable="YES"
|
|
# lvwimax_mac_address="XX:XX:XX:XX:XX:XX", default is "00:00:00:00:00:00"
|
|
#
|
|
|
|
# XXX: tap0 interface is hardcoded at the driver
|
|
lvwimax_tap_dev="tap0"
|
|
|
|
. /etc/rc.subr
|
|
|
|
name=lvwimax
|
|
rcvar=lvwimax_enable
|
|
|
|
load_rc_config $name
|
|
|
|
lvwimax_enable=${lvwimax_enable-"NO"}
|
|
lvwimax_mac_address=${lvwimax_mac_address-"00:00:00:00:00:00"}
|
|
|
|
command=%%PREFIX%%/sbin/${name}
|
|
|
|
start_precmd="lvwimax_prestart"
|
|
start_postcmd="lvwimax_poststart"
|
|
stop_postcmd="lvwimax_poststop"
|
|
|
|
lvwimax_prestart()
|
|
{
|
|
ifconfig ${lvwimax_tap_dev} create
|
|
ifconfig ${lvwimax_tap_dev} mtu 1386
|
|
ifconfig ${lvwimax_tap_dev} ether ${lvwimax_mac_address}
|
|
ifconfig ${lvwimax_tap_dev} up
|
|
}
|
|
|
|
lvwimax_poststart()
|
|
{
|
|
dhclient ${lvwimax_tap_dev}
|
|
}
|
|
|
|
lvwimax_poststop()
|
|
{
|
|
ifconfig ${lvwimax_tap_dev} destroy
|
|
}
|
|
|
|
run_rc_command $1
|