summaryrefslogtreecommitdiff
path: root/package/base-files/src/etc/init.d/boot
blob: 2e7215fb8151680fff7c3eba384ec67d18202b62 (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
#!/bin/sh
#INIT 10
[[ $1 = autostart ]] || exit 0

. /etc/functions.sh

if [ -f /proc/sys/kernel/printk ];then
	echo 0 > /proc/sys/kernel/printk
fi

# remount /dev with smaller size
mount -o remount,nosuid,size=128k,mode=0755 -t tmpfs mdev /dev

# remount /tmp with smaller size
size=$(cat /etc/tmpfs 2>/dev/null)
[ -z $size ] && size=2048
mount -o remount,nosuid,nodev,mode=1777,size=${size}k -t tmpfs tmpfs /tmp

# start mdev dynamic device node management
echo >/dev/mdev.seq
echo "/sbin/mdev" >/proc/sys/kernel/hotplug
# creates f.e. /dev/root
mdev -s

# seed some random
cat /etc/.rnd >/dev/urandom 2>&1

# setup cfgfs
[ -x /sbin/cfgfs ] && { cfgfs setup; mount -o remount,ro /;} || mount -o remount,rw /

# create some useful directories in tmpfs
mkdir -p /var/log
mkdir -p /var/run
touch /var/log/lastlog
touch /var/log/wtmp
ln -s /tmp /var/tmp

HOSTNAME=
[[ -s /etc/hostname ]] && HOSTNAME=$(cat /etc/hostname)
HOSTNAME=${HOSTNAME%%.*}
echo ${HOSTNAME:=openadk} >/proc/sys/kernel/hostname

chown 0:0 /tmp; chmod 1777 /tmp

load_modules /etc/modules
for f in /etc/modules.d/*; do
	[[ -e $f ]] && load_modules /etc/modules.d/*
	break
done
exit 0