12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- #!/bin/bash
- build() {
- # get default theme settings
- local PLYMOUTH_THEME_NAME=$(plymouth-set-default-theme)
- local PLYMOUTH_THEME_DIR="/usr/share/plymouth/themes/$PLYMOUTH_THEME_NAME"
- local PLYMOUTH_MODULE_NAME=$(sed -n "s/^ *ModuleName *= *//p" "$PLYMOUTH_THEME_DIR/$PLYMOUTH_THEME_NAME.plymouth")
- local PLYMOUTH_IMAGE_DIR=$(sed -n "s/^ *ImageDir *= *//p" "$PLYMOUTH_THEME_DIR/$PLYMOUTH_THEME_NAME.plymouth")
- local PLYMOUTH_FONT_NAME=$(sed -n "s/^ *Font *= *//p" "$PLYMOUTH_THEME_DIR/$PLYMOUTH_THEME_NAME.plymouth" | sed -e 's/ [0-9]\+ *$//' -e 's/ \(Regular\|Bold\|Italic\|Bold Italic\|Oblique\|Bold Oblique\|Thin\|Light\|Extra Bold\) *$/:style=\1/')
- local PLYMOUTH_FONT_PATH=$(fc-match -f %{file} "$PLYMOUTH_FONT_NAME")
- local PLYMOUTH_MONOSPACE_FONT_NAME=$(sed -n "s/^ *MonospaceFont *= *//p" "$PLYMOUTH_THEME_DIR/$PLYMOUTH_THEME_NAME.plymouth" | sed -e 's/ [0-9]\+ *$//' -e 's/ \(Regular\|Bold\|Italic\|Bold Italic\|Oblique\|Bold Oblique\|Thin\|Light\|Extra Bold\) *$/:style=\1/')
- if [ -n "$PLYMOUTH_MONOSPACE_FONT_NAME" ]; then
- local PLYMOUTH_MONOSPACE_FONT_PATH=$(fc-match -f %{file} "$PLYMOUTH_MONOSPACE_FONT_NAME")
- else
- local PLYMOUTH_MONOSPACE_FONT_PATH=$(fc-match -f %{file} monospace)
- fi
- # exit if no module exists on the system for the theme
- if [ ! -f "/usr/lib/plymouth/$PLYMOUTH_MODULE_NAME.so" ]; then
- error "The default plymouth plugin (%s) doesn't exist" "$PLYMOUTH_MODULE_NAME"
- return 1
- fi
- # copy binaries and base plugins
- map add_binary \
- 'plymouthd' \
- 'plymouth' \
- '/usr/lib/plymouth/text.so' \
- '/usr/lib/plymouth/details.so' \
- '/usr/lib/plymouth/label-freetype.so' \
- '/usr/lib/plymouth/renderers/drm.so' \
- '/usr/lib/plymouth/renderers/frame-buffer.so' \
- "/usr/lib/plymouth/$PLYMOUTH_MODULE_NAME.so"
- # copy base themes and logo
- map add_file \
- '/usr/share/plymouth/themes/text/text.plymouth' \
- '/usr/share/plymouth/themes/details/details.plymouth' \
- '/usr/share/pixmaps/parabola-logo.png' \
- '/usr/share/plymouth/plymouthd.defaults' \
- '/etc/plymouth/plymouthd.conf'
- # copy fonts
- if [ -n "$PLYMOUTH_FONT_PATH" ]; then
- add_file "$PLYMOUTH_FONT_PATH" '/usr/share/fonts/Plymouth.ttf'
- fi
- if [ -n "$PLYMOUTH_MONOSPACE_FONT_PATH" ]; then
- add_file "$PLYMOUTH_MONOSPACE_FONT_PATH" '/usr/share/fonts/Plymouth-monospace.ttf'
- fi
- # copy xkb info and x11 locale
- if [ -d '/usr/share/X11/locale' ]; then
- add_full_dir '/usr/share/X11/locale'
- fi
- if [ -d '/usr/share/X11/xkb' ]; then
- add_full_dir '/usr/share/X11/xkb'
- fi
- # copy configured theme
- if [ -d "$PLYMOUTH_THEME_DIR" ]; then
- add_full_dir "$PLYMOUTH_THEME_DIR"
- fi
- # copy images for the configured theme
- if [ "$PLYMOUTH_IMAGE_DIR" != "$PLYMOUTH_THEME_DIR" -a -d "$PLYMOUTH_IMAGE_DIR" ]; then
- add_full_dir "$PLYMOUTH_IMAGE_DIR"
- fi
- # needed to access DRM devices
- add_udev_rule '71-seat.rules'
- # copy systemd unit files for systemd boot, otherwise use runscript
- if command -v add_systemd_unit >/dev/null; then
- map add_systemd_unit \
- 'plymouth-halt.service' \
- 'plymouth-kexec.service' \
- 'plymouth-poweroff.service' \
- 'plymouth-quit-wait.service' \
- 'plymouth-quit.service' \
- 'plymouth-reboot.service' \
- 'plymouth-start.service' \
- 'plymouth-switch-root.service' \
- 'systemd-ask-password-plymouth.path' \
- 'systemd-ask-password-plymouth.service'
- else
- add_runscript
- fi
- }
- help() {
- cat <<HELPEOF
- This hook includes Plymouth in initramfs. It shows a graphical splash screen
- during boot if the 'splash' kernel parameter is specified.
- HELPEOF
- }
|