summaryrefslogtreecommitdiffstats
path: root/init.sh
diff options
context:
space:
mode:
Diffstat (limited to 'init.sh')
-rw-r--r--init.sh43
1 files changed, 43 insertions, 0 deletions
diff --git a/init.sh b/init.sh
new file mode 100644
index 0000000..5bafbff
--- /dev/null
+++ b/init.sh
@@ -0,0 +1,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_10_GNOME_3 /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