2013-09-29 01:53:44 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
rc.hostname() { hostname "$cfg_hostname"; }
|
|
|
|
|
|
|
|
rc.services() {
|
2014-02-24 07:20:05 +00:00
|
|
|
local service_name bg_start
|
|
|
|
|
2013-09-29 01:53:44 +00:00
|
|
|
for i in "${cfg_services[@]}"; do
|
2014-02-24 07:20:05 +00:00
|
|
|
[[ "$i" =~ ^@ ]] && {
|
|
|
|
service_name="${i##*@}"
|
|
|
|
bg_start='1'
|
|
|
|
} || {
|
|
|
|
service_name="$i"
|
|
|
|
}
|
|
|
|
|
|
|
|
[[ "$bg_start" ]] && {
|
2014-02-24 07:22:29 +00:00
|
|
|
"${cfg_initscripts_dir}/$service_name" "$1" & true
|
2014-02-24 07:20:05 +00:00
|
|
|
} || {
|
2014-02-24 07:22:29 +00:00
|
|
|
"${cfg_initscripts_dir}/$service_name" "$1"
|
2014-02-24 07:20:05 +00:00
|
|
|
}
|
2013-09-29 01:53:44 +00:00
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
rc.boot() {
|
|
|
|
rc.hostname
|
|
|
|
rc.modules
|
|
|
|
rc.services start
|
|
|
|
}
|
|
|
|
|
|
|
|
rc.shutdown() {
|
|
|
|
rc.services stop
|
|
|
|
}
|
|
|
|
|
|
|
|
rc.hostname() {
|
|
|
|
[[ "$cfg_hostname" ]] && { hostname "$cfg_hostname"; }
|
|
|
|
}
|
|
|
|
|
|
|
|
rc.modules() {
|
|
|
|
for i in "${cfg_modules[@]}"; do
|
|
|
|
modprobe "$i"
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
source "/etc/rc.conf"
|
|
|
|
|
|
|
|
action="$1"
|
|
|
|
action="${action:-boot}"
|
|
|
|
|
|
|
|
case "$action" in
|
|
|
|
boot)
|
|
|
|
echo "Welcome to `uname -rs`"
|
|
|
|
rc.boot
|
|
|
|
;;
|
|
|
|
shutdown) rc.shutdown;;
|
|
|
|
esac
|