-
Notifications
You must be signed in to change notification settings - Fork 2
/
init.sh.in
43 lines (32 loc) · 978 Bytes
/
init.sh.in
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
42
43
#!/bin/sh
PATH='/rescue'
if [ "$(ps -o command 1 | tail -n 1 | ( read -r _ o; printf %s "$o" ))" = "-s" ]; then
echo '==> Running in single-user mode'
SINGLE_USER='true'
fi
echo '==> Remount rootfs as read-write'
mount -u -w /
echo '==> Make mountpoints'
mkdir -p /cdrom /memdisk /sysroot
echo '==> Mount cdrom'
mount_cd9660 /dev/iso9660/@VOLUME@ /cdrom
mdmfs -P -F /cdrom/data/system.uzip -o ro md.uzip /sysroot
if [ "$SINGLE_USER" = 'true' ]; then
echo -n 'Enter memdisk size used for read-write access in the live system: '
read -r MEMDISK_SIZE
else
MEMDISK_SIZE='256'
fi
echo '==> Mount swap-based memdisk'
mdmfs -s "${MEMDISK_SIZE}m" md /memdisk || exit 1
mount -t unionfs /memdisk /sysroot
mkdir -p /sysroot/mnt/cdrom
mount_nullfs -o ro /cdrom /sysroot/mnt/cdrom
echo '==> Mount devfs'
mount -t devfs devfs /sysroot/dev
if [ "$SINGLE_USER" = 'true' ]; then
echo 'Starting interactive shell in temporary rootfs ...'
sh
fi
kenv init_shell='/bin/sh'
exit 0