This commit is contained in:
Jack L. Frost 2013-09-29 05:53:44 +04:00
parent 5b9b038001
commit 7ef5bbeecb
2 changed files with 50 additions and 0 deletions

42
bin/rc Executable file
View File

@ -0,0 +1,42 @@
#!/bin/bash
rc.hostname() { hostname "$cfg_hostname"; }
rc.services() {
for i in "${cfg_services[@]}"; do
"${cfg_initscripts_dir}/$i" "$1"
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

8
etc/rc.conf Normal file
View File

@ -0,0 +1,8 @@
# System-wide configuration
export PATH='/usr/local/bin:/usr/bin'
cfg_initscripts_dir='/etc/rc.d'
cfg_hostname='generic'
cfg_services=( 'fsck' 'udev' 'mount' 'syslog-ng' 'crond' 'network' 'dhcpcd' 'sshd' 'rc.local' )
# cfg_modules=()