Initial commit. In a broken state, do not use.

This commit is contained in:
Storm Dragon
2019-12-11 14:39:33 -05:00
parent 5dea87f44a
commit 1237ab3fd9
1039 changed files with 187732 additions and 0 deletions

View File

@@ -0,0 +1,101 @@
#!/bin/bash
#
# Copyright 2018, F123 Consulting, <information@f123.org>
# Copyright 2018, Kyle, <kyle@free2.ml>
# Copyright 2019, Storm Dragon, <stormdragon2976@gmail.com>
#
# This is free software; you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free
# Software Foundation; either version 3, or (at your option) any later
# version.
#
# This software is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this package; see the file COPYING. If not, write to the Free
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
#
#--code--
# the gettext essentials
export TEXTDOMAIN=build-f123light
export TEXTDOMAINDIR=/usr/share/locale
. gettext.sh
# This is the name by which the script is called,minus the path
# Gettext doesn't like the parameter or the basename command substitution.
name=${0##*/}
# Log writing function
log() {
while read -r line ; do
echo "$line" | sudo tee -a "$logFile" &> /dev/null
done
}
# Log file name is /var/log/scriptname
logFile="/var/log/${0##*/}"
# Clear previous logs
echo -n | sudo tee "$logFile" &> /dev/null
set -o pipefail
# Defaults
branch=master
declare -A argList=(
[b:]="branch:,"
[d:]="work-directory:,"
[H:]="hostname:,"
[h]="help,"
[n:]="network-name:,"
[o:]="output-file:,"
[p:]="password:,"
[r:]="root-password:,"
[s:]="size:,"
[u:]="user:,"
[w:]="wifi-password:"
)
short="${!argList[*]}"
short="${short// /}"
long="${argList[*]}"
long="${long// /}"
# Get command line options
if ! options=$(getopt -o $short -l $long -n "build-f123light" -- "$@" |& log); then
echo "Options were not passed" | log
exit 1
fi
eval set -- "$options"
# Create the args array and strip off the branch
declare -a args
while [[ $# -gt 0 ]]; do
if [[ "$1" == "-b" || "$1" == "--branch" ]]; then
echo "Set $1 $2 as branch, removed from argument list" | log
shift
shift
fi
if [[ -n "$1" ]]; then
echo "Added $1 to args array." | log
args+=($1)
fi
done
# If all is good, call here with $@ as parameters.
[[ -d /tmp/F123Light/ ]] && rm -rfv /tmp/F123Light |& log
# clone the git repository.
git clone -b $branch --depth 1 https://gitlab.com/f123/F123Light.git /tmp/F123Light |& git
# build the image
/echo "Calling tmp/F123Light/build/build.sh ${args[@]}" | log
/tmp/F123Light/build/build.sh ${args[@]}
exit 0

View File

@@ -0,0 +1 @@
/usr/lib/F123-wrappers/change-passwords.sh

View File

@@ -0,0 +1 @@
/usr/lib/F123-wrappers/configure-email.sh

View File

@@ -0,0 +1 @@
/usr/lib/F123-wrappers/configure-passwords.sh

View File

@@ -0,0 +1 @@
/usr/lib/F123-wrappers/configure-security.sh

View File

@@ -0,0 +1 @@
/usr/lib/F123-wrappers/configure-speech.sh

View File

@@ -0,0 +1,193 @@
#!/bin/bash
# FirstBoot
# A few preliminary steps that a user must take when boothing a new system for the first time
#
# Copyright 2018, F123 Consulting, <information@f123.org>
# Copyright 2018, Kyle, <kyle@free2.ml>
# Copyright 2018, Storm Dragon, <storm_dragon@linux-a11y.org>
#
# This is free software; you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free
# Software Foundation; either version 3, or (at your option) any later
# version.
#
# This software is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this package; see the file COPYING. If not, write to the Free
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
#
#--code--
# Setup gettext
export TEXTDOMAIN=first-boot
export TEXTDOMAINDIR=/usr/share/locale
. gettext.sh
# Include F123-includes
for i in /usr/lib/F123-includes/*.sh ; do
source $i
done
source ~/.preferences
# Log writing function
log() {
while read -r line ; do
echo "$line" | sudo tee -a "$logFile" &> /dev/null
done
}
# Log file name is /var/log/scriptname
logFile="/var/log/${0##*/}"
# Clear previous logs
echo -n | sudo tee "$logFile" &> /dev/null
get_user_info() {
# Request first and last name.
preferences[firstName]="$(inputbox "$(gettext "Please enter your first name.")" "${preferences[firstName]}")"
preferences[lastName]="$(inputbox "$(gettext "Please enter your last name.")" "${preferences[lastName]}")"
preferences[emailAddress]="$(inputbox "$(gettext "Please enter your email address.")" "${preferences[emailAddress]}")"
# Username defaults to first name replacing spaces with dashes
userName="${preferences[firstName],,}"
userName="${userName// /-}"
userName="$(inputbox "$(gettext "Please enter your username for this computer. Usernames are usually lower case and contain only letters, numbers, and dashes. The name must not start with a dash.")" "$userName")"
# One last error guard for user name checking.
if [[ -z "$userName" ]];then
echo "username was blank, setting to default of f123" | log
userName="f123"
fi
# Write the name and email stuff to preferences file
write_preferences
}
get_internet() {
# Initial connection to wifi
# Args: none
# Returns: none
fold -sw$cols <<-EOF
$(gettext "In order to use the internet, you need to set up a network connection.
If you already plugged in a wire that is connected directly to a router or modem, you don't need to do anything here.
However, if you don't have a wire connected, but want to use the internet, you can configure the wireless network here.")
EOF
while true; do
#echo -n "$(gettext "Press enter to configure the wireless network, or escape to skip this step. ")"
key="$(yesno "$(gettext "Would you like to configure the wireless network now? An internet connection is required to continue setup.")")"
echo
case "$key" in
"Yes")
sudo configure-wifi
break
;;
"No")
break
;;
esac
done
}
setup_complete() {
# Final comments
# Args: none
# Returns: none
msgbox "$(gettext "Initial F123 Light configuration is complete. To further customize your computer, please use the settings menu. Your computer will now reboot to finalize the setup.")"
# remove the firstboot file if it exists.
[[ -e ~/.firstboot ]] && rm -fv ~/.firstboot |& log
if [[ "$userName" != "f123" && "$userName" != "$USER" ]]; then
/usr/lib/F123-wrappers/chuser.sh $userName
fi
sudo reboot
}
set -o pipefail
# Attempt to clear any system messages that may be spoken when Fenrir starts
counter=0
# Wait for the creation of the socket file. Break if it is not made after 10 seconds
while [[ ! -S /tmp/fenrirscreenreader-deamon.sock ]]; do
sleep .25
if [[ $counter -ge 40 ]]; then
break
fi
((counter++))
done
# Stop speech from previous output.
echo "command interrupt" | socat - UNIX-CLIENT:/tmp/fenrirscreenreader-deamon.sock |& log
# Make sure basic xdg directory structure is in place:
xdg-user-dirs-update |& log
# Add any user based systemd service files here. remember to pipe output through the log function.
systemctl --user enable --now recoll.service |& log
# Call the functions that make up this script.
# I tried to make the functions descriptive as to what they do.
# See comments in the functions themselves for details
if [[ ! -s ~/.firstboot ]]; then
touch ~/.firstboot
echo "Running /usr/lib/F123-wrappers/select-language.sh" | log
/usr/lib/F123-wrappers/select-language.sh
fi
# Start keyboard layout.
msgbox "$(gettext "The Fenrir screenreader has several keyboard layouts available. On the next screen, you will be ask to choose the keyboard layout with which you are most familiar. To accept the default, NVDA Desktop layout, simply press enter.")"
declare -a keyboardMenu=("nvda-desktop" "nvda-desktop-default")
for i in $(find /etc/fenrirscreenreader/keyboard -type f -name '*.conf' -not -iname 'pty*') ; do
i="${i##*/}"
i="${i%.conf}"
keyboardMenu+=("${i}" "${i}")
done
keyboardLayout="$(menulist ${keyboardMenu[@]})"
keyboardLayout="${keyboardLayout:-nvda-desktop}"
if [[ "$keyboardLayout" != "nvda-desktop" ]]; then
echo "Setting keyboard layout to $keyboardLayout" | log
sudo sed -i "s/^keyboardLayout=.*/keyboardLayout=$keyboardLayout/" /etc/fenrirscreenreader/settings/settings.conf |& log
echo "Backing up Fenrir Settings." | log
sudo sudo cp -v /etc/fenrirscreenreader/settings/settings.conf /etc/F123-Config/backup/fenrir.conf |& log
sudo systemctl restart fenrirscreenreader |& log | dialog --progressbox "$(gettext "Applying Fenrir keyboard layout...") (${keyboardLayout})" 0 0
fi
# End keyboard layout
# Show quick start
if [[ -f "/usr/share/doc/F123/${LANG}/quickstart.txt" ]]; then
echo "Displaying /usr/share/doc/F123/${LANG}/quickstart.txt" | log
show_doc "/usr/share/doc/F123/${LANG}/quickstart.txt"
else
echo "No quickstart for ${LANG}, displaying default /usr/share/doc/F123/en_US.UTF-8/quickstart.txt" | log
show_doc "/usr/share/doc/F123/en_US.UTF-8/quickstart.txt"
fi
echo "Requesting user information." | log
get_user_info
echo "Prompting for password change." | log
if [[ "$(yesno "$(gettext "Do you want to change passwords for users of this system? Since everyone knows that the default password is f123, it is recommended that you change it.")")" == "Yes" ]]; then
echo "Running /usr/lib/F123-wrappers/configure-passwords.sh" | log
/usr/lib/F123-wrappers/configure-passwords.sh
fi
if ! ping -c1 gitlab.com |& log | dialog --progressbox "$(gettext "Checking internet connection...")" 0 0 ; then
echo "prompting for internet connectivity information." | log
get_internet
fi
# Check for internet connectivity.
if ! ping -c1 gitlab.com |& log | dialog --progressbox "$(gettext "Checking internet connection...")" 0 0 ; then
echo "Unable to establish an internet connection." | log
gettext "Please connect to the internet and try again."
exit 1
fi
# Set and sync timezone
echo "Running /usr/lib/F123-wrappers/timezone.sh" | log
/usr/lib/F123-wrappers/timezone.sh
# Synchronize repositories so that installations should go smoothly.
sudo pacman -Syy |& log | dialog --progressbox "Configuring system, please wait..." 0 0
echo "Prompting for security configuration." | log
if [[ "$(yesno "$(gettext "Do you want to change security options for this system? If you press 'Enter' for yes, you will be able to make this computer a bit more secure, but also a bit less convenient.")")" == "Yes" ]]; then
echo "Running /usr/lib/F123-wrappers/configure-security.sh" | log
/usr/lib/F123-wrappers/configure-security.sh
fi
echo "displaying setup complete text" | log
setup_complete
exit 0

View File

@@ -0,0 +1 @@
/usr/lib/F123Wrappers/install-mbrola.sh

View File

@@ -0,0 +1,35 @@
#!/bin/bash
# install-mishkal
#
# This script installs mishkal from its Github repository and configures speech-dispatcher to use it.
#
# Copyright 2018, F123 Consulting, <information@f123.org>
# Copyright 2018, Valdis Vitolins, <valdis.vitolins@odo.lv>
# Copyright 2018, Kyle, <kyle@free2.ml>
#
# This is free software; you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free
# Software Foundation; either version 3, or (at your option) any later
# version.
#
# This software is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this package; see the file COPYING. If not, write to the Free
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
# Download mishkal in the directory where this script is installed. Get the user's password to continue
echo Installing mishkal requires administrator privileges.
cd /usr/lib/instal-mishkal
# Download and build
sudo git clone https://github.com/linuxscout/mishkal
sudo pip2 install pyarabic
sudo pip2 install qalsadi
sudo pip2 install arramooz-pysqlite
sudo pip2 install mysam-tagmanager
sudo make mishkal

View File

@@ -0,0 +1 @@
../lib/F123-wrappers/restore-accessibility.sh

View File

@@ -0,0 +1,113 @@
#!/bin/bash
# select-fenrir.sh
# Description:
#
# Copyright 2019, F123 Consulting, <information@f123.org>
# Copyright 2019, Storm Dragon, <storm_dragon@linux-a11y.org>
#
# This is free software; you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free
# Software Foundation; either version 3, or (at your option) any later
# version.
#
# This software is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this package; see the file COPYING. If not, write to the Free
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
#
#--code--
# Load functions and reusable code:
if [[ -d /usr/lib/F123-includes/ ]]; then
for i in /usr/lib/F123-includes/*.sh ; do
source $i
done
fi
# the gettext essentials
export TEXTDOMAIN=select-fenrir
export TEXTDOMAINDIR=/usr/share/locale
source gettext.sh
# Log writing function
log() {
while read -r line ; do
echo "$line" | sudo tee -a "$logFile" &> /dev/null
done
}
logFile="/var/log/${0##*/}"
echo -n | sudo tee "$logFile"
# Check for ~/git/fenrir
mkdir -p ~/git/
if [[ -d ~/git/fenrir ]]; then
git -C ~/git/fenrir pull |& log
else
git clone https://github.com/chrys87/fenrir.git ~/git/fenrir |& log
fi
# Select a branch
if [[ -n "$1" ]]; then
branch="$1"
else
branches="$(git -C ~/git/fenrir branch -a)"
branches="${branches//\* }"
declare -a branchList=(stable stable)
for i in $branches ; do
branchList+=(${i##*/} ${i##*/})
done
branch=$(menulist ${branchList[@]})
fi
# If there is no branch, user canceled from menu.
[[ -z "$branch" ]] && exit 0
# Make sure that we're using the correct branch and that it exists.
if [[ "$branch" != "stable" ]]; then
git -C ~/git/fenrir checkout -q $branch 2> /dev/null || {
echo "The given branch, '$branch', does not exist." | tee -a "$logFile";
exit 1;
}
# Make sure the branch is up to date
git -C ~/git/fenrir pull |& log
fi
# check for running fenrir service
systemctl is-active fenrirscreenreader |& log && sudo systemctl -q stop fenrirscreenreader
# Stop a running fenrir not controled by systemd.
echo "command quitapplication" | socat - UNIX-CLIENT:/tmp/fenrirscreenreader-deamon.sock 2> /dev/null
# One last attempt to kill any running fenrir applications.
sudo killall -15 fenrir |& log
# Remove the PID file if it still exists
sudo rm -vf /run/fenrir.pid |& log
# Start the stable version if requested
if [[ "$branch" == "stable" ]]; then
sudo systemctl start fenrirscreenreader |& log
exit 0
fi
# Start the git version of Fenrir
sudo ~/git/fenrir/src/fenrir-daemon |& log
# Wait up to 5 seconds for a new fenrir pid
i=0
sleep 1
while [[ $? -ne 0 || $i -lt 10 ]]; do
sleep 0.5
((i++))
# Check that it is working, restart if not.
echo "command say $(gettext "You are now running fenrir from the") $branch $(gettext "branch. If you can hear this, please press enter. If you can not, the computer will restart and use the installed copy of Fenrir.")" | socat - UNIX-CLIENT:/tmp/fenrirscreenreader-deamon.sock &> /dev/null && break
done |& log
read -t 30 || reboot || sudo reboot
exit 0

View File

@@ -0,0 +1 @@
/usr/lib/F123-wrappers/select-language.sh

View File

@@ -0,0 +1 @@
../../usr/lib/F123-wrappers/system-backup.sh