121 lines
3.6 KiB
Bash
Executable File
121 lines
3.6 KiB
Bash
Executable File
#!/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--
|
|
|
|
|
|
# Do not run as root.
|
|
if [[ "$(whoami)" == "root" ]]; then
|
|
echo "Please run configure-stormux as your user, not as root."
|
|
exit 0
|
|
fi
|
|
|
|
# For audible sudo prompts:
|
|
unset sudoFlags
|
|
if [[ -x /etc/audibleprompt.sh ]]; then
|
|
export SUDO_ASKPASS=/etc/audibleprompt.sh
|
|
export sudoFlags=("-A")
|
|
fi
|
|
|
|
# Include functions common to all operations
|
|
source .includes/functions.sh
|
|
# Include the dialog based UI
|
|
source .includes/ui.sh
|
|
# Get architecture
|
|
architecture="$(uname -m)"
|
|
|
|
# Make sure basic xdg directory structure is in place:
|
|
if [[ ! -d ~/Desktop ]]; then
|
|
xdg-user-dirs-update
|
|
fi
|
|
|
|
while [[ "$choice" != "Exit" ]]; do
|
|
case "$choice" in
|
|
"Change username")
|
|
./.includes/chuser.sh $(inputbox "Please enter the new username, letters, dashes, and underscores only.")
|
|
restart
|
|
;;
|
|
"Configure internet")
|
|
/usr/bin/nmtui-connect
|
|
;;
|
|
"Enable Bluetooth")
|
|
sudo "${sudoFlags[@]}" sed -i 's/^#AutoEnable=false$/AutoEnable=true/' /etc/bluetooth/main.conf
|
|
sudo "${sudoFlags[@]}" systemctl enable bluetooth --now
|
|
;;
|
|
"Install Raspberry Pi 5 kernel")
|
|
yay -R --noconfirm linux-rpi
|
|
install_package linux-rpi-16k
|
|
;;
|
|
"Install Lxqt Desktop")
|
|
source .includes/gui.sh lxqt
|
|
;;
|
|
"Install Mate Desktop")
|
|
source .includes/gui.sh mate
|
|
;;
|
|
"Install i3 Windowmanager")
|
|
source .includes/gui.sh i3
|
|
;;
|
|
"Screen reader")
|
|
source .includes/screenreader.sh
|
|
;;
|
|
"Set up gaming")
|
|
source .includes/gaming.sh
|
|
;;
|
|
"Set timezone")
|
|
source .includes/timezone.sh
|
|
;;
|
|
"Get help on IRC")
|
|
source .includes/irc.sh
|
|
;;
|
|
"Update configure-stormux")
|
|
sudo "${sudoFlags[@]}" git pull
|
|
exit $?
|
|
;;
|
|
"Convert to Server")
|
|
source .includes/convert-to-server.sh
|
|
;;
|
|
esac
|
|
options=(
|
|
"Change username"
|
|
"Configure internet"
|
|
"Enable Bluetooth"
|
|
)
|
|
if [[ "$(cat /sys/firmware/devicetree/base/model | cut -f-3 -d ' ')" == "Raspberry Pi 5" ]] && [[ "$(pacman -Q linux-rpi-16k &> /dev/null)" -eq 1 ]]; then
|
|
options+=("Install Raspberry Pi 5 kernel")
|
|
fi
|
|
options+=("Install Lxqt Desktop"
|
|
"Install Mate Desktop"
|
|
"Install i3 Windowmanager"
|
|
"Screen reader"
|
|
)
|
|
if [[ "${architecture}" == "armv7l" ]]; then
|
|
options+=("Set up gaming")
|
|
fi
|
|
options+=("Set timezone"
|
|
"Get help on IRC"
|
|
"Update configure-stormux"
|
|
"Convert to Server"
|
|
)
|
|
choice="$(menulist "${options[@]}")" || break
|
|
done
|
|
|
|
exit 0
|