-
Notifications
You must be signed in to change notification settings - Fork 21
/
init
executable file
·41 lines (41 loc) · 1.21 KB
/
init
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
#!/bin/sh
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
mount -t tmpfs none /tmp
mount -t tmpfs none /var/run
mount -t hostfs -o $LOGDIR none /var/log
mount -t tmpfs none /var/lib/docker
mount -t proc none /proc
mkdir /dev/pts
mount -t devpts none /dev/pts
mkdir /dev/shm
mount -t tmpfs none /dev/shm
mount -t sysfs none /sys
mount -t tmpfs none /sys/fs/cgroup
for SUBSYS in memory devices cpuset
do
mkdir /sys/fs/cgroup/$SUBSYS
mount -t cgroup -o $SUBSYS none /sys/fs/cgroup/$SUBSYS
done
echo 1 > /proc/sys/net/ipv4/ip_forward
echo 0 > /proc/sys/kernel/printk
ip addr add 127.0.0.1 dev lo
ip link set lo up
ip addr add 10.1.1.1/24 dev eth0
ip link set eth0 up
ip route add default via 10.1.1.254
# This is to handle when /etc/resolv.conf -> /run/resolvconf/resolv.conf
[ -L /etc/resolv.conf ] && {
mkdir -p $(dirname $(readlink --canonicalize-missing /etc/resolv.conf))
[ -f /etc/resolv.conf ] || {
cat /var/log/resolv.conf > /etc/resolv.conf
}
}
[ -f /var/log/output ] && {
exec >>/var/log/output
exec 2>>/var/log/output
}
sh /var/log/cmd
echo $? >/var/log/status
# This will make sure that the main "tail" process had the opportunity
# to display everything before being killed by UML misbehavior.
sleep 1