Changeset 292c832 in bootscripts-embedded for clfs


Ignore:
Timestamp:
Jan 30, 2011, 10:13:21 AM (14 years ago)
Author:
Andrew Bradford <bradfa@…>
Branches:
master
Children:
73ee2a6
Parents:
5d96f6a
Message:

Imported updates of existing bootscripts

Imported bootscripts that already existed from clfs-embedded/bootscripts
as bootscripts should be kept in this repo rather than in the
clfs-embedded repo.

The script changes have NOT BEEN TESTED! (yet)
This is part of a cleanup of bootscripts.

Location:
clfs/rc.d
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • clfs/rc.d/init.d/functions

    r5d96f6a r292c832  
    1111check_status()
    1212{
    13   local ERR=$?
    14   echo -en "\\033[65G"
    15   if [ $ERR = 0 ]; then
    16     echo -en "\\033[1;32mOK"
    17   else
    18     echo -en "\\033[1;31mFAIL"
    19   fi
    20   echo -e "\\033[0;39m"
     13        local ERR=$?
     14        echo -en "\\033[65G"
     15        if [ $ERR = 0 ]; then
     16                echo -en "\\033[1;32mOK"
     17        else
     18                echo -en "\\033[1;31mFAIL"
     19        fi
     20        echo -e "\\033[0;39m"
    2121}
  • clfs/rc.d/init.d/network

    r5d96f6a r292c832  
    1010
    1111if [ "$NETWORKING" != "yes" ]; then
    12   echo "Networking is disabled in /etc/network.conf"
    13   exit 0
     12        echo "Networking is disabled in /etc/network.conf"
     13        exit 0
    1414fi
    1515
    1616case "$1" in
    1717start)
    18   for i in /etc/network.d/interface.*; do
    19     if [ -r "$i" ]; then
    20       . $i
    21       if [ "$DHCP" = "yes" ]; then
    22         echo -n "Starting DHCP for interface $INTERFACE: "
    23         udhcpc -b -i "$INTERFACE" \
    24           -p "/var/run/udhcpc.$INTERFACE.pid" \
    25           > /dev/null
    26       else
    27         echo -n "Setting up interface $INTERFACE: "
    28         ifconfig "$INTERFACE" "$IPADDRESS" \
    29           netmask "$NETMASK" \
    30           broadcast "$BROADCAST" up
    31       fi
    32         check_status
    33     fi
    34   done
     18        for i in /etc/network.d/interface.*
     19        do
     20                if [ -r "$i" ]; then
     21                        . $i
     22                        if [ "$DHCP" = "yes" ]; then
     23                                echo -n "Starting DHCP for interface $INTERFACE: "
     24                                # udhcpc is braindead, bring up interface first
     25                                ifconfig "$INTERFACE" up
     26
     27                                # Bridging code requires some time to wake up
     28                                [ "$INTERFACE" = "br0" ] && sleep 5
     29
     30                                udhcpc -b -i "$INTERFACE" -s /etc/udhcpc.conf \
     31                                        -p "/var/run/udhcpc.$INTERFACE.pid" \
     32                                        > /dev/null
     33                        else
     34                                echo -n "Setting up interface $INTERFACE: "
     35                                ifconfig "$INTERFACE" "$IPADDRESS" \
     36                                        netmask "$NETMASK" \
     37                                        broadcast "$BROADCAST" up
     38                        fi
     39                        check_status
     40                fi
     41        done
    3542       
    36   if [ "$USE_GATEWAY" = "yes" -a -n "$GATEWAY" ]; then
    37     echo -n "Setting default route: "
    38     route add default gw $GATEWAY
    39     check_status
    40   fi
    41 ;;
     43        if [ "$USE_GATEWAY" = "yes" -a -n "$GATEWAY" ]; then
     44                echo -n "Setting default route: "
     45                route add default gw $GATEWAY
     46                check_status
     47        fi
     48        ;;
    4249stop)
    43   if [ "$USE_GATEWAY" = "yes" -a -n "$GATEWAY" ]; then
    44     echo -n "Removing default route: "
    45     route del -net 0.0.0.0
    46     check_status
    47   fi
     50        if [ "$USE_GATEWAY" = "yes" -a -n "$GATEWAY" ]; then
     51                echo -n "Removing default route: "
     52                route del -net 0.0.0.0
     53                check_status
     54        fi
    4855
    49   for i in /etc/network.d/interface.*; do
    50     if [ -r "$i" ]; then
    51     . $i
    52     echo -n "Shutting down interface $INTERFACE: "
    53     ifconfig $INTERFACE down
    54     check_status
    55     if [ "$DHCP" = "yes" ]; then
    56       kill `cat "/var/run/udhcpc.$INTERFACE.pid"`
    57       sleep 1
    58     fi
    59   fi
    60   done
    61 ;;
     56        for i in /etc/network.d/interface.*
     57        do
     58                if [ -r "$i" ]; then
     59                        . $i
     60                        echo -n "Shutting down interface $INTERFACE: "
     61                        ifconfig $INTERFACE down
     62                        check_status
     63                        if [ "$DHCP" = "yes" ]; then
     64                                kill `cat "/var/run/udhcpc.$INTERFACE.pid"` 2>/dev/null || true
     65                                sleep 1
     66                        fi
     67                fi
     68        done
     69        ;;
    6270restart)
    63   $0 stop
    64   $0 start
    65 ;;
     71        $0 stop
     72        $0 start
     73        ;;
    6674status)
    67   ifconfig
    68   route
    69 ;;
     75        ifconfig
     76        route
     77        ;;
    7078*)
    71   echo "Usage: $0 {start|stop|restart|status}"
    72   exit 1
     79        echo "Usage: $0 {start|stop|restart|status}"
     80        exit 1
    7381esac
  • clfs/rc.d/init.d/sshd

    r5d96f6a r292c832  
    1111case "$1" in
    1212start)
    13   if [ ! -r "$DSSKEY" ]; then
    14     echo -n "Generating DSS host key: "
    15     dropbearkey -t dss -f "$DSSKEY" >/dev/null 2>&1
    16     check_status
    17   fi
    18   if [ ! -r "$RSAKEY" ]; then
    19     echo -n "Generating RSA host key: "
    20     dropbearkey -t rsa -f "$RSAKEY" >/dev/null 2>&1
    21     check_status
    22   fi
    23   if [ -r "$PIDFILE" ]; then
    24     echo "Service dropbear already running."
    25   else
    26     echo -n "Starting dropbear SSH server: "
    27     dropbear
    28     check_status
    29   fi
    30 ;;
     13        if [ ! -r "$DSSKEY" ]; then
     14                echo -n "Generating DSS host key: "
     15                dropbearkey -t dss -f "$DSSKEY" >/dev/null 2>&1
     16                check_status
     17        fi
     18        if [ ! -r "$RSAKEY" ]; then
     19                echo -n "Generating RSA host key: "
     20                dropbearkey -t rsa -f "$RSAKEY" >/dev/null 2>&1
     21                check_status
     22        fi
     23        if [ -r "$PIDFILE" ]; then
     24                echo "Service dropbear already running."
     25        else
     26                echo -n "Starting SSH server: "
     27                dropbear
     28                check_status
     29        fi
     30        ;;
    3131stop)
    32   if [ -r "$PIDFILE" ]; then
    33     echo -n "Stopping dropbear SSH server: "
    34     kill `cat "$PIDFILE"`
    35     check_status
    36   else
    37     echo "Service dropbear not running."
    38   fi
    39 ;;
     32        if [ -r "$PIDFILE" ]; then
     33                echo -n "Stopping dropbear SSH server: "
     34                kill `cat "$PIDFILE"`
     35                check_status
     36        else
     37                echo "Service dropbear not running."
     38        fi
     39        ;;
    4040restart)
    41   $0 stop
    42   $0 start
    43 ;;
     41        $0 stop
     42        $0 start
     43        ;;
    4444status)
    45   if [ -r "$PIDFILE" ]; then
    46     echo "Service dropbear running (PID $(cat "$PIDFILE"))."
    47   else
    48     echo "Service dropbear not running."
    49   fi
    50 ;;
     45        if [ -r "$PIDFILE" ]; then
     46                echo "Service dropbear running (PID $(cat "$PIDFILE"))."
     47        else
     48                echo "Service dropbear not running."
     49        fi
     50        ;;
    5151*)
    52   echo "Usage: $0 {start|stop|restart|status}"
    53   exit 1
     52        echo "Usage: $0 {start|stop|restart|status}"
     53        exit 1
    5454esac
  • clfs/rc.d/init.d/syslog

    r5d96f6a r292c832  
    66. /etc/rc.d/init.d/functions
    77
    8 SYSLOG_ROTATE_SIZE=80kb
     8SYSLOG_ROTATE_SIZE=65536
    99
    1010case "$1" in
    1111start)
    12   echo -n "Starting syslogd: "
    13   syslogd -m 0 -s $SYSLOG_ROTATE_SIZE -L
    14   check_status
    15   echo -n "Starting klogd: "
    16   klogd
    17   check_status
    18 ;;
     12        echo -n "Starting syslogd: "
     13        syslogd -m 0 -s $SYSLOG_ROTATE_SIZE -L
     14        check_status
     15        echo -n "Starting klogd: "
     16        klogd
     17        check_status
     18        ;;
    1919stop)
    20   echo -n "Stopping klogd: "
    21   killall klogd
    22   check_status
    23   echo -n "Stopping syslogd: "
    24   killall syslogd
    25   check_status
    26 ;;
     20        echo -n "Stopping klogd: "
     21        killall klogd
     22        check_status
     23        echo -n "Stopping syslogd: "
     24        killall syslogd
     25        check_status
     26        ;;
    2727restart)
    28   $0 stop
    29   $0 start
    30 ;;
     28        $0 stop
     29        $0 start
     30        ;;
    3131*)
    32   echo "Usage: $0 {start|stop|restart}"
    33   exit 1
     32        echo "Usage: $0 {start|stop|restart}"
     33        exit 1
    3434esac
  • clfs/rc.d/shutdown

    r5d96f6a r292c832  
    1010echo
    1111
     12
    1213echo "Starting stop scripts."
    1314
    14 for i in /etc/rc.d/stop/*; do
    15   if [ -x $i ]; then
    16     $i stop
    17   fi
     15for i in /etc/rc.d/stop/*
     16do
     17        if [ -x $i ]; then
     18                $i stop
     19        fi
    1820done
    1921
    20 echo -n "Syncing hardware clock to system clock:"
    21 hwclock --systohc --utc
    22 check_status
     22if [ -x /sbin/hwclock ] && [ -e /dev/rtc ]; then
     23        echo -n "Syncing hardware clock to system clock:"
     24        hwclock --systohc --utc
     25        check_status
     26fi
    2327
    24 echo -n "Disabling swap space: "
    25 swapoff -a
    26 check_status
     28if [ -x /sbin/swapoff ]; then
     29        echo -n "Disabling swap space: "
     30        swapoff -a
     31        check_status
     32fi
    2733
    2834echo -n "Syncing all filesystems: "
     
    3238echo -n "Unmounting all filesystems: "
    3339umount -a -r
     40
  • clfs/rc.d/startup

    r5d96f6a r292c832  
    77/bin/mount -t proc none /proc
    88/bin/mount -t sysfs none /sys
     9/bin/mount -t tmpfs /tmp /tmp
    910/bin/mount -t tmpfs -o mode=0755 none /dev
    1011/bin/mkdir /dev/pts
    1112/bin/mkdir /dev/shm
     13/bin/mount -t tmpfs -o mode=0755 /var /var
     14for x in cache lib lib/misc lib/locate local lock log mail opt run spool; do mkdir /var/$x; done
     15ln -s ../tmp /var/tmp
     16
    1217/bin/echo "/sbin/mdev" > /proc/sys/kernel/hotplug
     18
     19echo -n "Starting mdev: "
    1320/sbin/mdev -s
    14 
    15 echo -n "Setting system clock: "
    16 hwclock --hctosys --utc
    17 check_status
    18 
    19 echo "Starting fsck for root filesystem."
    20 fsck -T -C /
    21 if [ "$?" -gt 2 ]; then
    22   echo "WARNING: Errors found while checking root filesystem."
    23   echo "You can login as root now, the system will reboot after logout."
    24   sulogin
    25   reboot
    26 elif [ "$?" = "2" ]; then
    27   echo "NOTICE: System needs to be rebooted now."
    28   sleep 1
    29   reboot
    30 else
    31   echo -n "Checking root filesystem: "
    32   check_status
    33 fi
    34 
    35 echo -n "Remounting root rw: "
    36 mount -o remount,rw /
    3721check_status
    3822
     
    4125check_status
    4226
    43 echo "Starting fsck for local filesystems."
    44 fsck -A -C -R -T -t nonfs,nosmbfs
    45 if [ "$?" -gt 2 ]; then
    46   echo "WARNING: Errors found while checking filesystems."
    47   echo "You can login as root now, the system will reboot after logout."
    48   sulogin
    49   reboot
    50 elif [ "$?" = "2" ]; then
    51   echo "NOTICE: System needs to be rebooted now."
    52   sleep 1
    53   reboot
    54 else
    55   echo -n "Checking local filesystems: "
    56   check_status
     27if [ -x /sbin/hwclock ] && [ -e /dev/rtc ]; then
     28        echo -n "Setting system clock: "
     29        hwclock --hctosys --utc
     30        check_status
    5731fi
    5832
    59 echo -n "Enabling swap space: "
    60 swapon -a
     33if [ -x /sbin/fsck ]; then
     34        echo "Starting fsck for local filesystems."
     35        fsck -A -C -R -T -t nonfs,nosmbfs
     36        if [ "$?" -gt 2 ]; then
     37                echo "WARNING: Errors found while checking filesystems."
     38                echo "You can login as root now, the system will reboot after logout."
     39                sulogin
     40                reboot
     41        elif [ "$?" = "2" ]; then
     42                echo "NOTICE: System needs to be rebooted now."
     43                sleep 1
     44                reboot
     45        else
     46                echo -n "Checking local filesystems: "
     47                check_status
     48        fi
     49fi
     50
     51
     52if [ -x /sbin/swapon ]; then
     53        echo -n "Enabling swap space: "
     54        swapon -a
     55        check_status
     56fi
     57
     58echo -n "Remounting root rw: "
     59mount -o remount,rw /
    6160check_status
    6261
     
    8281echo "Running start scripts."
    8382
    84 for i in /etc/rc.d/start/*; do
    85   if [ -x $i ]; then
    86     $i start
    87   fi
     83for i in /etc/rc.d/start/*
     84do
     85        if [ -x $i ]; then
     86                $i start
     87        fi
    8888done
     89
     90exit 0
Note: See TracChangeset for help on using the changeset viewer.