From 88e201e0c82eda4438f78ad949b25a43409556a2 Mon Sep 17 00:00:00 2001 From: Simon Quigley Date: Fri, 20 Jul 2018 12:52:55 -0500 Subject: [PATCH] Get some changes from Neon to make some of our awful hacks much cleaner. --- debian/calamares-settings-lubuntu.install | 1 + debian/changelog | 1 + lubuntu/calamares-logs-helper | 24 +++++++++++++++++++ lubuntu/modules/after_bootloader_context.conf | 17 +++++++++++++ .../modules/before_bootloader_context.conf | 17 +++++++++++++ .../before_bootloader_mkdirs_context.conf | 12 ++++++++++ lubuntu/modules/mount.conf | 21 ++++++++++++++++ lubuntu/modules/shellprocess.conf | 6 ----- lubuntu/modules/shellprocess_logs.conf | 5 ++++ lubuntu/settings.conf | 21 +++++++++++++--- 10 files changed, 116 insertions(+), 9 deletions(-) create mode 100755 lubuntu/calamares-logs-helper create mode 100644 lubuntu/modules/after_bootloader_context.conf create mode 100644 lubuntu/modules/before_bootloader_context.conf create mode 100644 lubuntu/modules/before_bootloader_mkdirs_context.conf create mode 100644 lubuntu/modules/mount.conf delete mode 100644 lubuntu/modules/shellprocess.conf create mode 100644 lubuntu/modules/shellprocess_logs.conf diff --git a/debian/calamares-settings-lubuntu.install b/debian/calamares-settings-lubuntu.install index cf39e3e..2283f95 100644 --- a/debian/calamares-settings-lubuntu.install +++ b/debian/calamares-settings-lubuntu.install @@ -1,4 +1,5 @@ lubuntu/calamares.desktop etc/skel/Desktop/ +lubuntu/calamares-logs-helper usr/bin/ lubuntu/branding/ etc/calamares/ lubuntu/modules/ etc/calamares/ lubuntu/settings.conf etc/calamares/ diff --git a/debian/changelog b/debian/changelog index 9d7f1bc..e836213 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,6 +2,7 @@ calamares-settings-ubuntu (11) UNRELEASED; urgency=medium * Add a machineid file. * Ensure that /bin/bash is always the default shell. + * Clean up awful hacks. -- Simon Quigley Fri, 20 Jul 2018 09:43:15 -0500 diff --git a/lubuntu/calamares-logs-helper b/lubuntu/calamares-logs-helper new file mode 100755 index 0000000..414659f --- /dev/null +++ b/lubuntu/calamares-logs-helper @@ -0,0 +1,24 @@ +#!/bin/sh + +set -ex + +root=$1 +install_dir=$root/var/log/installer +[ -d $install_dir ] || mkdir -p $install_dir + +cp /home/neon/.cache/calamares/session.log $install_dir/debug + +cp /cdrom/.disk/info $install_dir/media-info +cp /var/log/casper.log $install_dir/casper.log +cp /var/log/syslog $install_dir/syslog + +gzip --stdout $root/var/lib/dpkg/status > $install_dir/initial-status.gz + +# OEM id isn't a thing, when in OEM mode ubiquity would also archive that. +# https://github.com/calamares/calamares/issues/943 + +chmod -v 600 $install_dir/* +# Make these world readable, they can absolutely not contain anything relevant +# to security. +chmod -v 644 $install_dir/initial-status.gz +chmod -v 644 $install_dir/media-info diff --git a/lubuntu/modules/after_bootloader_context.conf b/lubuntu/modules/after_bootloader_context.conf new file mode 100644 index 0000000..a8a172d --- /dev/null +++ b/lubuntu/modules/after_bootloader_context.conf @@ -0,0 +1,17 @@ +# Workaround from ubiquity. Ubuntu's grub will want to look in EFI/ubuntu, so +# let's make sure it can find something there. +# This only copies the cfg and doesn't overwrite, this is specifically so +# this doesn't interfere with an Ubuntu installed on the system already. +--- +dontChroot: false +timeout: 120 +firmwareType: + efi: + # grub hack + - -mkdir /boot/efi/EFI/ubuntu + - -cp /boot/efi/EFI/lubuntu/grub.cfg /boot/efi/EFI/ubuntu/ + # normal user setup + - -for i in `ls @@ROOT@@/home/`; do rm @@ROOT@@/home/$i/Desktop/calamares.desktop || exit 0; done + bios: + # normal user setup + - -for i in `ls @@ROOT@@/home/`; do rm @@ROOT@@/home/$i/Desktop/calamares.desktop || exit 0; done diff --git a/lubuntu/modules/before_bootloader_context.conf b/lubuntu/modules/before_bootloader_context.conf new file mode 100644 index 0000000..6bf40ed --- /dev/null +++ b/lubuntu/modules/before_bootloader_context.conf @@ -0,0 +1,17 @@ +# Make sure the correct bootloader package is installed for EFI. +# Also pull in shim so secureboot has a chance at working. +--- +firmwareType: + efi: + - command: apt-cdrom add -m -d=/media/cdrom/ + timeout: 10 + - command: apt-get update + timeout: 120 + - command: apt install -y --no-upgrade -o Acquire::gpgv::Options::=--ignore-time-conflict grub-efi-amd64-signed + timeout: 300 + - command: apt install -y --no-upgrade -o Acquire::gpgv::Options::=--ignore-time-conflict shim-signed + timeout: 300 + - command: sed -i '/deb cdrom/d' /etc/apt/sources.list + timeout: 10 + - command: apt-get update + timeout: 120 diff --git a/lubuntu/modules/before_bootloader_mkdirs_context.conf b/lubuntu/modules/before_bootloader_mkdirs_context.conf new file mode 100644 index 0000000..bd20390 --- /dev/null +++ b/lubuntu/modules/before_bootloader_mkdirs_context.conf @@ -0,0 +1,12 @@ +--- +dontChroot: true +timeout: 10 +firmwareType: + efi: + - -cp /cdrom/casper/vmlinuz @@ROOT@@/boot/vmlinuz-$(uname -r) + - -cp /cdrom/casper/initrd @@ROOT@@/boot/initrd.img-$(uname -r) + - -mkdir -pv @@ROOT@@/media/cdrom + - -mount --bind /cdrom @@ROOT@@/media/cdrom + bios: + - -cp /cdrom/casper/vmlinuz @@ROOT@@/boot/vmlinuz-$(uname -r) + - -cp /cdrom/casper/initrd @@ROOT@@/boot/initrd.img-$(uname -r) diff --git a/lubuntu/modules/mount.conf b/lubuntu/modules/mount.conf new file mode 100644 index 0000000..1efd5dd --- /dev/null +++ b/lubuntu/modules/mount.conf @@ -0,0 +1,21 @@ +extraMounts: + - device: proc + fs: proc + mountPoint: /proc + - device: sys + fs: sysfs + mountPoint: /sys + - device: /dev + mountPoint: /dev + options: bind + - device: tmpfs + fs: tmpfs + mountPoint: /run + - device: /run/udev + mountPoint: /run/udev + options: bind + +extraMountsEfi: + - device: efivarfs + fs: efivarfs + mountPoint: /sys/firmware/efi/efivars diff --git a/lubuntu/modules/shellprocess.conf b/lubuntu/modules/shellprocess.conf deleted file mode 100644 index 1097552..0000000 --- a/lubuntu/modules/shellprocess.conf +++ /dev/null @@ -1,6 +0,0 @@ -dontChroot: true -timeout: 300 -script: - - "cp /cdrom/casper/vmlinuz @@ROOT@@/boot/vmlinuz-$(uname -r)" - - "[ -d /sys/firmware/efi ] && mkdir -pv @@ROOT@@/media/cdrom && mount --bind /cdrom @@ROOT@@/media/cdrom && chroot @@ROOT@@ apt-cdrom add -m -d=/media/cdrom/ && chroot @@ROOT@@ sed -e '/deb http/ s/^#*/#/' -i /etc/apt/sources.list && chroot @@ROOT@@ apt update && chroot @@ROOT@@ apt -y install grub-efi && chroot @@ROOT@@ sed -i 's/#deb/deb/' /etc/apt/sources.list && sed -i '/deb cdrom/d' @@ROOT@@/etc/apt/sources.list && umount @@ROOT@@/media/cdrom && rmdir @@ROOT@@/media/cdrom || exit 0" - - "for i in `ls @@ROOT@@/home/`; do rm @@ROOT@@/home/$i/Desktop/calamares.desktop || exit 0; done" diff --git a/lubuntu/modules/shellprocess_logs.conf b/lubuntu/modules/shellprocess_logs.conf new file mode 100644 index 0000000..0c0d54f --- /dev/null +++ b/lubuntu/modules/shellprocess_logs.conf @@ -0,0 +1,5 @@ +--- +dontChroot: true +timeout: 30 +script: + - calamares-logs-helper @@ROOT@@ diff --git a/lubuntu/settings.conf b/lubuntu/settings.conf index 8ab8709..8eb4168 100644 --- a/lubuntu/settings.conf +++ b/lubuntu/settings.conf @@ -1,6 +1,20 @@ --- modules-search: [ local ] +instances: +- id: before_bootloader_mkdirs + module: contextualprocess + config: before_bootloader_mkdirs_context.conf +- id: before_bootloader + module: contextualprocess + config: before_bootloader_context.conf +- id: after_bootloader + module: contextualprocess + config: after_bootloader_context.conf +- id: logs + module: shellprocess + config: shellprocess_logs.conf + sequence: - show: - welcome @@ -22,12 +36,13 @@ sequence: - displaymanager - networkcfg - hwclock - - services - - shellprocess - initramfs - - grubcfg + - contextualprocess@before_bootloader_mkdirs + - contextualprocess@before_bootloader - bootloader + - contextualprocess@after_bootloader - packages + - shellprocess@logs - umount - show: - finished