2023-08-08 00:06:49 -07:00
|
|
|
---
|
|
|
|
title: Plymouth Theme / Configuration
|
|
|
|
description: Configures Plymouth to use a custom theme
|
|
|
|
sidebar_label: 61 Plymouth Theme / Configuration
|
|
|
|
slug: /scripts/after/run_onchange_after_61-plymouth-settings.sh.tmpl
|
|
|
|
githubLocation: https://github.com/megabyte-labs/install.doctor/blob/master/home/.chezmoiscripts/universal/run_onchange_after_61-plymouth-settings.sh.tmpl
|
|
|
|
scriptLocation: https://github.com/megabyte-labs/install.doctor/raw/master/home/.chezmoiscripts/universal/run_onchange_after_61-plymouth-settings.sh.tmpl
|
|
|
|
repoLocation: home/.chezmoiscripts/universal/run_onchange_after_61-plymouth-settings.sh.tmpl
|
|
|
|
---
|
2023-08-30 12:58:51 -07:00
|
|
|
|
2023-08-08 00:06:49 -07:00
|
|
|
# Plymouth Theme / Configuration
|
|
|
|
|
|
|
|
Configures Plymouth to use a custom theme
|
|
|
|
|
|
|
|
## Overview
|
|
|
|
|
|
|
|
This script installs Plymouth and then configures it to use our custom Betelgeuse theme.
|
|
|
|
|
|
|
|
## Source Code
|
|
|
|
|
|
|
|
```
|
|
|
|
{{- if (eq .host.distro.family "linux") -}}
|
|
|
|
#!/usr/bin/env bash
|
|
|
|
# @file Plymouth Theme / Configuration
|
|
|
|
# @brief Configures Plymouth to use a custom theme
|
|
|
|
# @description
|
|
|
|
# This script installs Plymouth and then configures it to use our custom Betelgeuse theme.
|
|
|
|
|
|
|
|
{{ includeTemplate "universal/profile" }}
|
|
|
|
{{ includeTemplate "universal/logg" }}
|
|
|
|
|
|
|
|
### Ensure Plymouth system packages are installed
|
2023-08-30 12:58:51 -07:00
|
|
|
if command -v install-program > /dev/null; then
|
|
|
|
install-program plymouth
|
2023-08-08 00:06:49 -07:00
|
|
|
fi
|
|
|
|
|
|
|
|
### Create /etc/plymouth/plymouthd.conf
|
|
|
|
if [ -f /etc/plymouth/plymouthd.conf ]; then
|
|
|
|
### Back up original plymouthd.conf
|
|
|
|
if [ ! -f /etc/plymouth/plymouthd.conf.bak ]; then
|
|
|
|
logg info 'Backing up /etc/plymouth/plymouthd.conf to /etc/plymouth/plymouthd.conf.bak'
|
|
|
|
sudo cp -f /etc/plymouth/plymouthd.conf /etc/plymouth/plymouthd.conf.bak
|
|
|
|
fi
|
|
|
|
|
|
|
|
### Create new plymouthd.conf
|
|
|
|
logg info 'Populating the /etc/plymouth/plymouthd.conf file'
|
|
|
|
echo "[Daemon]" | sudo tee /etc/plymouth/plymouthd.conf > /dev/null
|
|
|
|
echo "Theme={{ .theme }}" | sudo tee -a /etc/plymouth/plymouthd.conf > /dev/null
|
|
|
|
echo "ShowDelay=1" | sudo tee -a /etc/plymouth/plymouthd.conf > /dev/null
|
|
|
|
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
|
2023-11-04 18:46:18 -07:00
|
|
|
logg success 'Installed default.plymouth'
|
2023-08-08 00:06:49 -07:00
|
|
|
# Required sometimes
|
|
|
|
sudo update-alternatives --set default.plymouth "/usr/local/share/plymouth/themes/{{ .theme }}/{{ .theme }}.plymouth"
|
2023-11-04 18:46:18 -07:00
|
|
|
logg success 'Set default.plymouth'
|
2023-08-08 00:06:49 -07:00
|
|
|
else
|
|
|
|
logg warn "/usr/local/share/plymouth/themes/{{ .theme }}/{{ .theme }}.plymouth does not exist!"
|
|
|
|
fi
|
|
|
|
else
|
2023-11-04 18:46:18 -07:00
|
|
|
logg warn 'update-alternatives is not available'
|
2023-08-08 00:06:49 -07:00
|
|
|
fi
|
|
|
|
|
|
|
|
### Update /etc/plymouth/plymouthd.conf
|
|
|
|
# Replaced by code above
|
|
|
|
# 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 's/^ShowDelay=.*/ShowDelay=1/' /etc/plymouth/plymouthd.conf
|
|
|
|
# else
|
|
|
|
# echo 'ShowDelay=1' | sudo tee -a /etc/plymouth/plymouthd.conf > /dev/null
|
|
|
|
# fi
|
|
|
|
# else
|
|
|
|
# logg warn '/etc/plymouth/plymouthd.conf does not exist!'
|
|
|
|
# fi
|
|
|
|
|
|
|
|
### Symlink /usr/local/share/plymouth/themes to /usr/share/plymouth/themes
|
|
|
|
if [ ! -d '/usr/share/plymouth/themes/{{ .theme }}' ]; then
|
|
|
|
logg info 'Symlinking /usr/local/share/plymouth/themes/{{ .theme }} to /usr/share/plymouth/themes/{{ .theme }}'
|
|
|
|
sudo ln -s '/usr/local/share/plymouth/themes/{{ .theme }}' '/usr/share/plymouth/themes/{{ .theme }}'
|
|
|
|
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
|
2023-11-04 18:46:18 -07:00
|
|
|
logg warn 'There may have been an issue while setting the Plymouth default theme with plymouth-set-default-theme'
|
2023-08-08 00:06:49 -07:00
|
|
|
else
|
2023-11-04 18:46:18 -07:00
|
|
|
logg success 'Set Plymouth default theme with plymouth-set-default-theme'
|
2023-08-08 00:06:49 -07:00
|
|
|
fi
|
|
|
|
else
|
2023-11-04 18:46:18 -07:00
|
|
|
logg warn 'Could not apply default Plymouth theme because plymouth-set-default-theme is missing'
|
2023-08-08 00:06:49 -07:00
|
|
|
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"
|
2023-11-04 18:46:18 -07:00
|
|
|
logg success 'Set default.plymouth (second time is required sometimes)'
|
2023-08-08 00:06:49 -07:00
|
|
|
else
|
|
|
|
logg warn "/usr/local/share/plymouth/themes/{{ .theme }}/{{ .theme }}.plymouth does not exist!"
|
|
|
|
fi
|
|
|
|
else
|
2023-11-04 18:46:18 -07:00
|
|
|
logg warn 'update-alternatives is not available'
|
2023-08-08 00:06:49 -07:00
|
|
|
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
|
2023-11-04 18:46:18 -07:00
|
|
|
logg info 'Running sudo update-initramfs -u'
|
2023-08-08 00:06:49 -07:00
|
|
|
sudo update-initramfs -u
|
|
|
|
logg success 'Updated kernel / initrd images for Plymouth'
|
|
|
|
elif command -v dracut > /dev/null; then
|
2023-11-04 18:46:18 -07:00
|
|
|
logg info 'Running sudo dracut --regenerate-all -f'
|
2023-08-08 00:06:49 -07:00
|
|
|
sudo dracut --regenerate-all -f
|
|
|
|
logg success 'Updated kernel / initrd images for Plymouth'
|
|
|
|
else
|
2023-11-04 18:46:18 -07:00
|
|
|
logg warn 'Unable to update kernel / initrd images because neither update-initramfs or dracut are available'
|
2023-08-08 00:06:49 -07:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
{{ end -}}
|
|
|
|
```
|