Added Dracut module

This commit is contained in:
Tomas Korbar 2018-05-31 15:09:05 +02:00
parent 008619e341
commit 5f009fa9a6
6 changed files with 144 additions and 1 deletions

View File

@ -33,11 +33,16 @@
Name: brltty
Version: %{pkg_version}
Release: 15%{?dist}
Release: 16%{?dist}
License: LGPLv2+
URL: http://mielke.cc/brltty/
Source0: http://mielke.cc/brltty/archive/%{name}-%{version}.tar.xz
Source1: brltty.service
Source2: dracut-module-setup.sh
Source3: dracut-brltty-start.sh
Source4: dracut-brltty-cleanup.sh
Source5: dracut-parse-brltty-opts.sh
Source6: dracut-README
Patch1: brltty-loadLibrary.patch
# libspeechd.h moved in latest speech-dispatch (NOT sent upstream)
Patch2: brltty-5.0-libspeechd.patch
@ -219,6 +224,12 @@ Summary: OCaml binding for BrlAPI
This package provides the OCaml binding for BrlAPI.
%endif
%package dracut
Summary: brltty module for Dracut
Requires: %{name}%{?_isa} = %{version}-%{release}
Requires: dracut
%description dracut-module
This package provides brltty module for Dracut.
%define version %{pkg_version}
@ -397,6 +408,15 @@ cp -p %{name}.lang ../
sed -i 's|/usr/bin/python|/usr/bin/python3|g' ${RPM_BUILD_ROOT}/etc/brltty/Contraction/latex-access.ctb
popd
#install dracut module
mkdir -p ${RPM_BUILD_ROOT}%{_prefix}/lib/dracut/modules.d/99brltty
install -p -m 755 %{SOURCE2} ${RPM_BUILD_ROOT}%{_prefix}/lib/dracut/modules.d/99brltty/module-setup.sh
install -p -m 755 %{SOURCE3} ${RPM_BUILD_ROOT}%{_prefix}/lib/dracut/modules.d/99brltty/brltty-start.sh
install -p -m 755 %{SOURCE4} ${RPM_BUILD_ROOT}%{_prefix}/lib/dracut/modules.d/99brltty/brltty-cleanup.sh
install -p -m 755 %{SOURCE5} ${RPM_BUILD_ROOT}%{_prefix}/lib/dracut/modules.d/99brltty/parse-brltty-opts.sh
install -p -m 644 %{SOURCE6} ${RPM_BUILD_ROOT}%{_prefix}/lib/dracut/modules.d/99brltty/README.sh
%post
%systemd_post brltty.service
@ -513,7 +533,13 @@ fi
%{_libdir}/ocaml/stublibs/
%endif
%files dracut-module
%{_prefix}/lib/dracut/modules.d/99brltty/
%changelog
* Thu May 31 2018 Tomas Korbar <tomas.korb@seznam.cz> - 5.6-16
- Added Dracut module
* Tue May 29 2018 Jaroslav Škarvada <jskarvad@redhat.com> - 5.6-15
- Added support for ALSA

38
dracut-README Normal file
View File

@ -0,0 +1,38 @@
Brltty support for dracut
This module provides brltty functionality in the initrd.
Module pickups user settings from system and install
necessary files like drivers and used text tables to initramfs.
For now the module is reliably functional from phase pre-mount
in earlier phases the module is not functional
TBD fix functionality from earlier phases than pre-mount
Module in instalation takes some options from environment variables.
BRLTTY_DRACUT_INCLUDE_DRIVERS forces include of screen or braille
driver
example:
BRLTTY_DRACUT_INCLUDE_DRIVERS=bpm beu
BRLTTY_DRACUT_INCLUDE_TEXT_FILES forces include of text tables
example:
BRLTTY_DRACUT_INCLUDE_TEXT_FILES=kok.ttb lv.tti
BRLTTY_LOCALE needs to be used when building initram image
to install used text table
see https://bugzilla.redhat.com/show_bug.cgi?id=1584036
example
BRLTTY_LOCALE=cs_CZ.UTF-8
Module allows to override some settings from grub
mainly for debugging purposes
brltty.braille_parameters
example:
brltty.braille_parameters="auth=none,host=IP:0"
brltty.braille_driver
example:
brltty.braile_driver="ba"

4
dracut-brltty-cleanup.sh Executable file
View File

@ -0,0 +1,4 @@
#!/bin/bash
read pid</var/run/brltty.pid
kill -0 $pid && kill -9 $pid

3
dracut-brltty-start.sh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash
brltty -E -x lx -P /var/run/brltty.pid

66
dracut-module-setup.sh Executable file
View File

@ -0,0 +1,66 @@
#!/bin/bash
# called by dracut
check() {
require_binaries brltty || return 1
return 0
}
# called by dracut
depends() {
return 0
}
#called by dracut
install() {
local required_libs="$(ldd /usr/bin/brltty | awk '{print $1}' | sed 's/\..*/.so\*/g')"
for word in $required_libs; do
if [ -e $word ]; then
inst_libdir_file "$word"
fi
done
inst_libdir_file "brltty/libbrlttyxlx.so*"
local brltty_report="$(LC_ALL="$BRLTTY_LOCALE" brltty -Evel7 2>&1)"
local checked_braille_drivers=$(echo "$brltty_report" | grep "checking for braille driver:" | awk '{print $NF}')
for word in $checked_braille_drivers; do
inst_libdir_file "brltty/libbrlttyb$word.so*"
done
local text_tables=$(echo "$brltty_report" | grep -E "compiling text table|including data file"| awk '{print $NF}')
for word in $text_tables; do
inst "$word"
done
local attributes=$(echo "$brltty_report" | grep "Attributes Table" | awk '{print $NF}')
for word in $attributes; do
inst "/etc/brltty/Attributes/$word.atb"
done
if [ "$BRLTTY_DRACUT_INCLUDE_DRIVERS" ]; then
for word in $BRLTTY_DRACUT_INCLUDE_DRIVERS; do
inst_libdir_file "brltty/libbrltty$BRLTTY_DRACUT_INCLUDE_DRIVERS.so*"
done
fi
if [ "$BRLTTY_DRACUT_INCLUDE_TEXT_FILES" ]; then
for word in $BRLTTY_DRACUT_INCLUDE_TEXT_FILES; do
inst "/etc/brltty/Text/$BRLTTY_DRACUT_INCLUDE_DATA_FILES"
done
fi
inst_hook cmdline 99 "$moddir/parse-brltty-opts.sh"
inst_hook initqueue 99 "$moddir/brltty-start.sh"
inst_hook cleanup 99 "$moddir/brltty-cleanup.sh"
inst_simple "/etc/brltty.conf"
inst_simple "/usr/bin/brltty"
dracut_need_initqueue
}

6
dracut-parse-brltty-opts.sh Executable file
View File

@ -0,0 +1,6 @@
#!/bin/bash
BRLTTY_BRAILLE_PARAMETERS=$(getarg brltty.braille_parameters=)
BRLTTY_BRAILLE_DRIVER=$(getarg brltty.braille_driver=)
export BRLTTY_BRAILLE_PARAMETERS
export BRLTTY_BRAILLE_DRIVER