Merging casper 1.143.
[live-boot-grml.git] / scripts / live-bottom / 30accessibility
1 #!/bin/sh
2
3 #set -e
4
5 # initramfs-tools header
6
7 PREREQ=""
8
9 prereqs()
10 {
11         echo "${PREREQ}"
12 }
13
14 case "${1}" in
15         prereqs)
16                 prereqs
17                 exit 0
18                 ;;
19 esac
20
21 # live-initramfs header
22
23 if [ -n "${NOACCESSIBILITY}" ]
24 then
25         exit 0
26 fi
27
28 . /scripts/live-functions
29
30 if [ -z "${USERNAME}" ]
31 then
32         echo "No default user for accessibility options."
33         exit 0
34 fi
35
36 log_begin_msg "Configuring accessibility options"
37
38 # live-initramfs script
39
40 gconf_version=$(chroot /root /usr/bin/dpkg-query -W --showformat='${Version}' gconf2 2>/dev/null) || gconf_version=""
41
42 gct ()
43 {
44         if [ "${gconf_version}" ]
45         then
46                 chroot /root sudo -u "${USERNAME}" gconftool-2 "${@}"
47         fi
48 }
49
50 case ${ACCESS} in
51         access=v1)
52                 # Lesser Visual Impairment
53                 gct -s -t string /desktop/gnome/interface/gtk_theme HighContrastLargePrint
54                 gct -s -t string /desktop/gnome/interface/icon_theme HighContrast
55                 gct -s -t string /desktop/gnome/interface/monospace_font_name "monospace 18"
56                 gct -s -t string /desktop/gnome/interface/font_name "sans 18"
57                 gct -s -t string /apps/metacity/general/theme Atlanta
58                 gct -s -t string /desktop/gnome/background/picture_filename ""
59                 gct -s -t string /desktop/gnome/background/picture_options none
60                 gct -s -t string /desktop/gnome/background/primary_color \#666666
61                 gct -s -t string /desktop/gnome/background/secondary_color \#7F7F7F
62                 gct -s -t string /desktop/gnome/background/color_shading_type solid
63                 gct -s -t int /desktop/gnome/peripherals/mouse/cursor_size 48
64                 gct -s -t string /desktop/gnome/peripherals/mouse/cursor_theme whiteglass
65                 ;;
66
67         access=v2)
68                 # Moderate Visual Impairment
69                 gct -s -t bool /desktop/gnome/interface/accessibility true
70                 gct -s -t bool /apps/gksu/disable-grab true
71                 gct -s -t string /desktop/gnome/applications/window_manager/default /usr/bin/metacity
72
73                 if [ -x /root/usr/bin/orca ]
74                 then
75                         mkdir -p /root/home/${USERNAME}/.orca
76                         echo "import orca.settings" >> /root/home/${USERNAME}/.orca/user-settings.py
77                         echo "orca.settings.enableSpeech = False" >> /root/home/${USERNAME}/.orca/user-settings.py
78                         echo "orca.settings.enableMagnifier = True" >> /root/home/${USERNAME}/.orca/user-settings.py
79                         chroot /root chown -R ${USERNAME}:${USERNAME} /home/${USERNAME}/.orca
80
81                         mkdir -p /root/home/${USERNAME}/.config/autostart
82                         cp /root/usr/share/applications/orca.desktop /root/home/${USERNAME}/.config/autostart
83                         chroot /root chown -R ${USERNAME}.${USERNAME} /home/${USERNAME}/.config
84                 fi
85                 ;;
86
87         access=v3)
88                 # Blindness
89                 # Disabled for now, until we know eSpeak works.
90                 #gct -s -t bool /desktop/gnome/sound/enable_esd false
91                 gct -s -t bool /desktop/gnome/interface/accessibility true
92                 gct -s -t bool /apps/gksu/disable-grab true
93                 gct -s -t string /desktop/gnome/applications/window_manager/default /usr/bin/metacity
94
95                 if [ -x /root/usr/bin/orca ]
96                 then
97                         mkdir -p /root/home/${USERNAME}/.config/autostart
98                         cp /root/usr/share/applications/orca.desktop /root/home/${USERNAME}/.config/autostart
99                         chroot /root chown -R ${USERNAME}.${USERNAME} /home/${USERNAME}/.config
100                 fi
101                 ;;
102
103         braille=ask)
104                 # Braille
105                 gct -s -t bool /desktop/gnome/interface/accessibility true
106                 gct -s -t bool /apps/gksu/disable-grab true
107                 gct -s -t string /desktop/gnome/applications/window_manager/default /usr/bin/metacity
108
109                 if [ -x /root/usr/bin/orca ]
110                 then
111                         mkdir -p /root/home/${USERNAME}/.orca
112                         echo "import orca.settings" >> /root/home/${USERNAME}/.orca/user-settings.py
113                         echo "orca.settings.enableSpeech = False" >> /root/home/${USERNAME}/.orca/user-settings.py
114                         echo "orca.settings.enableBraille = True" >> /root/home/${USERNAME}/.orca/user-settings.py
115                         chroot /root chown -R ${USERNAME}:${USERNAME} /home/${USERNAME}/.orca
116
117                         mkdir -p /root/home/${USERNAME}/.config/autostart
118                         cp /root/usr/share/applications/orca.desktop /root/home/${USERNAME}/.config/autostart
119                         chroot /root chown -R ${USERNAME}.${USERNAME} /home/${USERNAME}/.config
120                 fi
121                 ;;
122
123         access=m1)
124                 # Minor Motor Difficulties
125                 gct -s -t bool /desktop/gnome/accessibility/keyboard/enable true
126                 gct -s -t bool /desktop/gnome/accessibility/keyboard/mousekeys_enable true
127                 gct -s -t bool /desktop/gnome/accessibility/keyboard/stickykeys_enable true
128                 gct -s -t bool /desktop/gnome/accessibility/keyboard/stickykeys_modifier_beep true
129                 gct -s -t bool /desktop/accessibility/gnome/keyboard/stickykeys_two_key_off false
130                 gct -s -t bool /desktop/gnome/peripherals/keyboard/repeat true
131                 gct -s -t int /desktop/gnome/peripherals/keyboard/delay 700
132                 gct -s -t int /desktop/gnome/peripherals/keyboard/rate 10
133                 gct -s -t bool /apps/gksu/disable-grab true
134
135                 if [ -e /root/etc/xdg/xfce4/mcs_settings/keyboard.xml ]
136                 then
137                         sed -i 's/0/1/' /root/etc/xdg/xfce4/mcs_settings/keyboard.xml
138                 fi
139                 ;;
140
141         access=m2)
142                 # Motor Difficulties - pointing devices
143                 gct -s -t bool /desktop/gnome/accessibility/keyboard/enable true
144                 gct -s -t bool /desktop/gnome/interface/accessibility true
145                 gct -s -t bool /desktop/gnome/accessibility/keyboard/stickykeys_enable true
146                 gct -s -t bool /desktop/gnome/accessibility/keyboard/stickykeys_modifier_beep false
147                 gct -s -t bool /desktop/accessibility/gnome/keyboard/stickykeys_two_key_off false
148                 gct -s -t list --list-type=string /desktop/gnome/accessibility/startup/exec_ats [onboard]
149
150                 if [ -e /root/etc/xdg/xfce4/mcs_settings/keyboard.xml ]
151                 then
152                         sed -i '/Sticky/ s/0/1/' /root/etc/xdg/xfce4/mcs_settings/keyboard.xml
153                 fi
154                 ;;
155 esac
156
157 log_end_msg