Changeset f25bf53 in bootscripts-embedded
- Timestamp:
- Jan 31, 2009, 10:18:40 AM (16 years ago)
- Branches:
- master
- Children:
- 4230d00
- Parents:
- fe1b471
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
LICENSE
rfe1b471 rf25bf53 1 Copyright (c) 2007 Jim Gifford and Ryan Oliver1 Copyright (c) 2007-2009 Jim Gifford and Ryan Oliver 2 2 3 3 Permission is hereby granted, free of charge, to any person obtaining -
clfs/rc.d/init.d/functions
rfe1b471 rf25bf53 11 11 check_status() 12 12 { 13 14 15 16 17 18 19 20 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" 21 21 } -
clfs/rc.d/init.d/network
rfe1b471 rf25bf53 10 10 11 11 if [ "$NETWORKING" != "yes" ]; then 12 13 12 echo "Networking is disabled in /etc/network.conf" 13 exit 0 14 14 fi 15 15 16 16 case "$1" in 17 17 start) 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 -b -i "$INTERFACE" \ 25 -p "/var/run/udhcpc.$INTERFACE.pid" \ 26 > /dev/null 27 else 28 echo -n "Setting up interface $INTERFACE: " 29 ifconfig "$INTERFACE" "$IPADDRESS" \ 30 netmask "$NETMASK" \ 31 broadcast "$BROADCAST" up 32 fi 33 check_status 34 fi 35 done 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 36 35 37 38 39 40 41 42 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 42 stop) 44 45 46 47 48 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 49 48 50 for i in /etc/network.d/interface.* 51 do 52 if [ -r "$i" ]; then 53 . $i 54 echo -n "Shutting down interface $INTERFACE: " 55 ifconfig $INTERFACE down 56 check_status 57 if [ "$DHCP" = "yes" ]; then 58 kill `cat "/var/run/udhcpc.$INTERFACE.pid"` 59 sleep 1 60 fi 61 fi 62 done 63 ;; 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 ;; 64 62 restart) 65 66 67 63 $0 stop 64 $0 start 65 ;; 68 66 status) 69 70 71 67 ifconfig 68 route 69 ;; 72 70 *) 73 74 71 echo "Usage: $0 {start|stop|restart|status}" 72 exit 1 75 73 esac -
clfs/rc.d/init.d/sshd
rfe1b471 rf25bf53 11 11 case "$1" in 12 12 start) 13 14 15 16 17 18 19 20 21 22 23 24 25 26 echo -n "StartingSSH server: "27 28 29 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 dropbear SSH server: " 27 dropbear 28 check_status 29 fi 30 ;; 31 31 stop) 32 33 34 35 36 37 38 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 ;; 40 40 restart) 41 42 43 41 $0 stop 42 $0 start 43 ;; 44 44 status) 45 46 47 48 49 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 ;; 51 51 *) 52 53 52 echo "Usage: $0 {start|stop|restart|status}" 53 exit 1 54 54 esac -
clfs/rc.d/init.d/syslog
rfe1b471 rf25bf53 10 10 case "$1" in 11 11 start) 12 13 14 15 16 17 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 ;; 19 19 stop) 20 21 22 23 24 25 26 20 echo -n "Stopping klogd: " 21 killall klogd 22 check_status 23 echo -n "Stopping syslogd: " 24 killall syslogd 25 check_status 26 ;; 27 27 restart) 28 29 30 28 $0 stop 29 $0 start 30 ;; 31 31 *) 32 33 32 echo "Usage: $0 {start|stop|restart}" 33 exit 1 34 34 esac -
clfs/rc.d/shutdown
rfe1b471 rf25bf53 10 10 echo 11 11 12 13 12 echo "Starting stop scripts." 14 13 15 for i in /etc/rc.d/stop/* 16 do 17 if [ -x $i ]; then 18 $i stop 19 fi 14 for i in /etc/rc.d/stop/*; do 15 if [ -x $i ]; then 16 $i stop 17 fi 20 18 done 21 19 -
clfs/rc.d/startup
rfe1b471 rf25bf53 20 20 fsck -T -C / 21 21 if [ "$?" -gt 2 ]; then 22 23 24 25 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 26 elif [ "$?" = "2" ]; then 27 28 29 27 echo "NOTICE: System needs to be rebooted now." 28 sleep 1 29 reboot 30 30 else 31 32 31 echo -n "Checking root filesystem: " 32 check_status 33 33 fi 34 34 … … 44 44 fsck -A -C -R -T -t nonfs,nosmbfs 45 45 if [ "$?" -gt 2 ]; then 46 47 48 49 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 50 elif [ "$?" = "2" ]; then 51 52 53 51 echo "NOTICE: System needs to be rebooted now." 52 sleep 1 53 reboot 54 54 else 55 56 55 echo -n "Checking local filesystems: " 56 check_status 57 57 fi 58 58 … … 82 82 echo "Running start scripts." 83 83 84 for i in /etc/rc.d/start/* 85 do 86 if [ -x $i ]; then 87 $i start 88 fi 84 for i in /etc/rc.d/start/*; do 85 if [ -x $i ]; then 86 $i start 87 fi 89 88 done
Note:
See TracChangeset
for help on using the changeset viewer.