From 0108858483111da3c0f11dcd3c2c5f01481fd2eb Mon Sep 17 00:00:00 2001 From: Brian Zalewski Date: Tue, 10 Jan 2023 07:48:14 +0000 Subject: [PATCH] Update 4 files - /home/.chezmoiscripts/universal/run_onchange_after_60-grub-settings.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_61-plymouth-settings.tmpl - /home/.chezmoiscripts/universal/run_onchange_after_64-grub-settings.tmpl - /software.yml --- ...n_onchange_after_61-plymouth-settings.tmpl | 82 +++++++++++++++++++ ... run_onchange_after_64-grub-settings.tmpl} | 3 +- software.yml | 12 +++ 3 files changed, 96 insertions(+), 1 deletion(-) create mode 100644 home/.chezmoiscripts/universal/run_onchange_after_61-plymouth-settings.tmpl rename home/.chezmoiscripts/universal/{run_onchange_after_60-grub-settings.tmpl => run_onchange_after_64-grub-settings.tmpl} (97%) diff --git a/home/.chezmoiscripts/universal/run_onchange_after_61-plymouth-settings.tmpl b/home/.chezmoiscripts/universal/run_onchange_after_61-plymouth-settings.tmpl new file mode 100644 index 00000000..f3d4d90f --- /dev/null +++ b/home/.chezmoiscripts/universal/run_onchange_after_61-plymouth-settings.tmpl @@ -0,0 +1,82 @@ +{{- if (eq .host.distro.family "linux") -}} +#!/usr/bin/env bash + +{{ includeTemplate "universal/profile" }} +{{ includeTemplate "universal/logg" }} + +### Ensure Plymouth system packages are installed +if command -v install-software > /dev/null; then + install-software plymouth +fi + +### Apply update-alternatives +if command -v update-alternatives > /dev/null; then + if [ -f "/usr/local/share/plymouth/themes/{{ .theme }}/{{ .theme }}.plymouth" ]; then + sudo update-alternatives --install /usr/share/plymouth/themes/default.plymouth default.plymouth "/usr/local/share/plymouth/themes/{{ .theme }}/{{ .theme }}.plymouth" 100 + logg success 'Installed `default.plymouth`' + # Required sometimes + sudo update-alternatives --set default.plymouth "/usr/local/share/plymouth/themes/{{ .theme }}/{{ .theme }}.plymouth" + logg success 'Set `default.plymouth`' + else + logg warn "/usr/local/share/plymouth/themes/{{ .theme }}/{{ .theme }}.plymouth does not exist!" + fi +else + logg warn '`update-alternatives` is not available' +fi + +### Update /etc/plymouth/plymouthd.conf +if [ -f /etc/plymouth/plymouthd.conf ]; then + logg info 'Setting ShowDelay=1 in /etc/plymouth/plymouthd.conf' + if cat /etc/plymouth/plymouthd.conf | grep ShowDelay; then + sudo sed -i '/^ShowDelay=.*/ShowDelay=1/' /etc/plymouth/plymouthd.conf + else + echo 'ShowDelay=1' | sudo tee -a /etc/plymouth/plymouthd.conf + fi +else + logg warn '/etc/plymouth/plymouthd.conf does not exist!' +fi + +### Set default Plymouth theme +if command -v plymouth-set-default-theme > /dev/null; then + sudo plymouth-set-default-theme -R '{{ .theme }}' || EXIT_CODE=$? + if [ -n "$EXIT_CODE" ]; then + logg warn 'There may have been an issue while setting the Plymouth default theme with `plymouth-set-default-theme`' + else + logg success 'Set Plymouth default theme with `plymouth-set-default-theme`' + fi +else + logg warn 'Could not apply default Plymouth theme because `plymouth-set-default-theme` is missing' +fi + +### Apply update-alternatives (again - required sometimes) +if command -v update-alternatives > /dev/null; then + if [ -f "/usr/local/share/plymouth/themes/{{ .theme }}/{{ .theme }}.plymouth" ]; then + # Required sometimes + sudo update-alternatives --set default.plymouth "/usr/local/share/plymouth/themes/{{ .theme }}/{{ .theme }}.plymouth" + logg success 'Set `default.plymouth` (second time is required sometimes)' + else + logg warn "/usr/local/share/plymouth/themes/{{ .theme }}/{{ .theme }}.plymouth does not exist!" + fi +else + logg warn '`update-alternatives` is not available' +fi + +### Update kernel / initrd images +# Set `export DEBUG_MODE=true` to bypass GRUB2 / Plymouth application +if [ "$DEBUG_MODE" != 'true' ]; then + if command -v update-initramfs > /dev/null; then + logg info 'Running `sudo update-initramfs -u`' + if [ "$DEBUG_MODE" != 'true' ]; then + sudo update-initramfs -u + fi + logg success 'Updated kernel / initrd images for Plymouth' + elif command -v dracut > /dev/null; then + logg info 'Running `sudo dracut --regenerate-all -f`' + sudo dracut --regenerate-all -f + logg success 'Updated kernel / initrd images for Plymouth' + else + logg warn 'Unable to update kernel / initrd images because neither `update-initramfs` or `dracut` are available' + fi +fi + +{{ end -}} diff --git a/home/.chezmoiscripts/universal/run_onchange_after_60-grub-settings.tmpl b/home/.chezmoiscripts/universal/run_onchange_after_64-grub-settings.tmpl similarity index 97% rename from home/.chezmoiscripts/universal/run_onchange_after_60-grub-settings.tmpl rename to home/.chezmoiscripts/universal/run_onchange_after_64-grub-settings.tmpl index 9626dadc..ab4e3b53 100644 --- a/home/.chezmoiscripts/universal/run_onchange_after_60-grub-settings.tmpl +++ b/home/.chezmoiscripts/universal/run_onchange_after_64-grub-settings.tmpl @@ -117,7 +117,8 @@ else fi ### Apply GRUB2 theme -if [ -d /sys/firmware/efi ]; then +# Set `export DEBUG_MODE=true` to bypass GRUB2 / Plymouth application +if [ -d /sys/firmware/efi ] && [ "$DEBUG_MODE" != 'true' ]; then logg info 'Assuming system is UEFI-enabled since /sys/firmware/efi is present' if [ -f /boot/efi/EFI/qubes/grub.cfg ]; then logg info 'Running `sudo grub2-mkconfig -o /boot/efi/EFI/qubes/grub.cfg`' diff --git a/software.yml b/software.yml index 8df29eaf..3891f842 100644 --- a/software.yml +++ b/software.yml @@ -1489,6 +1489,18 @@ softwarePackages: _home: null _name: DNS ansible: professormanhattan.dns + plymouth: + apt: + - libplymouth5 + - plymouth + - plymouth-themes + - plymouth-label + dnf: + - plymouth + - plymouth-x11 + - plymouth-plugin-script + pacman: + - plymouth dnsmasq: _bin: dnsmasq _desc: '[Dnsmasq](https://wiki.debian.org/dnsmasq) is free software providing Domain Name System caching, a Dynamic Host Configuration Protocol server, router advertisement and network boot features, intended for small computer networks.'