moving starting agettys to rc

This commit is contained in:
Jack L. Frost 2014-02-25 09:28:01 +04:00
parent 2c27df892d
commit 776454a7e3
2 changed files with 38 additions and 14 deletions

37
bin/rc
View File

@ -2,33 +2,48 @@
rc.hostname() { hostname "$cfg_hostname"; }
rc.services() {
local service_name bg_start
rc.services_start() {
local service_name start_mode
for i in "${cfg_services[@]}"; do
unset service_name
[[ "$i" =~ ^@ ]] && {
service_name="${i##*@}"
bg_start='1'
} || {
service_name="$i"
start_mode='bg'
}
[[ "$bg_start" ]] && {
"${cfg_initscripts_dir}/$service_name" "$1" & true
} || {
"${cfg_initscripts_dir}/$service_name" "$1"
[[ "$i" =~ ^% ]] && {
service_name="${i##*%}"
start_mode='watch'
}
service_name=${service_name:-$i}
start_mode="${start_mode:-start}"
case "$start_mode" in
bg) "${cfg_initscripts_dir}/$service_name" start &;;
watch) "${cfg_initscripts_dir}/$service_name" watch &;;
start) "${cfg_initscripts_dir}/$service_name" start;;
*) echo "Mode $start_mode not supported";;
esac
done
}
rc.services_stop() {
for i in "${cfg_services[@]}"; do
"${cfg_initscripts_dir}/$i" stop
done
}
rc.boot() {
rc.hostname
rc.modules
rc.services start
rc.services_start
}
rc.shutdown() {
rc.services stop
rc.services_stop
}
rc.hostname() {

View File

@ -1,8 +1,17 @@
# System-wide configuration
export PATH='/usr/local/bin:/usr/bin'
# Where to look for initscripts
cfg_initscripts_dir='/etc/rc.d'
cfg_hostname='generic'
cfg_services=( 'fsck' 'udev' 'mount' 'syslog-ng' 'crond' 'network' 'dhcpcd' '@sshd' 'rc.local' )
# cfg_modules=()
# Hostname
cfg_hostname='cetaganda'
# Services to start at boot time
cfg_services+=( 'mount' 'udev' 'rc.local' ) # You probably do need these
cfg_services+=( '@syslog-ng' '@crond' '@network' '@sshd' '@dbus' '@alsa' ) # Services starting with '@' start in background.
cfg_services+=( %agetty-tty{2..6} ) # Do not modify this unless you know what you are doing!
# Modules to be loaded at boot time. Most people don't need this
#cfg_modules=( 'tun' )