Minor cleanup
[rrq/tiniest.git] / init / init
1 #!/bin/sh
2 #
3 # This script is intended to be interpreted by busybox sh.
4 echo
5 echo "Starting..."
6 echo
7
8 mkdir /cdrom /target /mnt
9
10 for M in proc:/proc devtmpfs:/dev devpts:/dev/pts sysfs:/sys ; do
11     mkdir -p ${M##*:}
12     mount -t ${M%%:*} ${M%%:*} ${M##*:}
13 done
14
15 modprobe loop max_part=15
16 cat <<EOF | xargs -n1 modprobe
17 ata_piix sd_mod sr_mod isofs vfat xhci-pci usb_storage exfat ext4
18 EOF
19 #--- Automatic:
20 # cdrom t10_pi crc64_rocksoft crc64 crc_t10dif crct10dif_common libata
21 # scsi_mod scsi_common
22 #--- Other, not used:
23 # ata_generic nls_cp437 nls_ascii sg
24 #  ext4 jbd2 mbcache crc16
25 #-- input
26 # psmouse evdev
27 #-- network
28 # e1000
29
30 sleep 2
31 echo
32 echo "Hi there ..."
33 echo
34
35 exec setsid cttyhack sh -i
36 ###################################
37
38 if mount LABEL=TINNIE /target ; then
39     exec setsid cttyhack sh -i
40     exec switch_root -c /dev/console /target /init
41 fi
42
43 mount LABEL=TINIEST /cdrom
44 mount -t ramfs -o size=1G initrd /target
45
46 gunzip < $(find /cdrom -name initrd.gz ) | ( cd /target && cpio -i )
47 exec setsid cttyhack sh -i
48 ###################################
49 exec /bin/sh
50 exec switch_root -c /dev/console /target /init