From 54f23bdd24c16fb35670f7126806f347aec2b394 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Paul=20H=C3=A4nsch?= Date: Sat, 1 Nov 2025 13:18:09 +0100 Subject: [PATCH] desktop launcher for live system installer --- modules/live.mk | 6 +- modules/live/usr/local/sbin/debinstall | 69 +++++++++++++++++++ modules/live/usr/local/sbin/debinstall-pkexec | 2 + .../debian-installer-launcher.desktop | 14 ++++ 4 files changed, 90 insertions(+), 1 deletion(-) create mode 100755 modules/live/usr/local/sbin/debinstall create mode 100755 modules/live/usr/local/sbin/debinstall-pkexec create mode 100644 modules/live/usr/local/share/applications/debian-installer-launcher.desktop diff --git a/modules/live.mk b/modules/live.mk index fcf2a9e..afd824f 100644 --- a/modules/live.mk +++ b/modules/live.mk @@ -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 index 0000000..3573d71 --- /dev/null +++ b/modules/live/usr/local/sbin/debinstall @@ -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 index 0000000..eb6ed69 --- /dev/null +++ b/modules/live/usr/local/sbin/debinstall-pkexec @@ -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 index 0000000..9445fe4 --- /dev/null +++ b/modules/live/usr/local/share/applications/debian-installer-launcher.desktop @@ -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 -- 2.39.5