File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2222 init = writeScript "init" ''
2323 #! /bin/ash -e
2424
25- export PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/ bin:/sbin
25+ export PATH=/bin:/sbin
2626 mkdir -p /proc /sys /dev
2727 mount -t proc none /proc
2828 mount -t sysfs none /sys
6464 ifconfig lo up
6565 udhcpc
6666
67- setsid cttyhack /bin/sh
67+ if [ -e /dev/vda ]; then
68+ exec setsid cttyhack /init2
69+ else
70+ exec setsid cttyhack /bin/sh
71+ fi
72+ '' ;
73+
74+ init2 = writeScript "init2" ''
75+ #! /bin/ash -e
76+
77+ export PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin
78+
79+ mkdir -p /new_root
80+ mount -t tmpfs tmpfs /new_root
81+ mkdir -p /new_root/lower /new_root/upper /new_root/work /new_root/merged
82+ mount -t squashfs /dev/vda /new_root/lower
83+
84+ mount -t overlay overlay -o lowerdir=/new_root/lower,upperdir=/new_root/upper,workdir=/new_root/work /new_root/merged
85+ mount --move /proc /new_root/merged/proc
86+ mount --move /dev /new_root/merged/dev
87+ mount --move /sys /new_root/merged/sys
88+ mount --move /run /new_root/merged/run
89+ mount --move /tmp /new_root/merged/tmp
90+ mount --move /mnt /new_root/merged/mnt
91+
92+ touch /new_root/merged/etc/resolv.conf
93+ mount --bind /etc/resolv.conf /new_root/merged/etc/resolv.conf
94+
95+ exec switch_root /new_root/merged /bin/sh
6896 '' ;
6997
7098 initrd = makeInitrd {
75103 object = init ;
76104 symlink = "/init" ;
77105 }
106+ {
107+ object = init2 ;
108+ symlink = "/init2" ;
109+ }
78110 {
79111 object = rootfs + "/bin" ;
80112 symlink = "/bin" ;
You can’t perform that action at this time.
0 commit comments