From 30418f67ce302768b0e36a92455af3e46eb5e881 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20=27sil2100=27=20Zemczak?= Date: Fri, 3 Nov 2023 09:05:00 +0200 Subject: [PATCH] Some updates to the core-desktop builds. --- live-build/auto/build | 2 +- live-build/auto/config | 2 +- live-build/ubuntu-core-desktop/casper-enable | 3 ++ live-build/ubuntu-core-desktop/casper-stop | 43 +++++++++++++++++++ live-build/ubuntu-core-desktop/casper.service | 16 +++++++ 5 files changed, 64 insertions(+), 2 deletions(-) create mode 100755 live-build/ubuntu-core-desktop/casper-enable create mode 100755 live-build/ubuntu-core-desktop/casper-stop create mode 100644 live-build/ubuntu-core-desktop/casper.service diff --git a/live-build/auto/build b/live-build/auto/build index 46743441..504958ef 100755 --- a/live-build/auto/build +++ b/live-build/auto/build @@ -123,7 +123,7 @@ if [ "${IMAGEFORMAT:-}" = "ubuntu-image" ]; then cat install-sources-in.yaml | sed "s/@SIZE@/$(stat -c%s pc.img.xz)/g" > install-sources.yaml # Now move all of the payload to the image-definitions directory, # so that they can be used by the image-definition effectively. - mv install-sources.yaml pc.img.xz autoinstall.yaml 99-custom-networking.cfg ../image-definitions/ + mv install-sources.yaml pc.img.xz autoinstall.yaml 99-custom-networking.cfg casper* ../image-definitions/ cd ../ # Also, since we care about the model assertion to be presented, diff --git a/live-build/auto/config b/live-build/auto/config index 7ad2b553..fcf27632 100755 --- a/live-build/auto/config +++ b/live-build/auto/config @@ -518,7 +518,7 @@ case $IMAGEFORMAT in # one for the payload and one for the actual image echo "Configuring for additional payload preparation" UBUNTU_IMAGE_PAYLOAD_ARGS="--image-size 12G" - EXTRA_SNAPS="$EXTRA_SNAPS eog evince firefox gnome-calculator gnome-characters gnome-clocks gnome-font-viewer gnome-logs gnome-text-editor gnome-weather ubuntu-core-desktop-init" + EXTRA_SNAPS="$EXTRA_SNAPS evince firefox gnome-calculator gnome-characters gnome-clocks gnome-font-viewer gnome-logs gnome-system-monitor gnome-text-editor gnome-weather loupe snapd-desktop-integration snap-store ubuntu-core-desktop-init workshops" for snap in $EXTRA_SNAPS; do UBUNTU_IMAGE_PAYLOAD_ARGS="$UBUNTU_IMAGE_PAYLOAD_ARGS --snap $snap" done diff --git a/live-build/ubuntu-core-desktop/casper-enable b/live-build/ubuntu-core-desktop/casper-enable new file mode 100755 index 00000000..79191842 --- /dev/null +++ b/live-build/ubuntu-core-desktop/casper-enable @@ -0,0 +1,3 @@ +#!/bin/sh + +/usr/bin/systemctl enable casper diff --git a/live-build/ubuntu-core-desktop/casper-stop b/live-build/ubuntu-core-desktop/casper-stop new file mode 100755 index 00000000..1de8fe1f --- /dev/null +++ b/live-build/ubuntu-core-desktop/casper-stop @@ -0,0 +1,43 @@ +#!/bin/sh + +# Author: Mathieu Trudel-Lapierre +# Tollef Fog Heen +# Marco Amadori +# + +PATH=/usr/sbin:/usr/bin:/sbin:/bin + +do_stop () +{ + prompt=1 + if grep -qs noprompt /proc/cmdline || [ -e /run/casper-no-prompt ]; then + prompt= + fi + + # XXX - i18n + MSG="Please press ENTER then remove the installation medium: " + MSG_FALLBACK="Please remove the installation medium, then reboot." + + if [ "$prompt" ]; then + if [ -x /bin/plymouth ] && plymouth --ping; then + chvt 63 + plymouth message --text="$MSG" + clear > /dev/tty1 + echo $MSG_FALLBACK > /dev/tty1 + else + stty sane < /dev/console + echo $MSG > /dev/console + fi + fi + + [ "$prompt" ] || return 0 + + if [ -x /bin/plymouth ] && plymouth --ping; then + plymouth watch-keystroke > /dev/null + else + read x < /dev/console + fi +} + +do_stop + diff --git a/live-build/ubuntu-core-desktop/casper.service b/live-build/ubuntu-core-desktop/casper.service new file mode 100644 index 00000000..01bac626 --- /dev/null +++ b/live-build/ubuntu-core-desktop/casper.service @@ -0,0 +1,16 @@ +[Unit] +Description=Shuts down the "live" preinstalled system cleanly +DefaultDependencies=no +Before=final.target +After=shutdown.target umount.target plymouth-halt.service plymouth-poweroff.service plymouth-reboot.service + +[Service] +Type=oneshot +ExecStart=/sbin/casper-stop +StandardInput=tty-force +StandardOutput=inherit +StandardError=inherit +TTYReset=yes + +[Install] +WantedBy=final.target