PACKAGES += bilibop-lockfs live-boot live-boot-initramfs-tools
-.PHONY: _live_lockfs _live_sudo _live_sudo_users _live_modules
+.PHONY: _live_lockfs _live_sudo _live_sudo_users _live_modules _live
ifdef users
_config: _live_sudo_users
for u in $(subst ${comma_},${space_},${users}); do \
chroot "$${CFGROOT}" adduser "$$u" sudo; \
done
+
+_config: _live
+_live: ${CFGROOT} modules/live/
+ cp -a modules/live/. "$${CFGROOT}"
--- /dev/null
+#!/bin/sh
+
+if [ ! "$DISPLAY" ]; then
+ export DEBIAN_FRONTEND=newt
+fi
+
+# Find n debian-installer initrd, preferably the gtk one
+for IMAGE in /run/live/medium/install/gtk/initrd.gz /run/live/medium/install/text/initrd.gz ""; do
+ [ -e "$IMAGE" ] && break
+done
+if [ ! "$IMAGE" ]; then
+ echo "no suitable d-i initrd image found, aborting."
+ return 1
+fi
+
+echo "Loading debian-installer..."
+
+# Create the temporary directory and mount a tmpfs on it to ease cleanup
+mkdir -p /run/live/installer
+mount -t tmpfs none /run/live/installer
+
+# Unpack the initrd
+zcat "$IMAGE" \
+| ( cd /run/live/installer; cpio -id ) >/dev/null 2>&1
+
+# Preseeding shutdown command
+cat >>/run/live/installer/preseed.cfg <<-EOF
+ # Select udeb for installation to allow exiting the installer
+ d-i anna/choose_modules string di-utils-exit-installer apt-cdrom-udeb
+ # Ask question regardless from that it's preseeded above
+ d-i anna/choose_modules seen false
+ # Skip the exit timeout
+ d-i di-utils-reboot/really_reboot boolean false
+ EOF
+
+# Preseeding installer expert mode
+if [ "$EXPERT" = true ]; then
+ cat >>/run/live/installer/preseed.cfg <<-EOF
+ # Setting expert mode
+ d-i debconf/priority select low
+ debconf debconf/priority select low
+ EOF
+fi
+
+# Bindmount installer media
+mkdir -p /run/live/installer/cdrom
+mount -o bind /run/live/medium /run/live/installer/cdrom
+
+mkdir -p /run/live/installer/lib/modules/"$(uname -r)"
+mount -o bind /lib/modules/"$(uname -r)" /run/live/installer/lib/modules/"$(uname -r)"
+
+# Bindmount filesytem
+for fs in /dev /dev/pts /proc /sys /tmp; do
+ mount -o bind $fs /run/live/installer/$fs
+done
+
+# xhost +local:
+export LIVE_INSTALLER_MODE=1 GTK_MODULES=gail:atk-bridge
+
+chroot /run/live/installer/ mount /run
+chroot /run/live/installer/ mkdir /run/lock/
+chroot /run/live/installer/ /sbin/debian-installer-startup
+chroot /run/live/installer/ /sbin/debian-installer
+
+fuser -k /run/live/installer/bin/busybox >/dev/null 2>&1 || true
+
+# Remove unpacked initrd
+umount -l /run/live/installer
+rm -f /tmp/debian-installer