Blame SOURCES/brltty-5.6-add-dracut-support.patch

8519d0
diff --git a/Headers/datafile.h b/Headers/datafile.h
8519d0
index f22457e..eec692c 100644
8519d0
--- a/Headers/datafile.h
8519d0
+++ b/Headers/datafile.h
8519d0
@@ -43,6 +43,7 @@ typedef enum {
8519d0
 
8519d0
 typedef struct {
8519d0
   DataOperandsProcessor *processOperands;
8519d0
+  void (*logFileName) (const char *name, void *data);
8519d0
   void *data;
8519d0
   unsigned char options;
8519d0
 } DataFileParameters;
8519d0
diff --git a/Initramfs/Dracut/Makefile.in b/Initramfs/Dracut/Makefile.in
8519d0
new file mode 100644
8519d0
index 0000000..8a7f6de
8519d0
--- /dev/null
8519d0
+++ b/Initramfs/Dracut/Makefile.in
8519d0
@@ -0,0 +1,34 @@
8519d0
+MODULE_NAME = 99brltty
8519d0
+MODULES_DIRECTORY = /usr/lib/dracut/modules.d
8519d0
+MODULE_DIRECTORY = $(INSTALL_ROOT)$(MODULES_DIRECTORY)/$(MODULE_NAME)
8519d0
+
8519d0
+install: install-module install-documentation install-configuration-files
8519d0
+
8519d0
+install-module: install-module-directory
8519d0
+	for file in *.sh; \
8519d0
+	do $(INSTALL_SCRIPT) $$file $(MODULE_DIRECTORY); \
8519d0
+	done
8519d0
+
8519d0
+install-documentation: install-module-directory
8519d0
+	$(INSTALL_DATA) README $(MODULE_DIRECTORY)
8519d0
+
8519d0
+install-module-directory:
8519d0
+	$(INSTALL_DIRECTORY) $(MODULE_DIRECTORY)
8519d0
+
8519d0
+OPTIONS_FILE = cmdline
8519d0
+CONFIGURATION_FILE = dracut.conf
8519d0
+INITRAMFS_SUBDIRECTORY = Initramfs
8519d0
+INITRAMFS_DIRECTORY = $(TABLES_DIRECTORY)/$(INITRAMFS_SUBDIRECTORY)
8519d0
+INSTALL_INITRAMFS_DIRECTORY = $(INSTALL_ROOT)$(INITRAMFS_DIRECTORY)
8519d0
+
8519d0
+install-initramfs-directory:
8519d0
+	$(INSTALL_DIRECTORY) $(INSTALL_INITRAMFS_DIRECTORY)
8519d0
+
8519d0
+install-configuration-files: install-initramfs-directory
8519d0
+	$(INSTALL_DATA) $(OPTIONS_FILE) $(INSTALL_INITRAMFS_DIRECTORY)
8519d0
+	$(INSTALL_DATA) $(CONFIGURATION_FILE) $(INSTALL_INITRAMFS_DIRECTORY)
8519d0
+	sed -e '/^ *BRLTTY_DRACUT_LOCALE *= *"/s/".*"/"${LANG}"/' -i $(INSTALL_INITRAMFS_DIRECTORY)/$(CONFIGURATION_FILE)
8519d0
+
8519d0
+uninstall:
8519d0
+	-rm -f -r  $(MODULE_DIRECTORY)
8519d0
+
8519d0
diff --git a/Initramfs/Dracut/README b/Initramfs/Dracut/README
8519d0
new file mode 100644
8519d0
index 0000000..ccf6baa
8519d0
--- /dev/null
8519d0
+++ b/Initramfs/Dracut/README
8519d0
@@ -0,0 +1,215 @@
8519d0
+Braille Support for Dracut
8519d0
+==========================
8519d0
+
8519d0
+This module implements braille accessibility within the initramfs (initial
8519d0
+ramdisk file system). If BRLTTY is installed (``/usr/bin/brltty`` exists) then
8519d0
+it is added to the image. The braille drivers, text tables, attributes tables,
8519d0
+contraction tables, keyboard tables, speech drivers, and preferences file
8519d0
+configured via ``/etc/brltty.conf`` are included. Local customizations within
8519d0
+``/etc/xdg/brltty/`` are also included.
8519d0
+
8519d0
+BRLTTY is started as early as possible by the initramfs so that braille
8519d0
+accessibility will be active when (should the need arise) control is
8519d0
+transferred to the emergency shell due to a problem preparing the root file
8519d0
+system. Additionally, braille accessibility is active at any of the specifiable
8519d0
+initramfs breakpoints (see the ``rd.break`` kernel parameter) except for the
8519d0
+one named ``cmdline`` because it occurs earlier than the point at which BRLTTY
8519d0
+is started.
8519d0
+
8519d0
+The braille driver can start immediately if either serial or USB communication
8519d0
+is being used. If Bluetooth communication is being used then the braille driver
8519d0
+won't start until the ``initqueue`` phase because the Systemd service manager
8519d0
+isn't available until then.
8519d0
+
8519d0
+Bluetooth support within the initramfs is disabled by default because it's
8519d0
+insecure. The reason for this is that the link keys for those devices that have
8519d0
+already been paired on the full system are copied into the initramfs image so
8519d0
+that repairing won't be necessary. If you absolutely must use Bluetooth
8519d0
+communication, or if you just want to and this issue is of no concern to you,
8519d0
+then enable the ``BRLTTY_DRACUT_BLUETOOTH_SUPPORT`` option within the file
8519d0
+``dracut.conf`` (which is in ``/etc/brltty/Initramfs/``).
8519d0
+
8519d0
+Environment Variables
8519d0
+---------------------
8519d0
+
8519d0
+A number of environment variables may be used to influence how BRLTTY is
8519d0
+installed into the initramfs image. Their names all begin with the
8519d0
+``BRLTTY_DRACUT_`` prefix. In addition to exporting them from the current
8519d0
+environment, they may be defined within the optional file ``dracut.conf``
8519d0
+(which is in ``/etc/brltty/Initramfs/``). Within this file:
8519d0
+
8519d0
+* Blank lines are ignored.
8519d0
+* Lines that start with a hash [``#``] are comments.
8519d0
+* All other lines should be simple shell-style assignments. For example::
8519d0
+
8519d0
+    NAME="string"
8519d0
+
8519d0
+The following environment variables are supported:
8519d0
+
8519d0
+BRLTTY_DRACUT_LOCALE
8519d0
+  The preferred locale (used to determine the default text and contraction
8519d0
+  tables). For example::
8519d0
+
8519d0
+    BRLTTY_DRACUT_LOCALE=cs_CZ.UTF-8
8519d0
+
8519d0
+  If needed, i.e. if the text and contraction tables haven't both been
8519d0
+  configured via ``/etc/brltty.conf``, this information must be explicitly set
8519d0
+  because it can't be determined from the system configuration when building
8519d0
+  the image (see `<https://bugzilla.redhat.com/show_bug.cgi?id=1584036>`_).
8519d0
+
8519d0
+BRLTTY_DRACUT_BRAILLE_DRIVERS
8519d0
+  A space-separated list of additional braille drivers to include. For
8519d0
+  example::
8519d0
+
8519d0
+    BRLTTY_DRACUT_BRAILLE_DRIVERS="pm eu"
8519d0
+
8519d0
+BRLTTY_DRACUT_BLUETOOTH_SUPPORT
8519d0
+  Whether or not Bluetooth support should be included within the initramfs. For
8519d0
+  example::
8519d0
+
8519d0
+    BRLTTY_DRACUT_BLUETOOTH_SUPPORT=no
8519d0
+
8519d0
+  Set this variable to ``yes`` if communication with your braille device is via
8519d0
+  Bluetooth. Note that this option is insecure because the link keys for all of
8519d0
+  your paired Bluetooth devices will be stored within the initramfs image.
8519d0
+
8519d0
+BRLTTY_DRACUT_TEXT_TABLES
8519d0
+  A space-separated list of additional text tables to include. For example::
8519d0
+
8519d0
+    BRLTTY_DRACUT_TEXT_TABLES="de fr"
8519d0
+
8519d0
+BRLTTY_DRACUT_ATTRIBUTES_TABLES
8519d0
+  A space-separated list of additional attributes tables to include. For
8519d0
+  example::
8519d0
+
8519d0
+    BRLTTY_DRACUT_ATTRIBUTES_TABLES="upper_lower left_right"
8519d0
+
8519d0
+BRLTTY_DRACUT_CONTRACTION_TABLES
8519d0
+  A space-separated list of additional contraction tables to include. For
8519d0
+  example::
8519d0
+
8519d0
+    BRLTTY_DRACUT_CONTRACTION_TABLES="de-kurzschrift fr-abrege"
8519d0
+
8519d0
+BRLTTY_DRACUT_KEYBOARD_TABLES
8519d0
+  A space-separated list of additional keyboard tables to include. For
8519d0
+  example::
8519d0
+
8519d0
+    BRLTTY_DRACUT_KEYBOARD_TABLES="keypad desktop"
8519d0
+
8519d0
+BRLTTY_DRACUT_SPEECH_DRIVERS
8519d0
+  A space-separated list of additional speech drivers to include. For example::
8519d0
+
8519d0
+    BRLTTY_DRACUT_SPEECH_DRIVERS="es fl"
8519d0
+
8519d0
+Kernel Command Line Parameters
8519d0
+------------------------------
8519d0
+
8519d0
+This module interprets kernel command line parameters that begin with the
8519d0
+``rd.brltty.`` prefix. Explicit values for these parameters can, of course, be
8519d0
+specified on the kernel command line (e.g. within ``grub.cfg`` or within
8519d0
+``/etc/default/grub``). In addition, default values for them can be defined
8519d0
+within the optional file ``cmdline`` (which is in ``/etc/brltty/Initramfs/``).
8519d0
+
8519d0
+The order of precedence, from lowest to highest, for a value is:
8519d0
+
8519d0
+* BRLTTY built-in default
8519d0
+* ``/etc/brltty.conf``
8519d0
+* initramfs override
8519d0
+* ``/etc/brltty/Initramfs/cmdline``
8519d0
+* kernel command line
8519d0
+
8519d0
+Blank lines are ignored. A hash [``#``] anywhere on a line begins a comment
8519d0
+which continues till the end of that line - only those characters before it are
8519d0
+significant. Any number of space-separated options may be specified on a line.
8519d0
+The syntax for an option is ``name=value`` (without the ``rd.brltty.`` prefix).
8519d0
+The ``=value`` part is optional - if there's no ``=`` then the value is
8519d0
+``yes``.
8519d0
+
8519d0
+Disabling BRLTTY
8519d0
+````````````````
8519d0
+
8519d0
+Given that BRLTTY is a rather complex application, there are a number of kernel
8519d0
+parameters that can be used to selectively disable a number of its components.
8519d0
+In all cases, if any of these parameters isn't specified then it defaults to
8519d0
+``1`` (enabled). They are:
8519d0
+
8519d0
+  =========================  =========================================
8519d0
+  Kernel Parameter           Effect
8519d0
+  -------------------------  -----------------------------------------
8519d0
+  ``rd.brltty=0``            Completely disable BRLTTY.
8519d0
+  ``rd.brltty.bluetooth=0``  Disable Bluetooth support.
8519d0
+  ``rd.brltty.sound=0``      Disable speech drivers and sound support.
8519d0
+  ``rd.brltty.pulse=0``      Disable the Pulse Audio server.
8519d0
+  ``rd.brltty.speechd=0``    Disable the Speech Dispatcher server.
8519d0
+  =========================  =========================================
8519d0
+
8519d0
+Specifying BRLTTY options
8519d0
+`````````````````````````
8519d0
+
8519d0
+All of BRLTTY's options that can be specified via environment variables (see
8519d0
+``man brltty`` for the full list) can be specified via kernel parameters. For
8519d0
+example, the kernel parameter ``rd.brltty.braille_driver=vo`` is mapped to the
8519d0
+environment variable assignment ``BRLTTY_BRAILLE_DRIVER=vo``. Some of the more
8519d0
+interesting ones are:
8519d0
+
8519d0
+  ================================  ===============================
8519d0
+  Kernel Parameter                  Default Value
8519d0
+  --------------------------------  -------------------------------
8519d0
+  ``rd.brltty.braille_driver``      setting in ``/etc/brltty.conf``
8519d0
+  ``rd.brltty.braille_parameters``  setting in ``/etc/brltty.conf``
8519d0
+  ``rd.brltty.braille_device``      setting in ``/etc/brltty.conf``
8519d0
+  ``rd.brltty.text_table``          setting in ``/etc/brltty.conf``
8519d0
+  ``rd.brltty.attributes_table``    setting in ``/etc/brltty.conf``
8519d0
+  ``rd.brltty.contraction_table``   setting in ``/etc/brltty.conf``
8519d0
+  ``rd.brltty.keyboard_table``      setting in ``/etc/brltty.conf``
8519d0
+  ``rd.brltty.speech_driver``       setting in ``/etc/brltty.conf``
8519d0
+  ``rd.brltty.speech_parameters``   setting in ``/etc/brltty.conf``
8519d0
+  ``rd.brltty.log_file``            ``/run/initramfs/brltty.log``
8519d0
+  ``rd.brltty.log_level``           setting in ``/etc/brltty.conf``
8519d0
+  ================================  ===============================
8519d0
+
8519d0
+Speech Drivers
8519d0
+--------------
8519d0
+
8519d0
+Since speech drivers, by their very nature, require sound:
8519d0
+
8519d0
+* None of them can start until the ``initqueue`` hook has been executed.
8519d0
+
8519d0
+* None of them can start if sound has been disabled (via the rd.brltty.sound=0
8519d0
+  kernel parameter).
8519d0
+
8519d0
+Speech defaults to being off even if a speech driver has been configured via
8519d0
+``/etc/brltty.conf``. This is because your preferred speech driver may not work
8519d0
+all that well, or may even cause problems, when used within the more primitive
8519d0
+initramfs environment. If you'd like to use speech then you need to explicitly
8519d0
+set the driver. While you can do so via the ``rd.brltty.speech_driver`` kernel
8519d0
+command line parameter, the easiest way to configure a persistent setting is
8519d0
+via the ``speech_driver`` option in ``/etc/brltty/Initramfs/cmdline``.
8519d0
+
8519d0
+Here's how well each of the speech drivers works:
8519d0
+
8519d0
+en
8519d0
+  The ``en`` [eSpeak-NG] speech driver works.
8519d0
+
8519d0
+es
8519d0
+  The ``es`` [eSpeak] speech driver works. It requires Pulse Audio, so:
8519d0
+
8519d0
+  * It doesn't start until the ``initqueue`` hook has been executed.
8519d0
+
8519d0
+  * It can't start if Pulse Audio fails to start or has been disabled (via
8519d0
+    the rd.brltty.pulse=0 kernel parameter).
8519d0
+
8519d0
+fl
8519d0
+  The ``fl`` [Festival Lite] speech driver doesn't work - it runs but doesn't
8519d0
+  speak. This appears to be due to a bug within Festival Lite itself because
8519d0
+  it also remains silent when tested on the full system.
8519d0
+
8519d0
+fv
8519d0
+  The ``fv`` [Festival] speech driver doesn't work - it crashes. This appears
8519d0
+  to be due to a bug within Festival itself because it also crashes when tested
8519d0
+  on the full system.
8519d0
+
8519d0
+sd
8519d0
+  The ``sd`` [Speech Dispatcher] speech driver hasn't been tested and probably
8519d0
+  won't work.
8519d0
+
8519d0
diff --git a/Initramfs/Dracut/alsa-start.sh b/Initramfs/Dracut/alsa-start.sh
8519d0
new file mode 100755
8519d0
index 0000000..26ab4a1
8519d0
--- /dev/null
8519d0
+++ b/Initramfs/Dracut/alsa-start.sh
8519d0
@@ -0,0 +1,5 @@
8519d0
+#!/bin/bash
8519d0
+
8519d0
+getargbool 1 rd.brltty && getargbool 1 rd.brltty.sound && {
8519d0
+   alsaunmute
8519d0
+}
8519d0
diff --git a/Initramfs/Dracut/bluetooth-start.sh b/Initramfs/Dracut/bluetooth-start.sh
8519d0
new file mode 100755
8519d0
index 0000000..0d574d1
8519d0
--- /dev/null
8519d0
+++ b/Initramfs/Dracut/bluetooth-start.sh
8519d0
@@ -0,0 +1,7 @@
8519d0
+#!/bin/bash
8519d0
+
8519d0
+getargbool 1 rd.brltty && getargbool 1 rd.brltty.bluetooth && {
8519d0
+   systemctl -q is-active bluetooth || {
8519d0
+      systemctl --no-block start bluetooth
8519d0
+   }
8519d0
+}
8519d0
diff --git a/Initramfs/Dracut/brltty-start.sh b/Initramfs/Dracut/brltty-start.sh
8519d0
new file mode 100755
8519d0
index 0000000..ea51437
8519d0
--- /dev/null
8519d0
+++ b/Initramfs/Dracut/brltty-start.sh
8519d0
@@ -0,0 +1,78 @@
8519d0
+#!/bin/bash
8519d0
+
8519d0
+export BRLTTY_START_MESSAGE="initramfs starting"
8519d0
+export BRLTTY_STOP_MESSAGE="initramfs finished"
8519d0
+
8519d0
+BRLTTY_OVERRIDE_PREFERENCE="braille-keyboard-enabled=yes"
8519d0
+BRLTTY_OVERRIDE_PREFERENCE+=",braille-input-mode=text"
8519d0
+export BRLTTY_OVERRIDE_PREFERENCE
8519d0
+
8519d0
+export BRLTTY_SCREEN_DRIVER="lx"
8519d0
+export BRLTTY_SPEECH_DRIVER="no"
8519d0
+
8519d0
+export BRLTTY_WRITABLE_DIRECTORY="/run"
8519d0
+export BRLTTY_PID_FILE="${BRLTTY_WRITABLE_DIRECTORY}/brltty.pid"
8519d0
+export BRLTTY_LOG_FILE="${BRLTTY_WRITABLE_DIRECTORY}/initramfs/brltty.log"
8519d0
+
8519d0
+export BRLTTY_UPDATABLE_DIRECTORY="/etc"
8519d0
+export BRLTTY_PREFERENCES_FILE="${BRLTTY_UPDATABLE_DIRECTORY}/brltty.prefs"
8519d0
+
8519d0
+brlttySetOption() {
8519d0
+   local option="${1}"
8519d0
+   local name="${option%%=*}"
8519d0
+
8519d0
+   if [ "${name}" = "${option}" ]
8519d0
+   then
8519d0
+      local value="yes"
8519d0
+   else
8519d0
+      local value="${option#*=}"
8519d0
+   fi
8519d0
+
8519d0
+   [ -z "${name}" ] || {
8519d0
+      name="${name^^?}"
8519d0
+      export "BRLTTY_${name}=${value}"
8519d0
+   }
8519d0
+}
8519d0
+
8519d0
+brlttySetConfiguredOptions() {
8519d0
+   local file="/etc/brltty/Initramfs/cmdline"
8519d0
+
8519d0
+   [ -f "${file}" ] && [ -r "${file}" ] && {
8519d0
+      local line
8519d0
+
8519d0
+      while read line
8519d0
+      do
8519d0
+         set -- ${line%%#*}
8519d0
+         local option
8519d0
+
8519d0
+         for option
8519d0
+         do
8519d0
+            brlttySetOption "${option}"
8519d0
+         done
8519d0
+      done <"${file}"
8519d0
+   }
8519d0
+}
8519d0
+
8519d0
+brlttySetExplicitOptions() {
8519d0
+   local option
8519d0
+
8519d0
+   for option
8519d0
+   do
8519d0
+      [[ "${option}" =~ ^"rd.brltty."(.*) ]] && {
8519d0
+         brlttySetOption "${BASH_REMATCH[1]}"
8519d0
+      }
8519d0
+   done
8519d0
+}
8519d0
+
8519d0
+brlttySetConfiguredOptions
8519d0
+brlttySetExplicitOptions $(getcmdline)
8519d0
+getargbool 1 rd.brltty.sound || export BRLTTY_SPEECH_DRIVER="no"
8519d0
+
8519d0
+getargbool 1 rd.brltty && (
8519d0
+   # Give the kernel a bit of time to finish creating the /dev/input/ devices
8519d0
+   # (e.g. so that brltty can perform keyboard discovery for keyboard tables)
8519d0
+   # without delaying the boot.
8519d0
+
8519d0
+   sleep 1
8519d0
+   brltty -E +n
8519d0
+) &
8519d0
diff --git a/Initramfs/Dracut/brltty-stop.sh b/Initramfs/Dracut/brltty-stop.sh
8519d0
new file mode 100755
8519d0
index 0000000..27611ab
8519d0
--- /dev/null
8519d0
+++ b/Initramfs/Dracut/brltty-stop.sh
8519d0
@@ -0,0 +1,3 @@
8519d0
+#!/bin/bash
8519d0
+
8519d0
+brltty -E -C
8519d0
diff --git a/Initramfs/Dracut/cmdline b/Initramfs/Dracut/cmdline
8519d0
new file mode 100644
8519d0
index 0000000..39aefd3
8519d0
--- /dev/null
8519d0
+++ b/Initramfs/Dracut/cmdline
8519d0
@@ -0,0 +1,16 @@
8519d0
+# This file is where you can specify any rd.brltty. kernel parameters that are
8519d0
+# to be included within the initramfs image and applied as default values.
8519d0
+
8519d0
+# The order of precedence, from lowest to highest, for an option's value is:
8519d0
+# * BRLTTY built-in default
8519d0
+# * /etc/brltty.conf
8519d0
+# * initramfs override
8519d0
+# * this file
8519d0
+# * kernel command line
8519d0
+
8519d0
+# Blank lines are ignored. A hash [#] anywhere on a line begins a comment which
8519d0
+# continues till the end of that line - only those characters before it are
8519d0
+# significant. Any number of space-separated options may be specified on a
8519d0
+# line. The syntax for an option is name=value (without the rd.brltty. prefix).
8519d0
+# The =value part is optional - if there's no = then the value is yes.
8519d0
+
8519d0
diff --git a/Initramfs/Dracut/dbus-start.sh b/Initramfs/Dracut/dbus-start.sh
8519d0
new file mode 100755
8519d0
index 0000000..fd9e210
8519d0
--- /dev/null
8519d0
+++ b/Initramfs/Dracut/dbus-start.sh
8519d0
@@ -0,0 +1,7 @@
8519d0
+#!/bin/bash
8519d0
+
8519d0
+getargbool 1 rd.brltty && getargbool 1 rd.brltty.bluetooth && {
8519d0
+   systemctl -q is-active dbus || {
8519d0
+      systemctl --no-block start dbus
8519d0
+   }
8519d0
+}
8519d0
diff --git a/Initramfs/Dracut/dracut.conf b/Initramfs/Dracut/dracut.conf
8519d0
new file mode 100644
8519d0
index 0000000..2d03996
8519d0
--- /dev/null
8519d0
+++ b/Initramfs/Dracut/dracut.conf
8519d0
@@ -0,0 +1,27 @@
8519d0
+# The preferred locale (used to determine the default text and contraction tables).
8519d0
+BRLTTY_DRACUT_LOCALE=""
8519d0
+
8519d0
+# A space-separated list of additional braille drivers to include.
8519d0
+BRLTTY_DRACUT_BRAILLE_DRIVERS=""
8519d0
+
8519d0
+# Whether or not Bluetooth support should be included within the initramfs.
8519d0
+# Set this variable to yes if communication with your braille device is via
8519d0
+# Bluetooth. Note that this option is insecure because the link keys for all of
8519d0
+# your paired Bluetooth devices will be stored within the initramfs image.
8519d0
+BRLTTY_DRACUT_BLUETOOTH_SUPPORT=no
8519d0
+
8519d0
+# A space-separated list of additional text tables to include.
8519d0
+BRLTTY_DRACUT_TEXT_TABLES=""
8519d0
+
8519d0
+# A space-separated list of additional attributes tables to include.
8519d0
+BRLTTY_DRACUT_ATTRIBUTES_TABLES=""
8519d0
+
8519d0
+# A space-separated list of additional contraction tables to include.
8519d0
+BRLTTY_DRACUT_CONTRACTION_TABLES=""
8519d0
+
8519d0
+# A space-separated list of additional keyboard tables to include.
8519d0
+BRLTTY_DRACUT_KEYBOARD_TABLES=""
8519d0
+
8519d0
+# A space-separated list of additional speech drivers to include.
8519d0
+BRLTTY_DRACUT_SPEECH_DRIVERS=""
8519d0
+
8519d0
diff --git a/Initramfs/Dracut/module-setup.sh b/Initramfs/Dracut/module-setup.sh
8519d0
new file mode 100755
8519d0
index 0000000..8f6e5ca
8519d0
--- /dev/null
8519d0
+++ b/Initramfs/Dracut/module-setup.sh
8519d0
@@ -0,0 +1,326 @@
8519d0
+#!/bin/bash
8519d0
+
8519d0
+# called by dracut
8519d0
+check() {
8519d0
+   require_binaries brltty brltty-lsinc || return 1
8519d0
+   return 0
8519d0
+}
8519d0
+
8519d0
+# called by dracut
8519d0
+depends() {
8519d0
+   return 0
8519d0
+}
8519d0
+
8519d0
+# called by dracut
8519d0
+installkernel() {
8519d0
+   instmods pcspkr uinput
8519d0
+   [ -d "${initdir}/etc/bluetooth" ] && instmods =drivers/bluetooth =net/bluetooth
8519d0
+   [ -d "${initdir}/etc/alsa" ] && instmods =sound
8519d0
+   return 0
8519d0
+}
8519d0
+
8519d0
+# called by dracut
8519d0
+install() {
8519d0
+   brlttyImportInstallOptions
8519d0
+   local -A includedDrivers
8519d0
+
8519d0
+   local BRLTTY_EXECUTABLE_PATH="/usr/bin/brltty"
8519d0
+   inst_binary "${BRLTTY_EXECUTABLE_PATH}"
8519d0
+   local brlttyLog="$(LC_ALL="${BRLTTY_DRACUT_LOCALE:-${LANG}}" "${BRLTTY_EXECUTABLE_PATH}" -E -v -e -ldebug 2>&1)"
8519d0
+   
8519d0
+   export BRLTTY_CONFIGURATION_FILE="/etc/brltty.conf"
8519d0
+   brlttyIncludeDataFiles "${BRLTTY_CONFIGURATION_FILE}"
8519d0
+
8519d0
+   brlttyIncludeDataFiles $(brlttyGetProperty "including data file")
8519d0
+   brlttyIncludeScreenDrivers lx
8519d0
+
8519d0
+   brlttyIncludeBrailleDrivers $(brlttyGetConfiguredDrivers braille)
8519d0
+   brlttyIncludeBrailleDrivers ${BRLTTY_DRACUT_BRAILLE_DRIVERS}
8519d0
+
8519d0
+   brlttyIncludeSpeechDrivers $(brlttyGetConfiguredDrivers speech)
8519d0
+   brlttyIncludeSpeechDrivers ${BRLTTY_DRACUT_SPEECH_DRIVERS}
8519d0
+      
8519d0
+   brlttyIncludeTables Text        ttb ${BRLTTY_DRACUT_TEXT_TABLES}
8519d0
+   brlttyIncludeTables Attributes  atb ${BRLTTY_DRACUT_ATTRIBUTES_TABLES}
8519d0
+   brlttyIncludeTables Contraction ctb ${BRLTTY_DRACUT_CONTRACTION_TABLES}
8519d0
+   brlttyIncludeTables Keyboard    ktb ${BRLTTY_DRACUT_KEYBOARD_TABLES}
8519d0
+
8519d0
+   brlttyInstallPreferencesFile "/etc/brltty.prefs"
8519d0
+   brlttyInstallDirectories "/etc/xdg/brltty"
8519d0
+   inst_simple "/etc/brltty/Initramfs/cmdline"
8519d0
+
8519d0
+   if [ "${BRLTTY_DRACUT_BLUETOOTH_SUPPORT}" = "yes" ]
8519d0
+   then
8519d0
+      brlttyIncludeBluetoothSupport
8519d0
+   fi
8519d0
+
8519d0
+   inst_hook cmdline 05 "${moddir}/brltty-start.sh"
8519d0
+   inst_hook cleanup 95 "${moddir}/brltty-stop.sh"
8519d0
+
8519d0
+   dracut_need_initqueue
8519d0
+}
8519d0
+
8519d0
+brlttyInstallPreferencesFile() {
8519d0
+   local path="${1}"
8519d0
+   local file=$(brlttyGetProperty "Preferences File")
8519d0
+
8519d0
+   if [ -n "${file}" ]
8519d0
+   then
8519d0
+      if [ "${file}" = "${file#/}" ]
8519d0
+      then
8519d0
+         local directory=$(brlttyGetProperty "Updatable Directory")
8519d0
+
8519d0
+         if [ -n "${directory}" ]
8519d0
+         then
8519d0
+            file="${directory}/${file}"
8519d0
+         fi
8519d0
+      fi
8519d0
+
8519d0
+      if [ -f "${file}" ]
8519d0
+      then
8519d0
+         inst_simple "${file}" "${path}"
8519d0
+      fi
8519d0
+   fi
8519d0
+}
8519d0
+
8519d0
+brlttyIncludeBrailleDrivers() {
8519d0
+   local code
8519d0
+
8519d0
+   for code
8519d0
+   do
8519d0
+      brlttyIncludeDriver b "${code}" || continue
8519d0
+
8519d0
+      local directory="/etc/brltty/Input/${code}"
8519d0
+      brlttyIncludeDataFiles "${directory}/"*.ktb
8519d0
+      inst_multiple -o "${directory}/"*.txt
8519d0
+   done
8519d0
+}
8519d0
+
8519d0
+brlttyIncludeSpeechDrivers() {
8519d0
+   local code
8519d0
+
8519d0
+   for code
8519d0
+   do
8519d0
+      brlttyIncludeDriver s "${code}" || continue
8519d0
+
8519d0
+      case "${code}"
8519d0
+      in
8519d0
+         en)
8519d0
+            inst_binary espeak-ng
8519d0
+            brlttyInstallDirectories "/usr/share/espeak-ng-data"
8519d0
+            ;;
8519d0
+
8519d0
+         es)
8519d0
+            inst_binary espeak
8519d0
+            brlttyInstallDirectories "/usr/share/espeak-data"
8519d0
+            brlttyIncludePulseAudioSupport
8519d0
+            ;;
8519d0
+
8519d0
+         fl)
8519d0
+            inst_binary flite
8519d0
+            ;;
8519d0
+
8519d0
+         fv)
8519d0
+            inst_binary festival
8519d0
+            brlttyInstallDirectories /etc/festival
8519d0
+            brlttyInstallDirectories /usr/lib*/festival
8519d0
+            brlttyInstallDirectories /usr/share/festival/lib
8519d0
+            ;;
8519d0
+
8519d0
+         sd)
8519d0
+            inst_binary speech-dispatcher
8519d0
+            brlttyInstallDirectories /etc/speech-dispatcher
8519d0
+            brlttyInstallDirectories /usr/lib*/speech-dispatcher
8519d0
+            brlttyInstallDirectories /usr/lib*/speech-dispatcher-modules
8519d0
+            brlttyInstallDirectories /usr/share/speech-dispatcher
8519d0
+            brlttyInstallDirectories /usr/share/sounds/speech-dispatcher
8519d0
+            brlttyInstallSystemdUnits speech-dispatcherd.service
8519d0
+            inst_hook initqueue 98 "${moddir}/speechd-start.sh"
8519d0
+            ;;
8519d0
+      esac
8519d0
+
8519d0
+      brlttyIncludeAlsaSupport
8519d0
+   done
8519d0
+}
8519d0
+
8519d0
+brlttyIncludeScreenDrivers() {
8519d0
+   local code
8519d0
+
8519d0
+   for code
8519d0
+   do
8519d0
+      brlttyIncludeDriver x "${code}" || continue
8519d0
+   done
8519d0
+}
8519d0
+
8519d0
+brlttyIncludeDriver() {
8519d0
+   local type="${1}"
8519d0
+   local code="${2}"
8519d0
+
8519d0
+   [ "${code}" = "no" ] && return 1
8519d0
+   local driver="${type}${code}"
8519d0
+
8519d0
+   [ -n "${includedDrivers[${driver}]}" ] && return 2
8519d0
+   includedDrivers[${driver}]=1
8519d0
+
8519d0
+   inst_libdir_file "brltty/libbrltty${driver}.so*"
8519d0
+   return 0
8519d0
+}
8519d0
+
8519d0
+brlttyIncludeTables() {
8519d0
+   local subdirectory="${1}"
8519d0
+   local extension="${2}"
8519d0
+   shift 2
8519d0
+   local name
8519d0
+
8519d0
+   for name
8519d0
+   do
8519d0
+      brlttyIncludeDataFiles "/etc/brltty/${subdirectory}/${name}.${extension}"
8519d0
+   done
8519d0
+}
8519d0
+
8519d0
+brlttyIncludeDataFiles() {
8519d0
+   local file
8519d0
+
8519d0
+   while read -r file
8519d0
+   do
8519d0
+      inst_simple "${file}"
8519d0
+   done < <(brltty-lsinc "${@}")
8519d0
+}
8519d0
+
8519d0
+brlttyGetConfiguredDrivers() {
8519d0
+   local category="${1}"
8519d0
+   brlttyGetProperty "checking for ${category} driver"
8519d0
+}
8519d0
+
8519d0
+brlttyGetProperty() {
8519d0
+   local name="${1}"
8519d0
+   echo "${brlttyLog}" | awk "/: *${name} *:/ {print \$NF}"
8519d0
+}
8519d0
+
8519d0
+brlttyImportInstallOptions() {
8519d0
+   local file="/etc/brltty/Initramfs/dracut.conf"
8519d0
+   [ -f "${file}" ] && [ -r "${file}" ] && . "${file}"
8519d0
+}
8519d0
+
8519d0
+brlttyIncludePulseAudioSupport() {
8519d0
+   [ -d "${initdir}/etc/pulse" ] && return 0
8519d0
+
8519d0
+   brlttyInstallDirectories /etc/pulse
8519d0
+   brlttyInstallDirectories /usr/share/pulseaudio
8519d0
+   brlttyInstallDirectories /usr/lib*/pulseaudio
8519d0
+   brlttyInstallDirectories /usr/lib*/pulse-*
8519d0
+   brlttyInstallDirectories /usr/libexec/pulse
8519d0
+
8519d0
+   inst_multiple -o pulseaudio pactl pacmd
8519d0
+   inst_multiple -o pamon paplay parec parecord
8519d0
+
8519d0
+   brlttyAddUserEntries pulse
8519d0
+   brlttyAddGroupEntries pulse pulse-access pulse-rt
8519d0
+
8519d0
+   brlttyIncludeAlsaSupport
8519d0
+   brlttyIncludeMessageBusSupport
8519d0
+   inst_simple /etc/dbus-1/system.d/pulseaudio-system.conf
8519d0
+
8519d0
+   inst_binary chmod
8519d0
+   inst_hook initqueue 97 "${moddir}/pulse-start.sh"
8519d0
+   inst_hook cleanup 98 "${moddir}/pulse-stop.sh"
8519d0
+}
8519d0
+
8519d0
+brlttyIncludeAlsaSupport() {
8519d0
+   [ -d "${initdir}/etc/alsa" ] && return 0;
8519d0
+
8519d0
+   brlttyInstallDirectories /etc/alsa
8519d0
+   rm -f "${initdir}/etc/alsa/conf.d/"*
8519d0
+
8519d0
+   brlttyInstallDirectories /usr/share/alsa
8519d0
+   brlttyInstallDirectories /usr/lib/alsa
8519d0
+   brlttyInstallDirectories /usr/lib*/alsa-lib
8519d0
+
8519d0
+   inst_multiple -o alsactl alsaucm alsamixer amixer aplay
8519d0
+   inst_script alsaunmute
8519d0
+
8519d0
+   inst_hook initqueue 96 "${moddir}/alsa-start.sh"
8519d0
+}
8519d0
+
8519d0
+brlttyIncludeBluetoothSupport() {
8519d0
+   [ -d "${initdir}/etc/bluetooth" ] && return 0
8519d0
+
8519d0
+   brlttyInstallDirectories /etc/bluetooth
8519d0
+   brlttyInstallDirectories /var/lib/bluetooth
8519d0
+
8519d0
+   inst_multiple -o bluetoothctl hciconfig hcitool sdptool
8519d0
+   inst_binary /usr/libexec/bluetooth/bluetoothd
8519d0
+   brlttyInstallSystemdUnits bluetooth.service bluetooth.target
8519d0
+
8519d0
+   inst_hook initqueue 97 "${moddir}/bluetooth-start.sh"
8519d0
+   brlttyIncludeMessageBusSupport
8519d0
+}
8519d0
+
8519d0
+brlttyIncludeMessageBusSupport() {
8519d0
+   [ -d "${initdir}/etc/dbus-1" ] && return 0
8519d0
+
8519d0
+   brlttyAddMessageBusUsers /usr/share/dbus-1/system.d/*
8519d0
+   brlttyAddMessageBusUsers /etc/dbus-1/system.d/*
8519d0
+
8519d0
+   brlttyInstallDirectories /etc/dbus-1
8519d0
+   brlttyInstallDirectories /usr/share/dbus-1
8519d0
+   brlttyInstallDirectories /usr/libexec/dbus-1
8519d0
+
8519d0
+   inst_multiple dbus-daemon dbus-send dbus-cleanup-sockets dbus-monitor
8519d0
+   brlttyInstallSystemdUnits dbus.service dbus.socket
8519d0
+
8519d0
+   inst_hook initqueue 96 "${moddir}/dbus-start.sh"
8519d0
+}
8519d0
+
8519d0
+brlttyAddMessageBusUsers() {
8519d0
+   set -- dbus $(sed -n -r -e 's/^.* user="([^"]*)".*$/\1/p' "${@}" | sort -u)
8519d0
+   brlttyAddUserEntries "${@}"
8519d0
+   brlttyAddGroupEntries "${@}"
8519d0
+}
8519d0
+
8519d0
+brlttyAddUserEntries() {
8519d0
+   brlttyAddEntries passwd "${@}"
8519d0
+}
8519d0
+
8519d0
+brlttyAddGroupEntries() {
8519d0
+   brlttyAddEntries group "${@}"
8519d0
+}
8519d0
+
8519d0
+brlttyAddEntries() {
8519d0
+   local file="${1}"
8519d0
+   shift 1
8519d0
+
8519d0
+   local source="/etc/${file}"
8519d0
+   local target="${initdir}${source}"
8519d0
+   local name
8519d0
+
8519d0
+   for name
8519d0
+   do
8519d0
+      grep -q -e "^${name}:" "${target}" || {
8519d0
+         local line="$(grep "^${name}:" "${source}")"
8519d0
+         [ -n "${line}" ] && echo >>"${target}" "${line}"
8519d0
+      }
8519d0
+   done
8519d0
+}
8519d0
+
8519d0
+brlttyInstallSystemdUnits() {
8519d0
+   local unit
8519d0
+
8519d0
+   for unit
8519d0
+   do
8519d0
+      inst_simple "/usr/lib/systemd/system/${unit}"
8519d0
+   done
8519d0
+}
8519d0
+
8519d0
+brlttyInstallDirectories() {
8519d0
+   local directory
8519d0
+
8519d0
+   for directory
8519d0
+   do
8519d0
+      [ -d "${directory}" ] && {
8519d0
+         eval set -- $(find "${directory}" -printf "'%p'\n")
8519d0
+         inst_multiple "${@}"
8519d0
+      }
8519d0
+   done
8519d0
+}
8519d0
+
8519d0
diff --git a/Initramfs/Dracut/pulse-start.sh b/Initramfs/Dracut/pulse-start.sh
8519d0
new file mode 100755
8519d0
index 0000000..ed9af36
8519d0
--- /dev/null
8519d0
+++ b/Initramfs/Dracut/pulse-start.sh
8519d0
@@ -0,0 +1,5 @@
8519d0
+#!/bin/bash
8519d0
+
8519d0
+getargbool 1 rd.brltty && getargbool 1 rd.brltty.sound && getargbool 1 rd.brltty.pulse && {
8519d0
+   chmod a+w /tmp && pulseaudio --daemonize=yes --system --disallow-exit --disallow-module-loading --disable-shm
8519d0
+}
8519d0
diff --git a/Initramfs/Dracut/pulse-stop.sh b/Initramfs/Dracut/pulse-stop.sh
8519d0
new file mode 100755
8519d0
index 0000000..5f2b033
8519d0
--- /dev/null
8519d0
+++ b/Initramfs/Dracut/pulse-stop.sh
8519d0
@@ -0,0 +1,3 @@
8519d0
+#!/bin/bash
8519d0
+
8519d0
+read 
8519d0
diff --git a/Initramfs/Dracut/speechd-start.sh b/Initramfs/Dracut/speechd-start.sh
8519d0
new file mode 100755
8519d0
index 0000000..4467c27
8519d0
--- /dev/null
8519d0
+++ b/Initramfs/Dracut/speechd-start.sh
8519d0
@@ -0,0 +1,7 @@
8519d0
+#!/bin/bash
8519d0
+
8519d0
+getargbool 1 rd.brltty && getargbool 1 rd.brltty.sound && getargbool 1 rd.brltty.speechd && {
8519d0
+   systemctl -q is-active speech-dispatcherd || {
8519d0
+      systemctl --no-block start speech-dispatcherd
8519d0
+   }
8519d0
+}
8519d0
diff --git a/Makefile.in b/Makefile.in
8519d0
index d722215..103af51 100644
8519d0
--- a/Makefile.in
8519d0
+++ b/Makefile.in
8519d0
@@ -22,14 +22,17 @@ all install uninstall install-documents:
8519d0
 install-messages uninstall-messages:
8519d0
 	cd $(MSG_DIR) && $(MAKE) $(@:-messages=)
8519d0
 
8519d0
+install-appstream uninstall-appstream:
8519d0
+	cd Autostart/AppStream && $(MAKE) $(@:-appstream=)
8519d0
+
8519d0
 install-systemd uninstall-systemd:
8519d0
 	cd Autostart/Systemd && $(MAKE) $(@:-systemd=)
8519d0
 
8519d0
 install-udev uninstall-udev:
8519d0
 	cd Autostart/Udev && $(MAKE) $(@:-udev=)
8519d0
 
8519d0
-install-appstream uninstall-appstream:
8519d0
-	cd Autostart/AppStream && $(MAKE) $(@:-appstream=)
8519d0
+install-dracut uninstall-dracut:
8519d0
+	cd Initramfs/Dracut && $(MAKE) $(@:-dracut=)
8519d0
 
8519d0
 ARCHIVE_NAME = $(PACKAGE_TARNAME)-$(PACKAGE_VERSION)
8519d0
 TAR_EXTENSION = tar
8519d0
@@ -95,9 +98,10 @@ ITERATE = \
8519d0
    -for directory in \
8519d0
    $(PGM_DIR) \
8519d0
    $(MSG_DIR) \
8519d0
+   Autostart/AppStream \
8519d0
    Autostart/Systemd \
8519d0
    Autostart/Udev \
8519d0
-   Autostart/AppStream \
8519d0
+   Initramfs/Dracut \
8519d0
    Android/Application \
8519d0
    ; do (cd $$directory && $(MAKE) $@); done
8519d0
 
8519d0
diff --git a/Programs/Makefile.in b/Programs/Makefile.in
8519d0
index 0016035..c6d66f4 100644
8519d0
--- a/Programs/Makefile.in
8519d0
+++ b/Programs/Makefile.in
8519d0
@@ -16,8 +16,9 @@
8519d0
 # This software is maintained by Dave Mielke <dave@mielke.cc>.
8519d0
 ###############################################################################
8519d0
 
8519d0
-all: all-brltty all-brltty-trtxt all-brltty-ttb all-brltty-atb $(ALL_BRLTTY_CTB) all-brltty-ktb all-brltty-tune $(ALL_XBRLAPI) $(ALL_API_BINDINGS)
8519d0
+all: all-brltty all-brltty-lsinc all-brltty-trtxt all-brltty-ttb all-brltty-atb $(ALL_BRLTTY_CTB) all-brltty-ktb all-brltty-tune $(ALL_XBRLAPI) $(ALL_API_BINDINGS)
8519d0
 all-brltty: brltty$X $(BRAILLE_DRIVERS) $(SPEECH_DRIVERS) $(SCREEN_DRIVERS)
8519d0
+all-brltty-lsinc: brltty-lsinc$X
8519d0
 all-brltty-trtxt: brltty-trtxt$X
8519d0
 all-brltty-ttb: brltty-ttb$X
8519d0
 all-brltty-atb: brltty-atb$X
8519d0
@@ -805,6 +806,16 @@ brltty-trtxt.$O:
8519d0
 
8519d0
 ###############################################################################
8519d0
 
8519d0
+BRLTTY_LSINC_OBJECTS = brltty-lsinc.$O $(PROGRAM_OBJECTS)
8519d0
+
8519d0
+brltty-lsinc$X: $(BRLTTY_LSINC_OBJECTS)
8519d0
+	$(CC) $(LDFLAGS) -o $@ $(BRLTTY_LSINC_OBJECTS) $(LDLIBS)
8519d0
+
8519d0
+brltty-lsinc.$O:
8519d0
+	$(CC) $(CFLAGS) -c $(SRC_DIR)/brltty-lsinc.c
8519d0
+
8519d0
+###############################################################################
8519d0
+
8519d0
 BRLTEST_OBJECTS = brltest.$O $(PROGRAM_OBJECTS) report.$O $(TTB_OBJECTS) $(KTB_OBJECTS) dataarea.$O cmd.$O cmd_queue.$O drivers.$O driver.$O $(BRAILLE_OBJECTS) $(PREFS_OBJECTS) hidkeys.$O learn.$O
8519d0
 
8519d0
 brltest$X: $(BRLTEST_OBJECTS)
8519d0
@@ -949,8 +960,9 @@ check-all: check-text-tables check-attributes-tables check-contraction-tables ch
8519d0
 
8519d0
 install:: install-programs install-tables $(INSTALL_DRIVERS) install-core-headers $(INSTALL_MESSAGES) install-manpages $(INSTALL_API)
8519d0
 
8519d0
-install-programs: brltty$X brltty-trtxt$X brltty-ttb$X brltty-atb$X $(INSTALL_BRLTTY_CTB) brltty-ktb$X brltty-tune$X install-program-directory install-writable-directory
8519d0
+install-programs: brltty$X brltty-lsinc$X brltty-trtxt$X brltty-ttb$X brltty-atb$X $(INSTALL_BRLTTY_CTB) brltty-ktb$X brltty-tune$X install-program-directory install-writable-directory
8519d0
 	$(INSTALL_PROGRAM) brltty$X $(INSTALL_PROGRAM_DIRECTORY) 
8519d0
+	$(INSTALL_PROGRAM) brltty-lsinc$X $(INSTALL_PROGRAM_DIRECTORY) 
8519d0
 	$(INSTALL_PROGRAM) brltty-trtxt$X $(INSTALL_PROGRAM_DIRECTORY) 
8519d0
 	$(INSTALL_PROGRAM) brltty-ttb$X $(INSTALL_PROGRAM_DIRECTORY) 
8519d0
 	$(INSTALL_PROGRAM) brltty-atb$X $(INSTALL_PROGRAM_DIRECTORY) 
8519d0
@@ -1136,6 +1148,7 @@ distclean clean::
8519d0
 
8519d0
 clean::
8519d0
 	-rm -f brltty$X brltty-trtxt$X brltty-ttb$X brltty-atb$X brltty-ctb$X brltty-tune$X xbrlapi$X
8519d0
+	-rm -f brltty$X brltty-lsinc$X brltty-trtxt$X brltty-ttb$X brltty-atb$X brltty-ctb$X brltty-tune$X xbrlapi$X
8519d0
 	-rm -f tbl2hex$(X_FOR_BUILD) *test$X *-static$X
8519d0
 	-rm -f brlapi_constants.h *.$(LIB_EXT) *.$(LIB_EXT).* *.$(ARC_EXT) *.def *.class *.jar
8519d0
 	-rm -f $(BLD_TOP)$(DRV_DIR)/*
8519d0
diff --git a/Programs/brltty-lsinc.c b/Programs/brltty-lsinc.c
8519d0
new file mode 100644
8519d0
index 0000000..9d2b026
8519d0
--- /dev/null
8519d0
+++ b/Programs/brltty-lsinc.c
8519d0
@@ -0,0 +1,119 @@
8519d0
+/*
8519d0
+ * BRLTTY - A background process providing access to the console screen (when in
8519d0
+ *          text mode) for a blind person using a refreshable braille display.
8519d0
+ *
8519d0
+ * Copyright (C) 1995-2018 by The BRLTTY Developers.
8519d0
+ *
8519d0
+ * BRLTTY comes with ABSOLUTELY NO WARRANTY.
8519d0
+ *
8519d0
+ * This is free software, placed under the terms of the
8519d0
+ * GNU Lesser General Public License, as published by the Free Software
8519d0
+ * Foundation; either version 2.1 of the License, or (at your option) any
8519d0
+ * later version. Please see the file LICENSE-LGPL for details.
8519d0
+ *
8519d0
+ * Web Page: http://brltty.app/
8519d0
+ *
8519d0
+ * This software is maintained by Dave Mielke <dave@mielke.cc>.
8519d0
+ */
8519d0
+
8519d0
+#include "prologue.h"
8519d0
+
8519d0
+#include <stdio.h>
8519d0
+#include <string.h>
8519d0
+#include <search.h>
8519d0
+
8519d0
+#include "log.h"
8519d0
+#include "program.h"
8519d0
+#include "options.h"
8519d0
+#include "file.h"
8519d0
+
8519d0
+BEGIN_OPTION_TABLE(programOptions)
8519d0
+END_OPTION_TABLE
8519d0
+
8519d0
+static void
8519d0
+noMemory (void) {
8519d0
+  fprintf(stderr, "%s: insufficient memory\n", programName);
8519d0
+  exit(PROG_EXIT_FATAL);
8519d0
+}
8519d0
+
8519d0
+static int
8519d0
+compareStrings (const void *string1, const void *string2) {
8519d0
+  return strcmp(string1, string2);
8519d0
+}
8519d0
+
8519d0
+static void
8519d0
+logFileName (const char *name, void *data) {
8519d0
+  static void *namesTree = NULL;
8519d0
+
8519d0
+  if (!tfind(name, &namesTree, compareStrings)) {
8519d0
+    name = strdup(name);
8519d0
+    if (!name) noMemory();
8519d0
+    if (!tsearch(name, &namesTree, compareStrings)) noMemory();
8519d0
+    printf("%s\n", name);
8519d0
+  }
8519d0
+}
8519d0
+
8519d0
+static DATA_CONDITION_TESTER(testConditionOperand) {
8519d0
+  return 1;
8519d0
+}
8519d0
+
8519d0
+static DATA_OPERANDS_PROCESSOR(processUnknownDirective) {
8519d0
+  DataOperand directive;
8519d0
+
8519d0
+  if (getDataOperand(file, &directive, NULL)) {
8519d0
+    if (directive.length >= 2) {
8519d0
+      if (isKeyword(WS_C("if"), directive.characters, 2)) {
8519d0
+        return processConditionOperands(file, testConditionOperand, 0, NULL, data);
8519d0
+      }
8519d0
+    }
8519d0
+  }
8519d0
+
8519d0
+  return 1;
8519d0
+}
8519d0
+
8519d0
+static DATA_OPERANDS_PROCESSOR(processOperands) {
8519d0
+  BEGIN_DATA_DIRECTIVE_TABLE
8519d0
+    DATA_NESTING_DIRECTIVES,
8519d0
+    DATA_CONDITION_DIRECTIVES,
8519d0
+    DATA_VARIABLE_DIRECTIVES,
8519d0
+    {NULL, processUnknownDirective},
8519d0
+  END_DATA_DIRECTIVE_TABLE
8519d0
+
8519d0
+  return processDirectiveOperand(file, &directives, "attributes table directive", data);
8519d0
+}
8519d0
+
8519d0
+int
8519d0
+main (int argc, char *argv[]) {
8519d0
+  {
8519d0
+    static const OptionsDescriptor descriptor = {
8519d0
+      OPTION_TABLE(programOptions),
8519d0
+      .applicationName = "brltty-lsinc",
8519d0
+      .argumentsSummary = "[file ...]"
8519d0
+    };
8519d0
+
8519d0
+    PROCESS_OPTIONS(descriptor, argc, argv);
8519d0
+  }
8519d0
+
8519d0
+  if (argc == 0) {
8519d0
+    logMessage(LOG_ERR, "missing table file.");
8519d0
+    return PROG_EXIT_SYNTAX;
8519d0
+  }
8519d0
+
8519d0
+  do {
8519d0
+    const char *path = *argv++;
8519d0
+    argc -= 1;
8519d0
+
8519d0
+    const DataFileParameters parameters = {
8519d0
+      .processOperands = processOperands,
8519d0
+      .logFileName = logFileName
8519d0
+    };
8519d0
+
8519d0
+    if (testProgramPath(path)) {
8519d0
+      logFileName(path, parameters.data);
8519d0
+    } else {
8519d0
+      processDataFile(path, &parameters);
8519d0
+    }
8519d0
+  } while (argc);
8519d0
+
8519d0
+  return PROG_EXIT_SUCCESS;
8519d0
+}
8519d0
diff --git a/Programs/datafile.c b/Programs/datafile.c
8519d0
index e70deb5..48235e6 100644
8519d0
--- a/Programs/datafile.c
8519d0
+++ b/Programs/datafile.c
8519d0
@@ -1262,9 +1262,14 @@ processDataStream (
8519d0
   FILE *stream, const char *name,
8519d0
   const DataFileParameters *parameters
8519d0
 ) {
8519d0
-  logMessage(LOG_DEBUG, "including data file: %s", name);
8519d0
   int ok = 0;
8519d0
 
8519d0
+  if (parameters->logFileName) {
8519d0
+    parameters->logFileName(name, parameters->data);
8519d0
+  } else {
8519d0
+    logMessage(LOG_DEBUG, "including data file: %s", name);
8519d0
+  }
8519d0
+
8519d0
   DataFile file = {
8519d0
     .name = name,
8519d0
     .parameters = parameters,
8519d0
diff --git a/brltty.spec.in b/brltty.spec.in
8519d0
index f5aa33d..1ac2ebf 100644
8519d0
--- a/brltty.spec.in
8519d0
+++ b/brltty.spec.in
8519d0
@@ -339,6 +339,7 @@ BuildArch: noarch
8519d0
 
8519d0
 AutoProv: no
8519d0
 AutoReq: yes
8519d0
+Requires: systemd
8519d0
 
8519d0
 Summary: Systemd units and wrappers for BRLTTY.
8519d0
 %description -n brltty-systemd
8519d0
@@ -356,6 +357,7 @@ BuildArch: noarch
8519d0
 
8519d0
 AutoProv: no
8519d0
 AutoReq: yes
8519d0
+Requires: systemd-udev
8519d0
 
8519d0
 Summary: Udev rules for BRLTTY.
8519d0
 %description -n brltty-udev
8519d0
@@ -364,6 +366,25 @@ This package provides the rules and wrapper for managing BRLTTY via Udev.
8519d0
 Install this package if you'd like to manage BRLTTY processes via Udev.
8519d0
 
8519d0
 
8519d0
+%package -n brltty-dracut
8519d0
+Version: @PACKAGE_VERSION@
8519d0
+Release: 1
8519d0
+Group: System Environment/Daemons
8519d0
+License: LGPL
8519d0
+BuildArch: noarch
8519d0
+
8519d0
+AutoProv: no
8519d0
+AutoReq: yes
8519d0
+Requires: dracut
8519d0
+Requires: brltty-utils
8519d0
+
8519d0
+Summary: Dracut module for BRLTTY.
8519d0
+%description -n brltty-dracut
8519d0
+This package provides the module for adding BRLTTY to an initial ramdisk image.
8519d0
+
8519d0
+Install this package if you'd like to have braille accessibility BRLTTY processes via Udev.
8519d0
+
8519d0
+
8519d0
 %package -n brlapi
8519d0
 Version: @api_release@
8519d0
 Release: 1
8519d0
@@ -382,6 +403,26 @@ Install this package if you have an application
8519d0
 which directly accesses a refreshable braille display.
8519d0
 
8519d0
 
8519d0
+%package -n brlapi-utils
8519d0
+Version: @api_release@
8519d0
+Release: 1
8519d0
+Group: Applications/System
8519d0
+License: LGPL
8519d0
+
8519d0
+Requires: libX11
8519d0
+
8519d0
+BuildRequires: xorg-x11-proto-devel
8519d0
+BuildRequires: libX11-devel
8519d0
+BuildRequires: libXtst-devel
8519d0
+
8519d0
+AutoProv: no
8519d0
+AutoReq: yes
8519d0
+
8519d0
+Summary: Appliation Programming Interface for BRLTTY.
8519d0
+%description -n brlapi-utils
8519d0
+This package provides a set of commands that use the BrlAPI interface.
8519d0
+
8519d0
+
8519d0
 %package -n brlapi-devel
8519d0
 Version: @api_release@
8519d0
 Release: 1
8519d0
@@ -489,26 +530,6 @@ Install this package if you have a Tcl application
8519d0
 which directly accesses a refreshable braille display.
8519d0
 
8519d0
 
8519d0
-%package -n brlapi-utils
8519d0
-Version: @api_release@
8519d0
-Release: 1
8519d0
-Group: Applications/System
8519d0
-License: LGPL
8519d0
-
8519d0
-Requires: libX11
8519d0
-
8519d0
-BuildRequires: xorg-x11-proto-devel
8519d0
-BuildRequires: libX11-devel
8519d0
-BuildRequires: libXtst-devel
8519d0
-
8519d0
-AutoProv: no
8519d0
-AutoReq: yes
8519d0
-
8519d0
-Summary: Appliation Programming Interface for BRLTTY.
8519d0
-%description -n brlapi-utils
8519d0
-This package provides a set of commands for maintaining BRLTTY's datafiles.
8519d0
-
8519d0
-
8519d0
 %prep
8519d0
 # %setup -n %{name}-%{version}
8519d0
 %setup -n @PACKAGE_TARNAME@-@PACKAGE_VERSION@
8519d0
@@ -518,8 +539,13 @@ This package provides a set of commands for maintaining BRLTTY's datafiles.
8519d0
 make
8519d0
 
8519d0
 %install
8519d0
-make install install-documents install-messages
8519d0
-make install-systemd install-udev install-appstream
8519d0
+make install
8519d0
+make install-documents
8519d0
+make install-messages
8519d0
+make install-appstream
8519d0
+make install-systemd
8519d0
+make install-udev
8519d0
+make install-dracut
8519d0
 install -m 644 Documents/brltty.conf "${RPM_BUILD_ROOT}%{_sysconfdir}"
8519d0
 %find_lang %{name}
8519d0
 
8519d0
@@ -542,6 +568,7 @@ rm -fr "${RPM_BUILD_ROOT}"
8519d0
 %exclude %{_libdir}/brltty/libbrlttyxa2.so
8519d0
 %exclude %{_libdir}/brltty/libbrlttyxsc.so
8519d0
 %{_sysconfdir}/brltty
8519d0
+%exclude %{_sysconfdir}/brltty/dracut.conf
8519d0
 %{_datadir}/metainfo/org.a11y.brltty.metainfo.xml
8519d0
 %doc %{_mandir}/man1/brltty.1.gz
8519d0
 %doc %{_docdir}/*/LICENSE*
8519d0
@@ -598,12 +625,36 @@ rm -fr "${RPM_BUILD_ROOT}"
8519d0
 %{_udevlibdir}/*
8519d0
 %{_udevrulesdir}/*
8519d0
 
8519d0
+%files -n brltty-dracut
8519d0
+/usr/lib/dracut/modules.d/99brltty
8519d0
+%config(noreplace) %verify(not size md5 mtime) %{_sysconfdir}/brltty/Initramfs/dracut.conf
8519d0
+%config(noreplace) %verify(not size md5 mtime) %{_sysconfdir}/brltty/Initramfs/cmdline
8519d0
+
8519d0
 %files -n brlapi
8519d0
 %defattr(-,root,root)
8519d0
 %{_libdir}/libbrlapi.so.*
8519d0
 %{_datadir}/polkit-1/actions/org.a11y.brlapi.policy
8519d0
 %doc %{_docdir}/*/Manual-BrlAPI
8519d0
 
8519d0
+%files -n brlapi-utils
8519d0
+%{_bindir}/xbrlapi
8519d0
+%doc %{_mandir}/man1/xbrlapi.1.gz
8519d0
+%{_datadir}/gdm/greeter/autostart/xbrlapi.desktop
8519d0
+%{_sysconfdir}/X11/Xsession.d/60xbrlapi
8519d0
+%{_bindir}/eutp
8519d0
+%doc %{_mandir}/man1/eutp.1.gz
8519d0
+%{_bindir}/vstp
8519d0
+%doc %{_mandir}/man1/vstp.1.gz
8519d0
+
8519d0
+%files -n brlapi-devel
8519d0
+%defattr(-,root,root)
8519d0
+%{_libdir}/libbrlapi.a
8519d0
+%{_libdir}/libbrlapi.so
8519d0
+%{_includedir}/brlapi.h
8519d0
+%{_includedir}/brlapi_*.h
8519d0
+%doc %{_mandir}/man3/*
8519d0
+%doc %{_docdir}/*/BrlAPIref
8519d0
+
8519d0
 %files -n java-brlapi
8519d0
 @JAVA_JAR_DIR@/*
8519d0
 @JAVA_JNI_DIR@/*
8519d0
@@ -618,25 +669,6 @@ rm -fr "${RPM_BUILD_ROOT}"
8519d0
 @TCL_DIR@/brlapi-@api_release@/libbrlapi_tcl.so
8519d0
 @TCL_DIR@/brlapi-@api_release@/pkgIndex.tcl
8519d0
 
8519d0
-%files -n brlapi-devel
8519d0
-%defattr(-,root,root)
8519d0
-%{_libdir}/libbrlapi.a
8519d0
-%{_libdir}/libbrlapi.so
8519d0
-%{_includedir}/brlapi.h
8519d0
-%{_includedir}/brlapi_*.h
8519d0
-%doc %{_mandir}/man3/*
8519d0
-%doc %{_docdir}/*/BrlAPIref
8519d0
-
8519d0
-%files -n brlapi-utils
8519d0
-%{_bindir}/xbrlapi
8519d0
-%{_bindir}/eutp
8519d0
-%{_bindir}/vstp
8519d0
-%doc %{_mandir}/man1/xbrlapi.1.gz
8519d0
-%doc %{_mandir}/man1/eutp.1.gz
8519d0
-%doc %{_mandir}/man1/vstp.1.gz
8519d0
-%{_sysconfdir}/X11/Xsession.d/60xbrlapi
8519d0
-%{_datadir}/gdm/greeter/autostart/xbrlapi.desktop
8519d0
-
8519d0
 
8519d0
 %changelog
8519d0
 * Mon Feb 5 2018 Dave Mielke <Dave@Mielke.cc> 5.6
8519d0
diff --git a/configure.ac b/configure.ac
8519d0
index 8938c6b..b09fda8 100644
8519d0
--- a/configure.ac
8519d0
+++ b/configure.ac
8519d0
@@ -38,15 +38,18 @@ AC_DEFINE_UNQUOTED([BRLAPI_REVISION], [${api_revision}],
8519d0
                    [Define this to be the API library revision number.])
8519d0
 
8519d0
 BRLTTY_SUMMARY_BEGIN
8519d0
-brltty_build_directories=". Programs Documents Messages Android/Core Android/Application"
8519d0
+brltty_build_directories=". Programs Documents Messages"
8519d0
 brltty_source_directory="`dirname "${0}"`"
8519d0
 brltty_manual_directories=""
8519d0
 
8519d0
-for brltty_autostart_directory in `(cd "${brltty_source_directory}" && echo Autostart/*)`
8519d0
+for brltty_directory in Autostart Initramfs Android
8519d0
 do
8519d0
-   test -f "${brltty_source_directory}/${brltty_autostart_directory}/Makefile.in" && {
8519d0
-      brltty_build_directories="${brltty_build_directories} ${brltty_autostart_directory}"
8519d0
-   }
8519d0
+   for brltty_subdirectory in `echo "${brltty_source_directory}/${brltty_directory}/"*`
8519d0
+   do
8519d0
+      test -f "${brltty_subdirectory}/Makefile.in" && {
8519d0
+         brltty_build_directories="${brltty_build_directories} ${brltty_subdirectory}"
8519d0
+      }
8519d0
+   done
8519d0
 done
8519d0
 
8519d0
 for brltty_manual_directory in `(cd "${brltty_source_directory}" && echo Documents/Manual-*/*)`
8519d0
@@ -1957,7 +1960,7 @@ AC_OUTPUT([
8519d0
    Documents/BrlAPIref.doxy
8519d0
    Bindings/Lisp/brlapi.lisp
8519d0
    Bindings/Python/setup.py
8519d0
-   Android/Application/res/values/configured.xml:Android/Application/res.strings.in
8519d0
    Autostart/Systemd/brltty@.service
8519d0
+   Android/Application/res/values/configured.xml:Android/Application/res.strings.in
8519d0
    ${brltty_make_files}
8519d0
 ])