rc.init (2552B)
1 #!/bin/sh 2 3 umask 022 4 5 . /etc/rc.conf 6 7 echo 8 echo 9 echo " Morpheus booting" 10 echo 11 echo 12 13 # Soft reboot on ctrl-alt-del 14 /bin/ctrlaltdel -s 15 16 /bin/mount -n -t proc -o nosuid,noexec,nodev proc /proc 17 /bin/mount -n -t sysfs -o nosuid,noexec,nodev sysfs /sys 18 19 /bin/mount -n -t tmpfs -o nosuid,mode=0755 dev /dev 20 /bin/mkdir -p /dev/pts 21 /bin/mount -n -t devpts -o gid=5,mode=0620 devpts /dev/pts 22 23 /bin/grep -q " verbose" /proc/cmdline && dmesg -n 8 || dmesg -n 3 24 25 /bin/mount -o remount,ro / 26 27 echo Running smdev 28 /bin/smdev -s 29 30 echo Setting smdev as the kernel hotplug 31 echo /bin/smdev > /proc/sys/kernel/hotplug 32 33 # HACK! 34 cd /dev 35 /bin/ln -sf /proc/self/fd/0 stdin 36 /bin/ln -sf /proc/self/fd/1 stdout 37 /bin/ln -sf /proc/self/fd/2 stderr 38 /bin/ln -sf /proc/self/fd fd 39 cd - 1>/dev/null 40 41 echo Checking filesystems 42 /bin/fsck -ATa 43 if [ $? -eq 1 ]; then 44 echo Filesystem errors exist, fix manually. 45 /bin/sh 46 /bin/halt -r 47 fi 48 49 echo Remounting root as read-write 50 /bin/mount -o remount,rw / 51 52 echo Mounting filesystems 53 /bin/mount -a 54 55 ln -sf /proc/mounts /etc/mtab 56 57 echo "Setting hostname to $HOSTNAME" 58 /bin/hostname $HOSTNAME 59 60 echo Bringing up the lo interface 61 /bin/ip addr add 127.0.0.1/8 dev lo broadcast + scope host 62 /bin/ip link set lo up 63 64 HWCLOCK_PARAMS="-s" 65 case $HARDWARECLOCK in 66 "") 67 ;; 68 UTC) 69 HWCLOCK_PARAMS="-u $HWCLOCK_PARAMS" 70 ;; 71 localtime) 72 HWCLOCK_PARAMS="-l $HWCLOCK_PARAMS" 73 ;; 74 *) 75 HWCLOCK_PARAMS="" 76 ;; 77 esac 78 79 if [ -n "$HWCLOCK_PARAMS" ]; then 80 echo Setting hwclock 81 [ -n "$TIMEZONE" ] && export TZ="$TIMEZONE" 82 /bin/hwclock $HWCLOCK_PARAMS /dev/rtc0 83 unset TZ 84 fi 85 86 echo Setting random seed 87 [ -f /etc/random-seed ] && /bin/cat /etc/random-seed >/dev/urandom 88 /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2>/dev/null 89 90 echo Storing dmesg output to /var/log/dmesg.log 91 /bin/dmesg > /var/log/dmesg.log 92 if [ -e /proc/sys/kernel/dmesg_restrict ] && [ $(/bin/cat /proc/sys/kernel/dmesg_restrict) = "1" ]; 93 then 94 /bin/chmod 0600 /var/log/dmesg.log 95 else 96 /bin/chmod 0644 /var/log/dmesg.log 97 fi 98 99 echo Enabling core dumps 100 ulimit -c unlimited 101 102 if [ -x /bin/rc.modules ]; then 103 echo Running rc.modules 104 /bin/rc.modules 105 fi 106 107 if [ -x /bin/rc.svc ]; then 108 echo Running rc.svc 109 /bin/rc.svc 110 fi 111 112 if [ -x /bin/rc.local ]; then 113 echo Running rc.local 114 /bin/rc.local 115 fi 116 117 : > /var/run/utmp 118 119 echo 120 /bin/sh -c '/bin/respawn /bin/getty /dev/tty1 linux' &>/dev/null & 121 /bin/sh -c '/bin/respawn /bin/getty /dev/tty2 linux' &>/dev/null & 122 /bin/sh -c '/bin/respawn /bin/getty /dev/tty3 linux' &>/dev/null & 123 /bin/sh -c '/bin/respawn /bin/getty /dev/tty4 linux' &>/dev/null &