2020-06-02 19:20:40 -04:00
|
|
|
#!/bin/bash
|
|
|
|
# Configure Stormux
|
|
|
|
# A script to configure the system for new users.
|
|
|
|
#
|
|
|
|
# Copyright 2020, 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--
|
|
|
|
|
|
|
|
|
2023-09-24 15:54:26 -04:00
|
|
|
# Do not run as root.
|
|
|
|
if [[ "$(whoami)" == "root" ]]; then
|
|
|
|
echo "Please run configure-stormux as your user, not as root."
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2024-06-02 22:34:38 -04:00
|
|
|
# Set up logging
|
|
|
|
logFile="/tmp/configure-stormux.log"
|
|
|
|
filter_ansi() {
|
|
|
|
sed -r -e 's/\x1B\[[0-9;]*[A-Za-z]//g' \
|
|
|
|
-e 's/\x1B[()#][0-9A-Za-z]//g' \
|
|
|
|
-e 's/\x1B[><=]//g' \
|
|
|
|
-e 's/\x0F//g' \
|
|
|
|
-e 's/\x1B\[?[0-9;]*[A-Za-z]//g' \
|
|
|
|
-e 's/\x1B\][0-9]*;[^\x07]*\x07//g' \
|
|
|
|
-e 's/\x1B\][0-9]*;[^\x1B]*\x1B\\//g' \
|
|
|
|
-e 's/\x08//g' \
|
|
|
|
-e 's/\r//g' \
|
|
|
|
-e 's/\x1B\[\?1049[hl]//g' \
|
|
|
|
-e 's/\x1B\[\?1[hl]//g' \
|
|
|
|
-e 's/\x1B\[\?1000[hl]//g' \
|
|
|
|
-e '/^[[:space:]]*$/d' \
|
|
|
|
-e ':a;N;$!ba;s/\n{2,}/\n/g'
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
exec > >(stdbuf -oL tee >(filter_ansi >> "$logFile")) 2> >(stdbuf -oL tee >(filter_ansi >> "$logFile") >&2)
|
|
|
|
|
|
|
|
|
2023-08-19 10:24:11 -04:00
|
|
|
# For audible sudo prompts:
|
2023-08-19 16:57:34 -04:00
|
|
|
unset sudoFlags
|
2023-08-19 10:24:11 -04:00
|
|
|
if [[ -x /etc/audibleprompt.sh ]]; then
|
|
|
|
export SUDO_ASKPASS=/etc/audibleprompt.sh
|
2023-08-19 16:57:34 -04:00
|
|
|
export sudoFlags=("-A")
|
2023-08-19 10:24:11 -04:00
|
|
|
fi
|
|
|
|
|
2021-10-18 00:46:11 -04:00
|
|
|
# Include functions common to all operations
|
|
|
|
source .includes/functions.sh
|
|
|
|
# Include the dialog based UI
|
|
|
|
source .includes/ui.sh
|
2022-04-11 13:13:24 -04:00
|
|
|
# Get architecture
|
|
|
|
architecture="$(uname -m)"
|
2020-06-02 19:20:40 -04:00
|
|
|
|
2021-10-18 00:46:11 -04:00
|
|
|
# Make sure basic xdg directory structure is in place:
|
|
|
|
if [[ ! -d ~/Desktop ]]; then
|
|
|
|
xdg-user-dirs-update
|
2020-06-02 19:20:40 -04:00
|
|
|
fi
|
|
|
|
|
2021-10-18 00:46:11 -04:00
|
|
|
while [[ "$choice" != "Exit" ]]; do
|
|
|
|
case "$choice" in
|
|
|
|
"Change username")
|
|
|
|
./.includes/chuser.sh $(inputbox "Please enter the new username, letters, dashes, and underscores only.")
|
|
|
|
restart
|
|
|
|
;;
|
2024-12-08 16:18:08 -05:00
|
|
|
"Configure Fenrir")
|
2024-12-08 16:52:40 -05:00
|
|
|
script -c "/usr/share/fenrirscreenreader/tools/configure_fenrir.py" /dev/null
|
2024-12-08 16:18:08 -05:00
|
|
|
;;
|
2021-10-23 14:30:23 -04:00
|
|
|
"Configure internet")
|
2021-10-23 14:00:17 -04:00
|
|
|
/usr/bin/nmtui-connect
|
|
|
|
;;
|
2022-04-06 02:14:27 -04:00
|
|
|
"Enable Bluetooth")
|
2023-08-19 16:57:34 -04:00
|
|
|
sudo "${sudoFlags[@]}" sed -i 's/^#AutoEnable=false$/AutoEnable=true/' /etc/bluetooth/main.conf
|
|
|
|
sudo "${sudoFlags[@]}" systemctl enable bluetooth --now
|
2022-04-06 02:14:27 -04:00
|
|
|
;;
|
2024-02-16 01:17:04 -05:00
|
|
|
"Install Raspberry Pi 5 kernel")
|
2024-02-22 01:46:39 -05:00
|
|
|
yay -R --noconfirm linux-rpi
|
2024-02-16 01:17:04 -05:00
|
|
|
install_package linux-rpi-16k
|
|
|
|
;;
|
2021-10-26 13:21:18 -04:00
|
|
|
"Install Lxqt Desktop")
|
|
|
|
source .includes/gui.sh lxqt
|
|
|
|
;;
|
2021-10-18 02:06:41 -04:00
|
|
|
"Install Mate Desktop")
|
2021-10-18 21:10:07 -04:00
|
|
|
source .includes/gui.sh mate
|
2021-10-18 02:06:41 -04:00
|
|
|
;;
|
2023-01-22 20:06:19 -05:00
|
|
|
"Install i3 Windowmanager")
|
|
|
|
source .includes/gui.sh i3
|
2021-10-18 21:10:07 -04:00
|
|
|
;;
|
2021-10-23 14:26:22 -04:00
|
|
|
"Screen reader")
|
|
|
|
source .includes/screenreader.sh
|
|
|
|
;;
|
2021-10-18 21:10:07 -04:00
|
|
|
"Set up gaming")
|
|
|
|
source .includes/gaming.sh
|
2021-10-18 02:06:41 -04:00
|
|
|
;;
|
2022-02-09 05:18:29 -05:00
|
|
|
"Set timezone")
|
|
|
|
source .includes/timezone.sh
|
|
|
|
;;
|
2022-04-10 19:23:48 -04:00
|
|
|
"Get help on IRC")
|
|
|
|
source .includes/irc.sh
|
|
|
|
;;
|
2021-10-24 01:14:51 -04:00
|
|
|
"Update configure-stormux")
|
2023-08-19 16:57:34 -04:00
|
|
|
sudo "${sudoFlags[@]}" git pull
|
2021-10-24 01:14:51 -04:00
|
|
|
exit $?
|
|
|
|
;;
|
2024-03-06 02:09:55 -05:00
|
|
|
"Convert to Server")
|
|
|
|
source .includes/convert-to-server.sh
|
|
|
|
;;
|
2021-10-18 00:46:11 -04:00
|
|
|
esac
|
2022-04-11 13:13:24 -04:00
|
|
|
options=(
|
|
|
|
"Change username"
|
2024-12-08 16:18:08 -05:00
|
|
|
"Configure Fenrir"
|
2022-04-11 13:13:24 -04:00
|
|
|
"Configure internet"
|
2024-02-16 01:17:04 -05:00
|
|
|
"Enable Bluetooth"
|
2022-04-11 13:13:24 -04:00
|
|
|
)
|
2024-02-22 01:53:27 -05:00
|
|
|
if [[ "$(cat /sys/firmware/devicetree/base/model | cut -f-3 -d ' ')" == "Raspberry Pi 5" ]] && [[ "$(pacman -Q linux-rpi-16k &> /dev/null)" -eq 1 ]]; then
|
2024-02-16 01:17:04 -05:00
|
|
|
options+=("Install Raspberry Pi 5 kernel")
|
2022-04-11 13:13:24 -04:00
|
|
|
fi
|
|
|
|
options+=("Install Lxqt Desktop"
|
|
|
|
"Install Mate Desktop"
|
2023-01-22 20:06:19 -05:00
|
|
|
"Install i3 Windowmanager"
|
2022-04-11 13:13:24 -04:00
|
|
|
"Screen reader"
|
|
|
|
)
|
|
|
|
if [[ "${architecture}" == "armv7l" ]]; then
|
|
|
|
options+=("Set up gaming")
|
|
|
|
fi
|
|
|
|
options+=("Set timezone"
|
|
|
|
"Get help on IRC"
|
|
|
|
"Update configure-stormux"
|
2024-03-06 02:09:55 -05:00
|
|
|
"Convert to Server"
|
2022-04-11 13:13:24 -04:00
|
|
|
)
|
|
|
|
choice="$(menulist "${options[@]}")" || break
|
2021-10-18 00:46:11 -04:00
|
|
|
done
|
2020-06-02 19:20:40 -04:00
|
|
|
|
|
|
|
exit 0
|