Changes for new version of Fenrir and extended speech customization options.
This commit is contained in:
1 parent
d41a531b9d
commit
c7f21c9234
10 files changed
+149
-59
No files matched your search
@@ -38,27 +38,63 @@ set_timezone() {
|
||||
timedatectl set-ntp true
|
||||
}
|
||||
|
||||
restart_fenrir_speech() {
|
||||
configure_fenrir() {
|
||||
local keyboardLayout="desktop" answer configPath tempPath serviceAction="start"
|
||||
configPath="/etc/fenrirscreenreader/settings/settings.toml"
|
||||
# A manual rerun must also apply the newly selected launch-time layout.
|
||||
if systemctl is-active --quiet fenrirscreenreader.service; then
|
||||
killall speech-dispatcher 2>/dev/null || true
|
||||
systemctl restart fenrirscreenreader.service
|
||||
serviceAction="restart"
|
||||
fi
|
||||
|
||||
# Reload the default engine selected before this script was started.
|
||||
killall speech-dispatcher 2>/dev/null || true
|
||||
while true; do
|
||||
echo "Would you like to switch Fenrir to laptop layout? [y/N]"
|
||||
spd-say -w "Would you like to switch Fenrir to laptop layout? Press y for yes or n for no, followed by Enter. Press Enter for desktop layout."
|
||||
read -r answer || return 1
|
||||
case "${answer,,}" in
|
||||
y|yes) keyboardLayout="laptop"; break ;;
|
||||
n|no|"") break ;;
|
||||
esac
|
||||
done
|
||||
|
||||
tempPath="$(mktemp "${configPath}.stormux.XXXXXX")" || return 1
|
||||
if ! cp --preserve=mode,ownership "$configPath" "$tempPath" || ! awk -v layout="$keyboardLayout" '
|
||||
/^[[:space:]]*\[/ { inKeyboard = ($0 ~ /^[[:space:]]*\[keyboard\][[:space:]]*(#.*)?$/) }
|
||||
inKeyboard && /^[[:space:]]*layout[[:space:]]*=/ {
|
||||
if (sub(/=[[:space:]]*("[^"]*"|\047[^\047]*\047)/, "= \"" layout "\"")) {
|
||||
changed++
|
||||
}
|
||||
}
|
||||
{ print }
|
||||
END { if (changed != 1) exit 1 }
|
||||
' "$configPath" > "$tempPath" || ! fenrir --config "$tempPath" --check-config; then
|
||||
rm -f "$tempPath"
|
||||
echo "Could not configure Fenrir. The original settings were preserved."
|
||||
spd-say -w "Could not configure Fenrir. The original settings were preserved."
|
||||
return 1
|
||||
fi
|
||||
if ! mv -f "$tempPath" "$configPath"; then
|
||||
rm -f "$tempPath"
|
||||
return 1
|
||||
fi
|
||||
if ! systemctl "$serviceAction" fenrirscreenreader.service; then
|
||||
echo "Fenrir could not start. Check journalctl -u fenrirscreenreader.service."
|
||||
spd-say -w "Fenrir could not start. Check the screen reader service log."
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Offer to switch fenrir layout.
|
||||
echo "Would you like to switch Fenrir to laptop layout?"
|
||||
echo "Press y for yes or n for no followed by enter."
|
||||
read -r continue
|
||||
continue="${continue::1}"
|
||||
if [[ "${continue,}" == "y" ]];then
|
||||
sed -i 's/=desktop/=laptop/' /etc/fenrirscreenreader/settings/settings.conf
|
||||
clear
|
||||
fi
|
||||
restart_fenrir_speech
|
||||
configure_fenrir || exit 1
|
||||
|
||||
clear
|
||||
echo "Hello, and welcome to Stormux!"
|
||||
echo "Let's get you set up. Please press enter to continue."
|
||||
read -r
|
||||
|
||||
if ! ping -c1 stormux.org &> /dev/null ; then
|
||||
echo "No internet connection detected. Press enter to open NetworkManager."
|
||||
read -r continue
|
||||
read -r
|
||||
echo "setting set focus#highlight=True" | socat - UNIX-CLIENT:/tmp/fenrirscreenreader-daemon.sock
|
||||
nmtui-connect
|
||||
echo "setting set focus#highlight=False" | socat - UNIX-CLIENT:/tmp/fenrirscreenreader-daemon.sock
|
||||
|
||||
@@ -13,6 +13,8 @@ if [ -d /etc/skel.custom ]; then
|
||||
fi
|
||||
|
||||
# Set the distribution name
|
||||
# /etc/issue interprets these escapes when getty displays it.
|
||||
# shellcheck disable=SC2028
|
||||
echo 'Stormux \r (\l)' > /etc/issue
|
||||
echo >> /etc/issue
|
||||
|
||||
@@ -54,9 +56,10 @@ echo stormux > /etc/hostname
|
||||
systemctl disable systemd-networkd.service systemd-networkd.socket 2>/dev/null || true
|
||||
|
||||
# Enable services
|
||||
# The first-login setup starts Fenrir after volume, voice, and layout selection.
|
||||
systemctl disable fenrirscreenreader.service stormux-speech.service
|
||||
services=(
|
||||
brltty.path
|
||||
fenrirscreenreader.service
|
||||
NetworkManager.service
|
||||
stormux-audio-setup.service
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user