Dash:
[t2-trunk.git] / target / share / initrd / rootfs / init
bloba3cf0c1e0d355eff84d805dfb5fd58702ea46ec1
1 #!/bin/sh
3 echo "T2 SDE early (initrd) userspace (C) 2005 - 2017 Rene Rebe, ExactCODE"
5 PATH=/sbin:/bin:/usr/bin:/usr/sbin
7 echo "Mounting /dev, /proc and /sys ..."
8 mount -t devtmpfs -o mode=755 none /dev
9 mount -t proc none /proc
10 mount -t sysfs none /sys
11 ln -s /proc/self/fd /dev/fd
13 echo "Populating u/dev ..."
14 mknod /dev/null c 1 3
15 mknod /dev/zero c 1 5
16 udevd &
17 udevadm trigger
18 udevadm settle
19 [ -e /dev/console ] || mknod /dev/console c 5 1
20 [ -e /dev/tty ] || mknod /dev/tty c 5 0
22 init="init= `cat /proc/cmdline`" ; init=${init##*init=} ; init=${init%% *}
23 # TODO: later on search other places if we want 100% backward compat.
24 [ "$init" ] || init=/sbin/init
25 if [ -f $init ]; then
26 kill %1
27 exec $init $*
30 echo "No init found, giving up. Debug shell:"
31 exec sh --login