summarylogtreecommitdiffstats
path: root/plymouth.initcpio_install
blob: 231d1b56c4c03e0d8c686adea2ed503240f3e938 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#!/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/archlinux-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
  
  # adding this back in seems to help with getting the graphical password prompt to work
  add_dir '/dev/pts'

  # 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
}