Build sysctl file primitive.
This commit is contained in:
Executable
+56
@@ -0,0 +1,56 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# PROVIDE: build_sysctl
|
||||
# BEFORE: sysctl
|
||||
#
|
||||
|
||||
. ${RC_ROUTER_HARNESS}/etc/rc.subr
|
||||
|
||||
name="build_sysctl"
|
||||
desc="Build dynamic sysctl entries from rc.router configurations"
|
||||
|
||||
start_cmd='fbuild_sysctl_start'
|
||||
stop_cmd='build_sysctl_stop'
|
||||
rcvar='build_sysctl_enable'
|
||||
|
||||
load_rc_config 'build_sysctl'
|
||||
|
||||
build_sysctl_start()
|
||||
{
|
||||
echo 'Running `build_sysctl`'
|
||||
fib_count=$(( ${rc_router_fibs} ))
|
||||
max_fib=$(( ${fib_count} - 1 ))
|
||||
|
||||
|
||||
rm -f ${rc_router_gen_dir}/sysctl.conf
|
||||
|
||||
cat ${rc_router_dir}/templates/sysctl.conf >> ${rc_router_gen_dir}/sysctl.conf
|
||||
|
||||
### Special variables
|
||||
echo "net.fibs=${fib_count}" >> ${rc_router_gen_dir}/sysctl.conf
|
||||
echo "net.inet6.ip6.=${fib_count}" >> ${rc_router_gen_dir}/sysctl.conf
|
||||
|
||||
if [ $( option_selected rc_router_enable_class_e ) ]
|
||||
then
|
||||
echo "net.inet.ip.allow_net240=1" >> ${rc_router_gen_dir}/sysctl.conf
|
||||
fi
|
||||
|
||||
if [ ! -e ${RC_ROUTER_HARNESS}/etc/sysctl.conf.local ]
|
||||
then
|
||||
ln -s ${rc_router_gen_dir}/sysctl.conf ${RC_ROUTER_HARNESS}/etc/sysctl.conf.local
|
||||
fi
|
||||
}
|
||||
|
||||
build_sysctl_stop()
|
||||
{
|
||||
true
|
||||
}
|
||||
|
||||
|
||||
|
||||
################ Epilogue
|
||||
|
||||
run_rc_command "$1"
|
||||
|
||||
# vim: ft=bash
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# $FreeBSD$
|
||||
#
|
||||
# PROVIDE: fib_setup
|
||||
# BEFORE: sysctl
|
||||
#
|
||||
|
||||
. ${RC_ROUTER_HARNESS}/etc/rc.subr
|
||||
|
||||
name="fib_setup"
|
||||
desc="Calculate and respect the fib count"
|
||||
|
||||
start_cmd='fib_setup_start'
|
||||
stop_cmd='fib_setup_stop'
|
||||
rcvar='fib_setup_enable'
|
||||
|
||||
load_rc_config 'fib_setup'
|
||||
|
||||
fib_setup_start()
|
||||
{
|
||||
echo "Running fib_setup"
|
||||
fib_count=$(( ${rc_router_fibs} ))
|
||||
max_fibs=$(( ${fib_count} + 1 ))
|
||||
|
||||
cp ${rc_router_dir}/templates/sysctl.conf ${rc_router_gen_dir}/
|
||||
echo "net.fibs=${fib_count}" >> ${rc_router_gen_dir}/sysctl.conf
|
||||
}
|
||||
|
||||
fib_setup_stop()
|
||||
{
|
||||
true
|
||||
}
|
||||
|
||||
|
||||
|
||||
################ Epilogue
|
||||
|
||||
run_rc_command "$1"
|
||||
|
||||
# vim: ft=bash
|
||||
|
||||
Reference in New Issue
Block a user