Changeset 292c832 in bootscripts-embedded
- Timestamp:
- Jan 30, 2011, 10:13:21 AM (14 years ago)
- Branches:
- master
- Children:
- 73ee2a6
- Parents:
- 5d96f6a
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
Makefile
r5d96f6a r292c832 1 VERSION := 1.0-pre 41 VERSION := 1.0-pre5 2 2 3 3 ETCDIR := /etc … … 12 12 @echo "Select an appropriate install target from the above list" ; exit 1 13 13 14 .PHONY: dist15 14 dist: 16 rm -rf "dist/ bootscripts-clfs-embedded-$(VERSION)"17 mkdir -p "dist/ bootscripts-clfs-embedded-$(VERSION)"18 tar --exclude dist -c * | tar -x -C "dist/ bootscripts-clfs-embedded-$(VERSION)"19 (cd dist; tar -cjf " bootscripts-clfs-embedded-$(VERSION).tar.bz2" "bootscripts-clfs-embedded-$(VERSION)")20 rm -rf "dist/ bootscripts-clfs-embedded-$(VERSION)"15 rm -rf "dist/clfs-embedded-bootscripts-$(VERSION)" 16 mkdir -p "dist/clfs-embedded-bootscripts-$(VERSION)" 17 tar --exclude dist -c * | tar -x -C "dist/clfs-embedded-bootscripts-$(VERSION)" 18 (cd dist; tar -cjf "clfs-embedded-bootscripts-$(VERSION).tar.bz2" "clfs-embedded-bootscripts-$(VERSION)") 19 rm -rf "dist/clfs-embedded-bootscripts-$(VERSION)" 21 20 22 21 create-dirs: … … 29 28 install -m ${MODE} clfs/rc.d/init.d/network ${EXTDIR}/rc.d/init.d/ 30 29 install -m ${MODE} clfs/rc.d/init.d/syslog ${EXTDIR}/rc.d/init.d/ 30 install -m ${MODE} clfs/rc.d/init.d/bridge ${EXTDIR}/rc.d/init.d/ 31 31 ln -sf ../init.d/syslog ${EXTDIR}/rc.d/start/S05syslog 32 32 ln -sf ../init.d/syslog ${EXTDIR}/rc.d/stop/K99syslog 33 33 ln -sf ../init.d/network ${EXTDIR}/rc.d/start/S10network 34 34 ln -sf ../init.d/network ${EXTDIR}/rc.d/stop/K80network 35 ln -sf ../init.d/bridge ${EXTDIR}/rc.d/start/S09bridge 36 ln -sf ../init.d/bridge ${EXTDIR}/rc.d/stop/K81bridge 37 38 install-bcm47xx: create-dirs 39 install -m ${MODE} clfs/rc.d/init.d/bcm47xx-switch ${EXTDIR}/rc.d/init.d/ 40 ln -sf ../init.d/bcm47xx-switch ${EXTDIR}/rc.d/start/S08bcm47xx-switch 41 ln -sf ../init.d/bcm47xx-switch ${EXTDIR}/rc.d/stop/K82bcm47xx-switch 35 42 36 43 install-dropbear: create-dirs … … 39 46 ln -sf ../init.d/sshd ${EXTDIR}/rc.d/stop/K30sshd 40 47 41 .PHONY: all create-dirs install install-dropbear 48 install-hostapd: create-dirs 49 install -m ${MODE} clfs/rc.d/init.d/hostapd ${EXTDIR}/rc.d/init.d 50 ln -sf ../init.d/hostapd ${EXTDIR}/rc.d/start/S08hostapd 51 ln -sf ../init.d/hostapd ${EXTDIR}/rc.d/stop/K82hostapd 52 53 .PHONY: dist all create-dirs install install-bcm47xx install-dropbear \ 54 install-hostapd -
clfs/rc.d/init.d/functions
r5d96f6a r292c832 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
r5d96f6a r292c832 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.*; 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 35 42 36 37 38 39 40 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 ;; 42 49 stop) 43 44 45 46 47 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 48 55 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 ;; 62 70 restart) 63 64 65 ;;71 $0 stop 72 $0 start 73 ;; 66 74 status) 67 68 69 ;;75 ifconfig 76 route 77 ;; 70 78 *) 71 72 79 echo "Usage: $0 {start|stop|restart|status}" 80 exit 1 73 81 esac -
clfs/rc.d/init.d/sshd
r5d96f6a r292c832 11 11 case "$1" in 12 12 start) 13 14 15 16 17 18 19 20 21 22 23 24 25 26 echo -n "Starting dropbearSSH 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 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
r5d96f6a r292c832 6 6 . /etc/rc.d/init.d/functions 7 7 8 SYSLOG_ROTATE_SIZE= 80kb8 SYSLOG_ROTATE_SIZE=65536 9 9 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
r5d96f6a r292c832 10 10 echo 11 11 12 12 13 echo "Starting stop scripts." 13 14 14 for i in /etc/rc.d/stop/*; do 15 if [ -x $i ]; then 16 $i stop 17 fi 15 for i in /etc/rc.d/stop/* 16 do 17 if [ -x $i ]; then 18 $i stop 19 fi 18 20 done 19 21 20 echo -n "Syncing hardware clock to system clock:" 21 hwclock --systohc --utc 22 check_status 22 if [ -x /sbin/hwclock ] && [ -e /dev/rtc ]; then 23 echo -n "Syncing hardware clock to system clock:" 24 hwclock --systohc --utc 25 check_status 26 fi 23 27 24 echo -n "Disabling swap space: " 25 swapoff -a 26 check_status 28 if [ -x /sbin/swapoff ]; then 29 echo -n "Disabling swap space: " 30 swapoff -a 31 check_status 32 fi 27 33 28 34 echo -n "Syncing all filesystems: " … … 32 38 echo -n "Unmounting all filesystems: " 33 39 umount -a -r 40 -
clfs/rc.d/startup
r5d96f6a r292c832 7 7 /bin/mount -t proc none /proc 8 8 /bin/mount -t sysfs none /sys 9 /bin/mount -t tmpfs /tmp /tmp 9 10 /bin/mount -t tmpfs -o mode=0755 none /dev 10 11 /bin/mkdir /dev/pts 11 12 /bin/mkdir /dev/shm 13 /bin/mount -t tmpfs -o mode=0755 /var /var 14 for x in cache lib lib/misc lib/locate local lock log mail opt run spool; do mkdir /var/$x; done 15 ln -s ../tmp /var/tmp 16 12 17 /bin/echo "/sbin/mdev" > /proc/sys/kernel/hotplug 18 19 echo -n "Starting mdev: " 13 20 /sbin/mdev -s 14 15 echo -n "Setting system clock: "16 hwclock --hctosys --utc17 check_status18 19 echo "Starting fsck for root filesystem."20 fsck -T -C /21 if [ "$?" -gt 2 ]; then22 echo "WARNING: Errors found while checking root filesystem."23 echo "You can login as root now, the system will reboot after logout."24 sulogin25 reboot26 elif [ "$?" = "2" ]; then27 echo "NOTICE: System needs to be rebooted now."28 sleep 129 reboot30 else31 echo -n "Checking root filesystem: "32 check_status33 fi34 35 echo -n "Remounting root rw: "36 mount -o remount,rw /37 21 check_status 38 22 … … 41 25 check_status 42 26 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 27 if [ -x /sbin/hwclock ] && [ -e /dev/rtc ]; then 28 echo -n "Setting system clock: " 29 hwclock --hctosys --utc 30 check_status 57 31 fi 58 32 59 echo -n "Enabling swap space: " 60 swapon -a 33 if [ -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 49 fi 50 51 52 if [ -x /sbin/swapon ]; then 53 echo -n "Enabling swap space: " 54 swapon -a 55 check_status 56 fi 57 58 echo -n "Remounting root rw: " 59 mount -o remount,rw / 61 60 check_status 62 61 … … 82 81 echo "Running start scripts." 83 82 84 for i in /etc/rc.d/start/*; do 85 if [ -x $i ]; then 86 $i start 87 fi 83 for i in /etc/rc.d/start/* 84 do 85 if [ -x $i ]; then 86 $i start 87 fi 88 88 done 89 90 exit 0
Note:
See TracChangeset
for help on using the changeset viewer.