diff options
author | Judd Vinet <judd@archlinux.org> | 2003-05-23 23:58:57 +0000 |
---|---|---|
committer | Judd Vinet <judd@archlinux.org> | 2003-05-23 23:58:57 +0000 |
commit | df91d849d2c19bd070473da49dd8befc7aae978c (patch) | |
tree | 8e29f1f1c89388b1afb170acf49d694bad755fb4 | |
parent | ead9f8db5fe817f019512681d5169dffad705357 (diff) |
upgpkg: initscripts 0.5
-rwxr-xr-x | network | 82 | ||||
-rwxr-xr-x | nfsmount | 1 | ||||
-rw-r--r-- | rc.conf | 14 |
3 files changed, 59 insertions, 38 deletions
@@ -3,62 +3,86 @@ . /etc/rc.conf . /etc/rc.d/functions +ifup() +{ + varname="\$${1}" + eval new_ifline=$varname + if [ "$new_ifline" = "dhcp" ]; then + # remove the .pid file if it exists + rm -f /etc/dhcpc/dhcpcd-${1}.pid >/dev/null 2>&1 + /usr/sbin/dhcpcd -h $HOSTNAME $1 || stat_die + else + /sbin/ifconfig $new_ifline || stat_die + fi +} + +ifdown() +{ + varname="\$${1}" + eval new_ifline=$varname + if [ "$new_ifline" = "dhcp" ]; then + /bin/kill `cat /etc/dhcpc/dhcpcd-${1}.pid` + else + /sbin/ifconfig $new_ifline down || stat_die + fi +} + +rtup() +{ + varname="\$${1}" + eval new_rtline=$varname + /sbin/route add $new_rtline || stat_die +} + +rtdown() +{ + varname="\$${1}" + eval new_rtline=$varname + /sbin/route del $new_rtline || stat_fail +} case "$1" in start) - ck_daemon network || exit + if ! ck_daemon network; then + echo "Network is already running. Try 'network restart'" + exit + fi stat_busy "Starting Network" for ifline in ${INTERFACES[@]}; do if echo $ifline | grep '^[^\!]' >/dev/null 2>&1; then - varname="\$${ifline}" - eval new_ifline=$varname - if [ "$new_ifline" = "dhcp" ]; then - # remove the .pid file if it exists - rm -f /etc/dhcpc/dhcpcd-${ifline}.pid >/dev/null 2>&1 - /usr/sbin/dhcpcd -D -H -h $HOSTNAME $ifline || stat_die - else - /sbin/ifconfig $new_ifline || stat_die - fi + ifup $ifline fi done for rtline in "${ROUTES[@]}"; do - if echo $rtline | grep '^[^\!]' 2>&1 > /dev/null; then - varname="\$${rtline}" - eval new_rtline=$varname - /sbin/route add $new_rtline || stat_die + if echo $rtline | grep '^[^\!]' 2>&1 >/dev/null; then + rtup $rtline fi done add_daemon network stat_done ;; stop) - ck_daemon network && exit + if ck_daemon network; then + echo "Network is not running. Try 'network start'" + exit + fi stat_busy "Stopping Network" rm_daemon network for rtline in "${ROUTES[@]}"; do - if echo $rtline | grep '^[^\!]' 2>&1 > /dev/null; then - varname="\$${rtline}" - eval new_rtline=$varname - /sbin/route del $new_rtline || stat_die + if echo $rtline | grep '^[^\!]' 2>&1 >/dev/null; then + rtdown $rtline fi done for ifline in ${INTERFACES[@]}; do - if echo $ifline | grep '^[^\!]' 2>&1 > /dev/null; then - varname="\$${ifline}" - eval new_ifline=$varname - if [ "$new_ifline" = "dhcp" ]; then - # do nothing - we kill dhcpcd later - /bin/true - else - /sbin/ifconfig $new_ifline down || stat_die - fi + if echo $ifline | grep '^[^\!]' 2>&1 >/dev/null; then + ifdown $ifline fi done - /usr/bin/killall -q dhcpcd stat_done ;; restart) $0 stop + sleep 2 $0 start ;; *) @@ -8,6 +8,7 @@ case "$1" in stat_busy "Mounting NFS filesystems" if [ ! -f /var/run/daemons/portmap ]; then stat_fail + echo "ERROR: portmap is not running" exit 1 fi mount -a -t nfs @@ -1,5 +1,5 @@ # -# /etc/rc.conf +# /etc/rc.conf - Main Configuration for Arch Linux # # @@ -16,7 +16,6 @@ HARDWARECLOCK="localtime" # HOSTNAME="myhost" - # # Module to load at boot-up (in this order) # (prefix a module with a ! to disable it) @@ -49,13 +48,10 @@ ROUTES=(!gateway) DAEMONS=(!pcmcia network crond inetd) # -# PCMCIA +# Load any configuration settings in /etc/conf.d # -# Should be either i82365 or tcic -PCIC=i82365 -PCIC_OPTS= -CORE_OPTS= -CARDMGR_OPTS= -SCHEME= +for cfg in /etc/conf.d/*; do + [ -r $cfg ] && source $cfg +done # End of file |