Commit 3c423198 authored by Franco Fichtner's avatar Franco Fichtner

rc: /etc/rc.conf.d may not exist; style updates ;)

parent 5320fc92
#!/bin/sh #!/bin/sh
if [ ! -d /etc/rc.conf.d ]; then
exit 0
fi
# check which services to enable # check which services to enable
. /etc/rc.conf . /etc/rc.conf
for rc_conf in /etc/rc.conf.d/*; for rc_conf in /etc/rc.conf.d/*;
do do
. $rc_conf . $rc_conf
done done
# probe all deamons in /usr/local/etc/rc.d/ # probe all deamons in /usr/local/etc/rc.d/
ls /usr/local/etc/rc.d/* | while read rc_filename ls /usr/local/etc/rc.d/* | while read rc_filename; do
do # read rc scripts and parse name and rcvar variables
# echo $rc_filename _file=`basename $rc_filename`
# read rc scripts and parse name and rcvar variables eval `/usr/bin/grep "name[[:blank:]]*=" $rc_filename | /usr/bin/head -n 1`
_file=`basename $rc_filename` eval `grep "rcvar[[:blank:]]*=" $rc_filename | /usr/bin/sed '/^$/d'`
eval `/usr/bin/grep "name[[:blank:]]*=" $rc_filename | /usr/bin/head -n 1`
eval `grep "rcvar[[:blank:]]*=" $rc_filename | /usr/bin/sed '/^$/d'`
# check if service is enabled # check if service is enabled
eval "is_enabled=\$"$rcvar"" eval "is_enabled=\$"$rcvar""
# start/stop service # start/stop service
if [ "$is_enabled" == "YES" ]; then if [ "$is_enabled" == "YES" ]; then
$rc_filename $1 $rc_filename $1
fi fi
done done
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment