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