summaryrefslogtreecommitdiff
path: root/plymouth/debian/local/plymouth.hook
diff options
context:
space:
mode:
Diffstat (limited to 'plymouth/debian/local/plymouth.hook')
-rw-r--r--plymouth/debian/local/plymouth.hook163
1 files changed, 163 insertions, 0 deletions
diff --git a/plymouth/debian/local/plymouth.hook b/plymouth/debian/local/plymouth.hook
new file mode 100644
index 0000000..cf0c3a9
--- /dev/null
+++ b/plymouth/debian/local/plymouth.hook
@@ -0,0 +1,163 @@
+#!/bin/sh
+
+set -e
+
+PREREQ=""
+
+prereqs()
+{
+ echo "${PREREQ}"
+}
+
+case "${1}" in
+ prereqs)
+ prereqs
+ exit 0
+ ;;
+esac
+
+. /usr/share/initramfs-tools/hook-functions
+
+THEME="$(/usr/sbin/plymouth-set-default-theme || true)"
+THEMES="/usr/share/plymouth/themes"
+
+if [ -n "${THEME}" ]
+then
+ THEME_NAME="${THEME}"
+ THEME="${THEMES}/${THEME}/${THEME}.plymouth"
+else
+ exit 0
+fi
+
+PLUGIN_PATH="$(plymouth --get-splash-plugin-path)"
+
+case "${THEME_NAME}" in
+ text|details|tribar)
+ PLUGINS="text.so details.so"
+ ;;
+
+ *)
+ PLUGINS="text.so details.so label.so"
+ ;;
+esac
+
+MODULE="${PLUGIN_PATH}/$(sed -n 's/^ModuleName=\(.*\)/\1/p' ${THEME}).so"
+
+if [ ! -e "$MODULE" ]
+then
+ echo "W: plymouth module ($MODULE) missing, skipping plymouth."
+ exit 0
+fi
+
+# copy plugin and images for current theme
+copy_exec "${MODULE}"
+mkdir -p "${DESTDIR}/${THEMES}"
+cp -r "${THEMES}/${THEME_NAME}" "${DESTDIR}/${THEMES}"
+
+# copy binaries and base plugins
+copy_exec /bin/plymouth
+copy_exec /sbin/plymouthd
+
+for PLUGIN in ${PLUGINS}
+do
+ if [ -f ${PLUGIN_PATH}/${PLUGIN} ]
+ then
+ copy_exec ${PLUGIN_PATH}/${PLUGIN}
+ else
+ echo "W: plymouth: The plugin ${PLUGIN} is missing, the selected theme might not work as expected."
+ echo "W: plymouth: You might want to install the plymouth-themes package to fix this."
+ fi
+done
+
+# copy base themes and logo
+cp -a "${THEMES}/details" "${DESTDIR}/${THEMES}"
+cp -a "${THEMES}/text" "${DESTDIR}/${THEMES}"
+
+if [ -f /etc/os-release ]
+then
+ cp /etc/os-release "${DESTDIR}/etc"
+fi
+
+case "${THEME_NAME}" in
+ text|details)
+
+ ;;
+
+ *)
+ cp /usr/share/plymouth/debian-logo.png "${DESTDIR}/usr/share/plymouth"
+
+ # fontconfig
+ mkdir -p "${DESTDIR}/etc/fonts/conf.d"
+ cp -a /etc/fonts/fonts.conf "${DESTDIR}/etc/fonts"
+ cp -rL /etc/fonts/conf.d/60-latin.conf "${DESTDIR}/etc/fonts/conf.d"
+ mkdir -p "${DESTDIR}/var/cache/fontconfig"
+ # This is only needed because fc-cache bellow fails if the directory doesn't exist
+ mkdir -p "${DESTDIR}/usr/local/share/fonts"
+
+ # fonts-dejavu
+ if [ -e /usr/share/fonts/truetype/dejavu/DejaVuSerif.ttf ]
+ then
+ # jessie
+ mkdir -p "${DESTDIR}/usr/share/fonts/truetype/dejavu"
+ cp -a /usr/share/fonts/truetype/dejavu/DejaVuSerif.ttf "${DESTDIR}/usr/share/fonts/truetype/dejavu"
+ cp -a /usr/share/fonts/truetype/dejavu/DejaVuSans.ttf "${DESTDIR}/usr/share/fonts/truetype/dejavu"
+ else
+ # wheezy
+ mkdir -p "${DESTDIR}/usr/share/fonts/truetype/ttf-dejavu"
+ cp -a /usr/share/fonts/truetype/ttf-dejavu/DejaVuSerif.ttf "${DESTDIR}/usr/share/fonts/truetype/ttf-dejavu"
+ cp -a /usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf "${DESTDIR}/usr/share/fonts/truetype/ttf-dejavu"
+ fi
+ fc-cache -s -y "${DESTDIR}" > /dev/null 2>&1
+
+ # pango
+ if ls /usr/lib/@DEB_HOST_MULTIARCH@/pango/1* > /dev/null 2>&1
+ then
+ # wheezy
+ PANGO_VERSION="$(ls /usr/lib/@DEB_HOST_MULTIARCH@/pango)"
+
+ mkdir -p "${DESTDIR}/usr/lib/@DEB_HOST_MULTIARCH@/pango/${PANGO_VERSION}/module-files.d"
+ mkdir -p "${DESTDIR}/usr/lib/@DEB_HOST_MULTIARCH@/pango/${PANGO_VERSION}/modules"
+ cp /usr/lib/@DEB_HOST_MULTIARCH@/pango/${PANGO_VERSION}/module-files.d/libpango1.0-0.modules ${DESTDIR}/usr/lib/@DEB_HOST_MULTIARCH@/pango/${PANGO_VERSION}/module-files.d/
+ copy_exec /usr/lib/@DEB_HOST_MULTIARCH@/pango/${PANGO_VERSION}/modules/pango-basic-fc.so
+ else
+ # jessie
+ copy_exec /usr/lib/@DEB_HOST_MULTIARCH@/libpango-1.0.so.0
+ fi
+ ;;
+esac
+
+# add drm modules
+copy_modules_dir kernel/drivers/gpu/drm mga r128 savage sis tdfx via
+
+# copy renderers
+copy_exec /usr/lib/@DEB_HOST_MULTIARCH@/plymouth/renderers/frame-buffer.so
+copy_exec /usr/lib/@DEB_HOST_MULTIARCH@/plymouth/renderers/drm.so
+
+# copy config files
+mkdir -p "${DESTDIR}/etc/plymouth"
+
+if [ -r /etc/plymouth/plymouthd.conf ]
+then
+ cp -a /etc/plymouth/plymouthd.conf "${DESTDIR}/etc/plymouth/"
+fi
+
+cp -a /usr/share/plymouth/plymouthd.defaults "${DESTDIR}/usr/share/plymouth/"
+
+# temporarily include dummy root account lookup (#691598)
+if ! grep -qs '^root:' "${DESTDIR}/etc/passwd"
+then
+ echo "root:x:0:0:root:/root:/bin/sh" >> "${DESTDIR}/etc/passwd"
+fi
+
+if ! grep -qs '^passwd: files' "${DESTDIR}/etc/nsswitch.conf"
+then
+ echo "passwd: files" >> "${DESTDIR}/etc/nsswitch.conf"
+fi
+
+for _LIBRARY in /lib/@DEB_HOST_MULTIARCH@/libnss_files*
+do
+ if [ -e "${_LIBRARY}" ]
+ then
+ copy_exec "${_LIBRARY}"
+ fi
+done
bgstack15