File: brltty-udeb.prebaseconfig

package info (click to toggle)
brltty 5.6-10
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 25,116 kB
  • sloc: ansic: 117,871; sh: 6,590; java: 4,785; xml: 3,451; makefile: 1,973; tcl: 1,499; awk: 611; ml: 293; python: 250; lisp: 52
file content (177 lines) | stat: -rw-r--r-- 6,307 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
#! /bin/sh -e
# Boot Parameters to Configuration File

# This script processes the brltty= boot parameters in /proc/cmdline and
# writes a corresponding BRLTTY configuration file to /target/etc/brltty.conf.

. /usr/share/debconf/confmodule

parse()
{
   brailleDriver=""
   brailleDevice=""
   textTable=""
   brailleParameters=""

   found=false
   while [ "${#}" -gt 0 ]
   do
      case "${1}"
      in
         "brltty="*)
            found=true
            parameters="${1#*=}"

            number=1
            while [ "${number}" -le 4 ]
            do
               parameter="${parameters%%,*}"
               if [ -n "${parameter}" ]
               then
                  case "${number}"
                  in
                     1)
                        brailleDriver="${parameter}"
                        ;;
                     2)
                        brailleDevice="${parameter}"
                        ;;
                     3)
                        textTable="${parameter}"
                        ;;
                     4)
                        brailleParameters="$(echo "$parameter" | sed -e 's/+/,/')"
                        ;;
                  esac
               fi

               number="`expr ${number} + 1`"
               new_parameters="${parameters#*,}"
               [ "${new_parameters}" != "${parameters}" ] || break
               parameters="${new_parameters}"
            done
            ;;
      esac

      shift
   done

   if "${found}"
   then
      echo "# Modified by ${0}"
      [ -z "${brailleDriver}" ] && brailleDriver=auto
      echo "braille-driver ${brailleDriver}"
      [ -z "${brailleDevice}" ] && brailleDevice=usb:
      echo "braille-device ${brailleDevice}"
      [ -n "${textTable}" ] && echo "text-table ${textTable}"
      [ -n "${brailleParameters}" ] && echo "braille-parameters ${brailleParameters}"
   fi

   true
}

unset DEBIAN_HAS_FRONTEND
unset DEBIAN_FRONTEND
unset DEBCONF_FRONTEND
unset DEBCONF_REDIR

pid=/var/run/brltty.pid

if [ -r $pid ] && kill -0 `cat $pid`; then
    if apt-install brltty 1>&2; then
        file="/proc/cmdline"
        if [ -f $file ]; then
            if grep brltty= $file >/dev/null ; then
                parse `cat "${file}"` >>/target/etc/brltty.conf
            fi
        fi

	# Grub
	mkdir -p /target/etc/default/grub.d
	echo 'GRUB_INIT_TUNE="480 440 1"' > /target/etc/default/grub.d/brltty.cfg
	[ -x /target/usr/sbin/update-grub ] && /bin/in-target /usr/sbin/update-grub || true

	# Gnome 2
	/bin/in-target su -s /bin/sh -c "gconftool-2 --type bool --set /desktop/gnome/applications/at/screen_reader_enabled true" Debian-gdm || true

	# Gnome 3
	mkdir -p /target/usr/share/glib-2.0/schemas
	cat > /target/usr/share/glib-2.0/schemas/15_brltty.gschema.override <<END
# Setup by debian-installer (via finish-install.d/07brltty) since
# braille support was enabled during initial installation

[org.gnome.desktop.a11y.applications]
screen-reader-enabled=true

[org.gnome.desktop.sound]
event-sounds=true

[org.mate.interface]
accessibility=true
END

	in-target dpkg-trigger --no-await /usr/share/glib-2.0/schemas || true
	in-target dpkg --triggers-only -a || true

	# lightdm
	if [ -x "/target/usr/bin/orca-dm-wrapper" ];
	then
		mkdir -p /target/etc/xdg/lightdm/lightdm.conf.d
		cat > /target/etc/xdg/lightdm/lightdm.conf.d/80_orca-dm-wrapper.conf << EOF
[SeatDefaults]
greeter-wrapper=/usr/bin/orca-dm-wrapper
EOF
	fi

	# KDE4
	/bin/in-target su -s /bin/sh -c "kwriteconfig --file kaccessibleapp --group Adaptor --key setSpeechEnabled 'true'" kdm || true
	/bin/in-target su -s /bin/sh -c "kwriteconfig --file kaccessibleapp --group Main --key SpeechEnabled 'true'" kdm || true
	# KDE5
	/bin/in-target su -s /bin/sh -c "kwriteconfig5 --file kaccessrc --group ScreenReader --key Enabled 'true'" kdm || true

	db_get passwd/username
	USERNAME="$RET"
	if [ -n "$USERNAME" ]
	then
		# Gnome 2
		/bin/in-target su -s /bin/sh -c "gconftool-2 --type bool --set /desktop/gnome/interface/accessibility true" "$USERNAME" || true
		/bin/in-target su -s /bin/sh -c "gconftool-2 --type bool --set /desktop/gnome/applications/at/visual/startup true" "$USERNAME" || true
		/bin/in-target su -s /bin/sh -c "gconftool-2 --type bool --set /desktop/gnome/sound/event_sounds true" "$USERNAME" || true

		# XFCE
		/bin/in-target su -s /bin/sh -c "mkdir -p /home/$USERNAME/.config/xfce4/xfconf/xfce-perchannel-xml" "$USERNAME"
		cat > /target/home/$USERNAME/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-session.xml <<END
<?xml version="1.0" encoding="UTF-8"?>

<channel name="xfce4-session" version="1.0">
  <property name="general" type="empty">
    <property name="StartAssistiveTechnologies" type="bool" value="true"/>
  </property>
</channel>
END
		/bin/in-target chown $USERNAME.$USERNAME /home/$USERNAME/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-session.xml

		# LXDE, XFCE, LXQt
		if [ -r "/target/etc/xdg/autostart/at-spi-dbus-bus.desktop" ];
		then
			/bin/in-target su -s /bin/sh -c "mkdir -p /home/$USERNAME/.config/autostart" "$USERNAME"
			/bin/in-target su -s /bin/sh -c "cp /etc/xdg/autostart/at-spi-dbus-bus.desktop /home/$USERNAME/.config/autostart/my-at-spi-dbus-bus.desktop" "$USERNAME"
			/bin/in-target su -s /bin/sh -c "sed -i -e 's/OnlyShowIn=.*/OnlyShowIn=XFCE;LXDE;LXQt;/' /home/$USERNAME/.config/autostart/my-at-spi-dbus-bus.desktop" "$USERNAME"
		fi
		if [ -r "/target/etc/xdg/autostart/orca-autostart.desktop" ];
		then
			/bin/in-target su -s /bin/sh -c "mkdir -p /home/$USERNAME/.config/autostart" "$USERNAME"
			/bin/in-target su -s /bin/sh -c "cp /etc/xdg/autostart/orca-autostart.desktop /home/$USERNAME/.config/autostart/my-orca-autostart.desktop" "$USERNAME"
			/bin/in-target su -s /bin/sh -c "sed -i -e 's/OnlyShowIn=.*/OnlyShowIn=XFCE;LXDE;LXQt;/' /home/$USERNAME/.config/autostart/my-orca-autostart.desktop" "$USERNAME"
		fi

		# KDE4
		/bin/in-target su -s /bin/sh -c "kwriteconfig --file kaccessibleapp --group Adaptor --key setSpeechEnabled 'true'" "$USERNAME" || true
		/bin/in-target su -s /bin/sh -c "kwriteconfig --file kaccessibleapp --group Main --key SpeechEnabled 'true'" "$USERNAME" || true
		# KDE5
		/bin/in-target su -s /bin/sh -c "kwriteconfig5 --file kaccessrc --group ScreenReader --key Enabled 'true'" "$USERNAME" || true
	fi
    fi
fi

exit 0