diff --git a/bin/rc b/bin/rc index 4795e20..5b077fb 100755 --- a/bin/rc +++ b/bin/rc @@ -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() { diff --git a/etc/rc.conf b/etc/rc.conf index 410d124..6f2caa8 100644 --- a/etc/rc.conf +++ b/etc/rc.conf @@ -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' )