summarylogtreecommitdiffstats
path: root/sd-plymouth.initcpio_install
blob: f64eb1b6a7c23a669468b4ae698374d3fc6241f3 (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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#!/bin/bash
# /etc/initcpio/install/sd-plymouth — mkinitcpio/systemd hook for plymouth

build() {
	local DATADIR PLYMOUTH_LOGO_FILE PLYMOUTH_THEME_NAME PLYMOUTH_THEME_DIR PLYMOUTH_IMAGE_DIR PLYMOUTH_PLUGIN_PATH PLYMOUTH_MODULE_NAME FONT
	
	add_dir /dev/pts
	add_dir /usr/share/plymouth/themes
	add_dir /run/plymouth

	DATADIR="/usr/share/plymouth"
	PLYMOUTH_LOGO_FILE="${DATADIR}/arch-logo.png"
	PLYMOUTH_THEME_NAME="$(/usr/bin/plymouth-set-default-theme)"
	PLYMOUTH_THEME_DIR="${DATADIR}/themes/${PLYMOUTH_THEME_NAME}"
	PLYMOUTH_IMAGE_DIR=$(grep "ImageDir *= *" ${PLYMOUTH_THEME_DIR}/${PLYMOUTH_THEME_NAME}.plymouth | sed 's/ImageDir *= *//')
	PLYMOUTH_PLUGIN_PATH="$(plymouth --get-splash-plugin-path)"
	PLYMOUTH_MODULE_NAME="$(grep "ModuleName *= *" ${PLYMOUTH_THEME_DIR}/${PLYMOUTH_THEME_NAME}.plymouth | sed 's/ModuleName *= *//')"
	FONT="$(fc-match -f %{file})"
	X11_DIRECTORY="/usr/share/X11"

	add_binary /usr/bin/plymouthd
	add_binary /usr/bin/plymouth
	add_binary /usr/lib/plymouth/plymouthd-fd-escrow

	add_file ${DATADIR}/themes/text/text.plymouth
	add_binary ${PLYMOUTH_PLUGIN_PATH}/text.so
	add_file ${DATADIR}/themes/details/details.plymouth
	add_binary ${PLYMOUTH_PLUGIN_PATH}/details.so

	add_file "${PLYMOUTH_LOGO_FILE}"
	add_file /etc/os-release
	add_file /etc/plymouth/plymouthd.conf
	add_file ${DATADIR}/plymouthd.defaults
	
	add_binary ${PLYMOUTH_PLUGIN_PATH}/label-freetype.so
	add_binary ${PLYMOUTH_PLUGIN_PATH}/label-pango.so
	add_file "/etc/fonts/fonts.conf"
	add_file "${FONT}"
	add_symlink "/usr/share/fonts/Plymouth.ttf" "${FONT}"
	add_file "/usr/share/fonts/cantarell/Cantarell-VF.otf"
	add_symlink "/usr/share/fonts/cantarell/Cantarell-Thin.otf" "/usr/share/fonts/cantarell/Cantarell-VF.otf"
	add_symlink "/usr/share/fonts/cantarell/Cantarell-Regular.otf" "/usr/share/fonts/cantarell/Cantarell-VF.otf"
	add_file "/usr/share/fonts/TTF/DejaVuSans.ttf"
	if [ -f "/etc/fonts/conf.d/60-latin.conf" ]; then
	  add_file "/etc/fonts/conf.d/60-latin.conf"
	fi
	
	if [ ! -f ${PLYMOUTH_PLUGIN_PATH}/${PLYMOUTH_MODULE_NAME}.so ]; then
		echo "The default plymouth plugin (${PLYMOUTH_MODULE_NAME}) doesn't exist" > /dev/stderr
		exit 1
	fi

	add_binary ${PLYMOUTH_PLUGIN_PATH}/${PLYMOUTH_MODULE_NAME}.so

	add_binary ${PLYMOUTH_PLUGIN_PATH}/renderers/drm.so
	add_binary ${PLYMOUTH_PLUGIN_PATH}/renderers/frame-buffer.so

	if [ -d ${PLYMOUTH_THEME_DIR} ]; then
		add_full_dir ${PLYMOUTH_THEME_DIR}
	fi

	if [ "${PLYMOUTH_IMAGE_DIR}" != "${PLYMOUTH_THEME_DIR}" -a -d ${PLYMOUTH_IMAGE_DIR} ]; then
		add_full_dir ${PLYMOUTH_IMAGE_DIR}
	fi
	
	# Install xkb info
	add_file ${X11_DIRECTORY}/xkb/compat/accessx
	add_file ${X11_DIRECTORY}/xkb/compat/basic
	add_file ${X11_DIRECTORY}/xkb/compat/caps
	add_file ${X11_DIRECTORY}/xkb/compat/complete
	add_file ${X11_DIRECTORY}/xkb/compat/iso9995
	add_file ${X11_DIRECTORY}/xkb/compat/ledcaps
	add_file ${X11_DIRECTORY}/xkb/compat/lednum
	add_file ${X11_DIRECTORY}/xkb/compat/ledscroll
	add_file ${X11_DIRECTORY}/xkb/compat/level5
	add_file ${X11_DIRECTORY}/xkb/compat/misc
	add_file ${X11_DIRECTORY}/xkb/compat/mousekeys
	add_file ${X11_DIRECTORY}/xkb/compat/xfree86
	add_file ${X11_DIRECTORY}/xkb/keycodes/aliases
	add_file ${X11_DIRECTORY}/xkb/keycodes/evdev
	add_file ${X11_DIRECTORY}/xkb/rules/evdev
	find ${X11_DIRECTORY}/xkb/symbols -maxdepth 1 ! -type d | while read file; do
	    add_file $file
	done
	add_file ${X11_DIRECTORY}/xkb/types/basic
	add_file ${X11_DIRECTORY}/xkb/types/complete
	add_file ${X11_DIRECTORY}/xkb/types/extra
	add_file ${X11_DIRECTORY}/xkb/types/iso9995
	add_file ${X11_DIRECTORY}/xkb/types/level5
	add_file ${X11_DIRECTORY}/xkb/types/mousekeys
	add_file ${X11_DIRECTORY}/xkb/types/numpad
	add_file ${X11_DIRECTORY}/xkb/types/pc

	# In the off chance the user uses their compose key when
	# typing their password, install compose sequences
	add_file ${X11_DIRECTORY}/locale/compose.dir
	grep UTF-8/Compose: ${X11_DIRECTORY}/locale/compose.dir | awk -F: '{ print $1 }' | sort -u | xargs dirname | while read DIR; do
	    find ${X11_DIRECTORY}/locale/$DIR -maxdepth 1 ! -type d | while read file; do
	        add_file $file
	     done
	done
	
	add_udev_rule 70-uaccess.rules
	add_udev_rule 71-seat.rules

	map add_systemd_unit \
		systemd-ask-password-plymouth.path \
		systemd-ask-password-plymouth.service \
		plymouth-halt.service \
		plymouth-kexec.service \
		plymouth-poweroff.service \
		plymouth-quit-wait.service \
		plymouth-quit.service \
		plymouth-read-write.service \
		plymouth-reboot.service \
		plymouth-start.service \
		plymouth-switch-root-initramfs.service \
		plymouth-switch-root.service
}

help() {
	cat <<HELPEOF
This hook includes plymouth in a systemd-based initramfs image.
HELPEOF
}