]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
populate-initrd: Ensure all xkb stuff gets moved to initramfs
authorDiego Augusto <diego.augusto@protonmail.com>
Sat, 15 Oct 2022 17:38:50 +0000 (13:38 -0400)
committerRay Strode <rstrode@redhat.com>
Tue, 29 Nov 2022 14:22:06 +0000 (09:22 -0500)
Now that plymouth supports /dev/input directly, it's important
that the initramfs gains all the newly needed support files.

This commit adds the necessary changes to the script to ensure
those files get moved over.

Some contributions by n3rdopolis and Ray Strode.

scripts/plymouth-populate-initrd.in

index a130616f0f802177ac156b43e7ccf096f636ade7..6ee6b3533fa821d19b1081199d022dc30758c3c3 100755 (executable)
@@ -33,6 +33,10 @@ ddebug() {
     [ "$verbose" = "true" ] && echo "$@"
 }
 
+dfatal() {
+    echo "$@" > /proc/self/fd/2
+}
+
 # normalize_path <path>
 # Prints the normalized path, where it removes any duplicated
 # and trailing slashes.
@@ -420,12 +424,13 @@ function usage() {
         rc=1
     fi
 
-    echo "usage: plymouth [ --verbose | -v ] { --targetdir | -t } <initrd_directory>" > $output
+    echo "usage: plymouth [ --verbose | -v ] { --targetdir | -t } <initrd_directory> { --x11-directory | -x } <x11_directory>" > $output
     exit $rc
 }
 
 verbose=false
 INITRDDIR=""
+X11_DIRECTORY="/usr/share/X11"
 while [ $# -gt 0 ]; do
     case $1 in
         --verbose|-v)
@@ -438,6 +443,10 @@ while [ $# -gt 0 ]; do
         --help|-h)
             usage normal
             ;;
+        --x11-directory|-x)
+            shift
+            X11_DIRECTORY="$1"
+            ;;
         *)
             usage error
             break
@@ -465,6 +474,51 @@ inst @RELEASE_FILE@ $INITRDDIR
 inst ${PLYMOUTH_POLICYDIR}/plymouthd.defaults $INITRDDIR
 inst ${PLYMOUTH_CONFDIR}/plymouthd.conf $INITRDDIR
 
+# Install xkb info
+mkdir -p "${INITRDDIR}/${X11_DIRECTORY}/xkb/"
+mkdir -p "${INITRDDIR}/${X11_DIRECTORY}/xkb/compat/"
+
+mkdir -p "${INITRDDIR}/${X11_DIRECTORY}/xkb/keycodes/"
+mkdir -p "${INITRDDIR}/${X11_DIRECTORY}/xkb/rules/"
+mkdir -p "${INITRDDIR}/${X11_DIRECTORY}/xkb/symbols/"
+mkdir -p "${INITRDDIR}/${X11_DIRECTORY}/xkb/types/"
+mkdir -p "${INITRDDIR}/${X11_DIRECTORY}/locale/"
+inst ${X11_DIRECTORY}/xkb/compat/accessx $INITRDDIR
+inst ${X11_DIRECTORY}/xkb/compat/basic $INITRDDIR
+inst ${X11_DIRECTORY}/xkb/compat/caps $INITRDDIR
+inst ${X11_DIRECTORY}/xkb/compat/complete $INITRDDIR
+inst ${X11_DIRECTORY}/xkb/compat/iso9995 $INITRDDIR
+inst ${X11_DIRECTORY}/xkb/compat/ledcaps $INITRDDIR
+inst ${X11_DIRECTORY}/xkb/compat/lednum $INITRDDIR
+inst ${X11_DIRECTORY}/xkb/compat/ledscroll $INITRDDIR
+inst ${X11_DIRECTORY}/xkb/compat/level5 $INITRDDIR
+inst ${X11_DIRECTORY}/xkb/compat/misc $INITRDDIR
+inst ${X11_DIRECTORY}/xkb/compat/mousekeys $INITRDDIR
+inst ${X11_DIRECTORY}/xkb/compat/xfree86 $INITRDDIR
+inst ${X11_DIRECTORY}/xkb/keycodes/aliases $INITRDDIR
+inst ${X11_DIRECTORY}/xkb/keycodes/evdev $INITRDDIR
+inst ${X11_DIRECTORY}/xkb/rules/evdev $INITRDDIR
+find ${X11_DIRECTORY}/xkb/symbols -maxdepth 1 ! -type d | while read file; do
+    inst $file $INITRDDIR
+done
+inst ${X11_DIRECTORY}/xkb/types/basic $INITRDDIR
+inst ${X11_DIRECTORY}/xkb/types/complete $INITRDDIR
+inst ${X11_DIRECTORY}/xkb/types/extra $INITRDDIR
+inst ${X11_DIRECTORY}/xkb/types/iso9995 $INITRDDIR
+inst ${X11_DIRECTORY}/xkb/types/level5 $INITRDDIR
+inst ${X11_DIRECTORY}/xkb/types/mousekeys $INITRDDIR
+inst ${X11_DIRECTORY}/xkb/types/numpad $INITRDDIR
+inst ${X11_DIRECTORY}/xkb/types/pc $INITRDDIR
+
+# In the off chance the user uses their compose key when
+# typing their password, install compose sequences
+inst ${X11_DIRECTORY}/locale/compose.dir $INITRDDIR
+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
+        inst $file $INITRDDIR
+     done
+done
+
 if [ -z "$PLYMOUTH_THEME_NAME" ]; then
     echo "No default plymouth plugin is set" >&2
     exit 1