summaryrefslogtreecommitdiff
path: root/sinit/rc.init
blob: aab00738d42c60590dbf47fc8d6039144a811121 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/sh
umask 022

. /etc/rc.conf

echo "CRUX booting"

/bin/mount -n -t proc -o nosuid,noexec,nodev proc /proc
/bin/mount -n -t sysfs -o nosuid,noexec,nodev sysfs /sys

/bin/mount -n -t tmpfs -o nosuid,mode=0755 dev /dev
/bin/mkdir -p /dev/pts
/bin/mount -n -t devpts -o gid=5,mode=0620 devpts /dev/pts

/bin/mount -o remount,ro /

echo Running smdev
/bin/smdev -s

echo Setting smdev as the kernel hotplug
echo /bin/smdev >/proc/sys/kernel/hotplug

cd /dev
/bin/ln -sf /proc/self/fd/0 stdin
/bin/ln -sf /proc/self/fd/1 stdout
/bin/ln -sf /proc/self/fd/2 stderr
/bin/ln -sf /proc/self/fd fd
cd - >/dev/null

echo Checking filesystems
/bin/fsck -ATa
if [ $? -eq 1 ]; then
	echo Filesystems error exist, fix manually.
	/bin/sh
	/bin/halt -r
fi

echo Remounting root as read-write
/bin/mount -o remount,rw /

echo Mounting filesystems
/bin/mount -a

/bin/hostname $HOSTNAME

echo Bringing up loopback
/bin/ip addr add 127.0.0.1/8 dev lo broadcast + scope host
/bin/ip link set lo up

echo Setting hwclock
[ -n "$TIMEZONE" ] && export TZ="$TIMEZONE"
/bin/hwclock -s -u /dev/rtc0
unset TZ

[ -f /etc/random-seed ] && /bin/cat /etc/random-seed >/dev/urandom
/bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2>/dev/null

echo Enabling core dumps
ulimit -c unlimited

if [ -x /etc/rc.local ]; then
	echo Running rc.local
	/etc/rc.local
fi

: >/var/run/utmp

echo
/bin/sh -c '/bin/respawn /bin/getty /dev/tty1 linux' &>/dev/null &
/bin/sh -c '/bin/respawn /bin/getty /dev/tty2 linux' &>/dev/null &
/bin/sh -c '/bin/respawn /bin/getty /dev/tty3 linux' &>/dev/null &
/bin/sh -c '/bin/respawn /bin/getty /dev/tty4 linux' &>/dev/null &