]> git.plutz.net Git - blast/commitdiff
desktop launcher for live system installer
authorPaul Hänsch <paul@plutz.net>
Sat, 1 Nov 2025 12:18:09 +0000 (13:18 +0100)
committerPaul Hänsch <paul@plutz.net>
Sat, 1 Nov 2025 12:18:09 +0000 (13:18 +0100)
modules/live.mk
modules/live/usr/local/sbin/debinstall [new file with mode: 0755]
modules/live/usr/local/sbin/debinstall-pkexec [new file with mode: 0755]
modules/live/usr/local/share/applications/debian-installer-launcher.desktop [new file with mode: 0644]

index fcf2a9eff6a2b2ad67a2c98225986c4dc182af51..afd824fa656e00eaaf8ad0b8e4ee7c40e7506236 100644 (file)
@@ -1,6 +1,6 @@
 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
@@ -32,3 +32,7 @@ _live_sudo_users: _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}"
diff --git a/modules/live/usr/local/sbin/debinstall b/modules/live/usr/local/sbin/debinstall
new file mode 100755 (executable)
index 0000000..3573d71
--- /dev/null
@@ -0,0 +1,69 @@
+#!/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
diff --git a/modules/live/usr/local/sbin/debinstall-pkexec b/modules/live/usr/local/sbin/debinstall-pkexec
new file mode 100755 (executable)
index 0000000..eb6ed69
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh
+pkexec env DISPLAY="$DISPLAY" WAYLAND_DISPLAY="$WAYLAND_DISPLAY" /usr/local/sbin/debinstall "$@"
diff --git a/modules/live/usr/local/share/applications/debian-installer-launcher.desktop b/modules/live/usr/local/share/applications/debian-installer-launcher.desktop
new file mode 100644 (file)
index 0000000..9445fe4
--- /dev/null
@@ -0,0 +1,14 @@
+[Desktop Entry]
+Version=1.0
+Name=Install Debian
+Name[fr]=Installer Debian
+Name[da]=Installer Debian
+Comment=Install this system permanently to your hard disk
+Comment[fr]=Installer ce système de manière permanente sur votre disque dur
+Comment[da]=Installer dette system permanent på din harddisk
+Exec=/usr/local/sbin/debinstall-pkexec
+Icon=debian-logo
+Type=Application
+Categories=Application;System;
+StartupNotify=true
+Terminal=false