summaryrefslogtreecommitdiffstats
path: root/init.d/rcS
blob: 1fa1a86f330b98769b0d1eb2874c74da488ee47e (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
#!/bin/busybox sh

# we need the proc to be able to install busybox
/bin/busybox mkdir -p /proc /usr/sbin /sys
/bin/busybox mount -t proc -o noexec,nosuid,nodev proc /proc
/bin/busybox mount -t sysfs -o noexec,nosuid,nodev sysfs /sys

# install busybox links
/bin/busybox --install -s

[ -f /etc/alpine-release ] && read RELEASE BUILD < /etc/alpine-release
echo "Starting $RELEASE"

export PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin

# use dash if it exists
[ -x /bin/dash ] && ln -sf /bin/dash /bin/sh

# define some default variables
export DEFAULT_CFG_MOUNTS="/media/cdrom /media/floppy /media/usb"
export DEFAULT_ALPINE_CONF="/alpine.conf"
export DEFAULT_ALPINE_PACKAGES="/packages.conf"
export DEFAULT_PKG_PATH="cdrom://apks"

# start an rc script. Look if there are a no<service> in /proc/cmdline
start_script() {
	local n
	if [ -f $1 ] ; then
		for n in `cat /proc/cmdline`; do
			[ "$n" = "s" ] && SINGLEMODE=yes
			case $1 in
				S??no$n)	return 1;;
			esac
		done
		case $1 in
			*.sh)	. $1 start;;
			*)	$1 start;;
		esac
	fi
}

# hide kernel messages
dmesg -n 1

for i in `cat /proc/cmdline` ;do
	case $i in
		1|s|single)
			echo "Entering single mode. Type 'exit' to continue booting."
			sh
			;;
	esac
done		

# Run all /etc/rcS.d scripts
for j in /etc/rcS.d/S* ; do
	start_script $j
done
exit 0