plymouth.initcpio_install 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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_MODULE_NAME=$(sed -n "s/^ *ModuleName *= *//p" "$PLYMOUTH_THEME_DIR/$PLYMOUTH_THEME_NAME.plymouth")
  7. local PLYMOUTH_IMAGE_DIR=$(sed -n "s/^ *ImageDir *= *//p" "$PLYMOUTH_THEME_DIR/$PLYMOUTH_THEME_NAME.plymouth")
  8. 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/')
  9. local PLYMOUTH_FONT_PATH=$(fc-match -f %{file} "$PLYMOUTH_FONT_NAME")
  10. 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/')
  11. if [ -n "$PLYMOUTH_MONOSPACE_FONT_NAME" ]; then
  12. local PLYMOUTH_MONOSPACE_FONT_PATH=$(fc-match -f %{file} "$PLYMOUTH_MONOSPACE_FONT_NAME")
  13. else
  14. local PLYMOUTH_MONOSPACE_FONT_PATH=$(fc-match -f %{file} monospace)
  15. fi
  16. # exit if no module exists on the system for the theme
  17. if [ ! -f "/usr/lib/plymouth/$PLYMOUTH_MODULE_NAME.so" ]; then
  18. error "The default plymouth plugin (%s) doesn't exist" "$PLYMOUTH_MODULE_NAME"
  19. return 1
  20. fi
  21. # copy binaries and base plugins
  22. map add_binary \
  23. 'plymouthd' \
  24. 'plymouth' \
  25. '/usr/lib/plymouth/text.so' \
  26. '/usr/lib/plymouth/details.so' \
  27. '/usr/lib/plymouth/label-freetype.so' \
  28. '/usr/lib/plymouth/renderers/drm.so' \
  29. '/usr/lib/plymouth/renderers/frame-buffer.so' \
  30. "/usr/lib/plymouth/$PLYMOUTH_MODULE_NAME.so"
  31. # copy base themes and logo
  32. map add_file \
  33. '/usr/share/plymouth/themes/text/text.plymouth' \
  34. '/usr/share/plymouth/themes/details/details.plymouth' \
  35. '/usr/share/pixmaps/parabola-logo.png' \
  36. '/usr/share/plymouth/plymouthd.defaults' \
  37. '/etc/plymouth/plymouthd.conf'
  38. # copy fonts
  39. if [ -n "$PLYMOUTH_FONT_PATH" ]; then
  40. add_file "$PLYMOUTH_FONT_PATH" '/usr/share/fonts/Plymouth.ttf'
  41. fi
  42. if [ -n "$PLYMOUTH_MONOSPACE_FONT_PATH" ]; then
  43. add_file "$PLYMOUTH_MONOSPACE_FONT_PATH" '/usr/share/fonts/Plymouth-monospace.ttf'
  44. fi
  45. # copy xkb info and x11 locale
  46. if [ -d '/usr/share/X11/locale' ]; then
  47. add_full_dir '/usr/share/X11/locale'
  48. fi
  49. if [ -d '/usr/share/X11/xkb' ]; then
  50. add_full_dir '/usr/share/X11/xkb'
  51. fi
  52. # copy configured theme
  53. if [ -d "$PLYMOUTH_THEME_DIR" ]; then
  54. add_full_dir "$PLYMOUTH_THEME_DIR"
  55. fi
  56. # copy images for the configured theme
  57. if [ "$PLYMOUTH_IMAGE_DIR" != "$PLYMOUTH_THEME_DIR" -a -d "$PLYMOUTH_IMAGE_DIR" ]; then
  58. add_full_dir "$PLYMOUTH_IMAGE_DIR"
  59. fi
  60. # needed to access DRM devices
  61. add_udev_rule '71-seat.rules'
  62. # copy systemd unit files for systemd boot, otherwise use runscript
  63. if command -v add_systemd_unit >/dev/null; then
  64. map add_systemd_unit \
  65. 'plymouth-halt.service' \
  66. 'plymouth-kexec.service' \
  67. 'plymouth-poweroff.service' \
  68. 'plymouth-quit-wait.service' \
  69. 'plymouth-quit.service' \
  70. 'plymouth-reboot.service' \
  71. 'plymouth-start.service' \
  72. 'plymouth-switch-root.service' \
  73. 'systemd-ask-password-plymouth.path' \
  74. 'systemd-ask-password-plymouth.service'
  75. else
  76. add_runscript
  77. fi
  78. }
  79. help() {
  80. cat <<HELPEOF
  81. This hook includes Plymouth in initramfs. It shows a graphical splash screen
  82. during boot if the 'splash' kernel parameter is specified.
  83. HELPEOF
  84. }