summaryrefslogtreecommitdiff
path: root/layout/initramfs/init
blob: 7c4c6811c8012b37cd31967b5b2ee45f417f745a (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
#!/command/execlineb -S0

# This initramfs is a stub. It just performs coldplug.
# Since our rootfs shouldn't require a coldplug to be found,
# we could do away with the initramfs, but we leave it as an example.

/command/export PATH /command
/command/cd /
if { s6-echo "\n  initramfs (minimal)\n" }

if { s6-mount -wt sysfs sys /sys }
if { s6-mount -wt proc proc /proc }
if { s6-mount -wt devtmpfs dev /dev }

if { pipeline { mdevd-coldplug } mdevd }

if { s6-mount -rt ext4 /dev/%%PARTITION%%1 /rootfs }

if { s6-mount -o move /sys /rootfs/sys }
if { s6-mount -o move /proc /rootfs/proc }
if { s6-mount -o move /dev /rootfs/dev }

cd /rootfs
./command/s6-envdir -I /etc/env
./command/if
{
  ./command/pipeline { ./command/s6-ls -a -x rootfs / }
  ./command/forstdin -p -d"\n" i
  ./command/importas -u i i
  ./command/s6-rmrf /${i}
}
./command/if { ./command/s6-mount -o move . / }
./command/s6-chroot .

./command/tryexec { /sbin/init $@ }
./command/tryexec { /bin/init $@ }
/etc/init $@