plymouth-shutdown.initcpio_install 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #!/bin/bash
  2. build() {
  3. # get default theme settings
  4. local PLYMOUTH_THEME_NAME=$(plymouth-set-default-theme)
  5. local PLYMOUTH_THEME_DIR="/usr/share/plymouth/themes/$PLYMOUTH_THEME_NAME"
  6. local PLYMOUTH_IMAGE_DIR=$(sed -n "s/^ *ImageDir *= *//p" "$PLYMOUTH_THEME_DIR/$PLYMOUTH_THEME_NAME.plymouth")
  7. 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/')
  8. local PLYMOUTH_FONT_PATH=$(fc-match -f %{file} "$PLYMOUTH_FONT_NAME")
  9. local PLYMOUTH_TITLE_FONT_NAME=$(sed -n "s/^ *TitleFont *= *//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/')
  10. local PLYMOUTH_TITLE_FONT_PATH=$(fc-match -f %{file} "$PLYMOUTH_TITLE_FONT_NAME")
  11. 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/')
  12. if [ -n "$PLYMOUTH_MONOSPACE_FONT_NAME" ]; then
  13. local PLYMOUTH_MONOSPACE_BASE_FONT_NAME=$(fc-match -f %{family} "$PLYMOUTH_MONOSPACE_FONT_NAME" | sed 's/,.*//')
  14. local PLYMOUTH_MONOSPACE_FONT_PATH=$(fc-match -f %{file} "$PLYMOUTH_MONOSPACE_BASE_FONT_NAME")
  15. local PLYMOUTH_MONOSPACE_BOLD_FONT_PATH=$(fc-match -f %{file} "$PLYMOUTH_MONOSPACE_BASE_FONT_NAME:weight=bold")
  16. else
  17. local PLYMOUTH_MONOSPACE_FONT_PATH=$(fc-match -f %{file} monospace)
  18. local PLYMOUTH_MONOSPACE_BOLD_FONT_PATH=$(fc-match -f %{file} monospace:weight=bold)
  19. fi
  20. # copy helper binary
  21. if [ -f '/lib/plymouth/plymouthd-fd-escrow' ]; then
  22. add_file '/lib/plymouth/plymouthd-fd-escrow'
  23. fi
  24. # copy fonts
  25. if [ -n "$PLYMOUTH_FONT_PATH" ]; then
  26. add_file "$PLYMOUTH_FONT_PATH"
  27. fi
  28. if [ -n "$PLYMOUTH_TITLE_FONT_PATH" ]; then
  29. add_file "$PLYMOUTH_TITLE_FONT_PATH"
  30. fi
  31. if [ -n "$PLYMOUTH_MONOSPACE_FONT_PATH" ]; then
  32. add_file "$PLYMOUTH_MONOSPACE_FONT_PATH"
  33. add_file "$PLYMOUTH_MONOSPACE_BOLD_FONT_PATH"
  34. fi
  35. # copy configured theme
  36. if [ -d "$PLYMOUTH_THEME_DIR" ]; then
  37. add_full_dir "$PLYMOUTH_THEME_DIR"
  38. fi
  39. # copy images for the configured theme
  40. if [ "$PLYMOUTH_IMAGE_DIR" != "$PLYMOUTH_THEME_DIR" -a -d "$PLYMOUTH_IMAGE_DIR" ]; then
  41. add_full_dir "$PLYMOUTH_IMAGE_DIR"
  42. fi
  43. }
  44. help() {
  45. cat <<HELPEOF
  46. This hook includes fonts and a helper binary in shutdown initramfs for
  47. Plymouth. This is needed to display the console messages during shutdown and to
  48. hold on to the pixel-displays fds until the end.
  49. HELPEOF
  50. }