summaryrefslogtreecommitdiffstats
path: root/init.sh
blob: dcf149158bc8c9354aa998ac9fc4c2611b4638df (plain) (blame)
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 c o; echo ${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/FREEBSD_LIVE_10_1_GNOME_3_15_92 /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 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