Compare commits
4 Commits
4a4c931785
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 45568ba8e7 | |||
| 1aff16b6c3 | |||
| 8815129106 | |||
| 8004c888e6 |
@@ -13,6 +13,10 @@ dialog --backtitle "Configure Stormux" \
|
||||
fi
|
||||
|
||||
sudoFlags=("${sudoFlags[@]}")
|
||||
yaySudoArgs=()
|
||||
if [[ ${#sudoFlags[@]} -gt 0 ]]; then
|
||||
yaySudoArgs=(--sudoflags "${sudoFlags[*]}")
|
||||
fi
|
||||
|
||||
dialog --backtitle "Configure Stormux" \
|
||||
--yesno "This will make catastrophic changes to your system. If you are not sure you want to do this, select no by pressing the letter n on your keyboard. Afterwards, you will only be able to login with an ssh key and there will be no screen reader.\nNote, configure-stormux will no longer be available." -1 -1 --stdout || exit 0
|
||||
@@ -75,38 +79,55 @@ Would you like to remove the lock and continue?" -1 -1 --stdout; then
|
||||
fi
|
||||
fi
|
||||
|
||||
for packageName in \
|
||||
serverRemovalPackages=(
|
||||
alsa-firmware \
|
||||
alsa-utils \
|
||||
bluez \
|
||||
bluez-utils \
|
||||
brltty \
|
||||
cthulhu \
|
||||
espeak-ng \
|
||||
fenrir \
|
||||
fenrir-git \
|
||||
gstreamer \
|
||||
gst-plugins-base \
|
||||
gst-plugins-good \
|
||||
i38 \
|
||||
ii \
|
||||
magic-wormhole \
|
||||
nodm-dgw \
|
||||
pipewire \
|
||||
pipewire-alsa \
|
||||
pipewire-jack \
|
||||
pipewire-pulse \
|
||||
poppler \
|
||||
python-evdev \
|
||||
python-dbus \
|
||||
python-pyte \
|
||||
python-evdev \
|
||||
python-gobject \
|
||||
python-msgpack \
|
||||
python-pyenchant \
|
||||
python-pyte \
|
||||
python-pyperclip \
|
||||
python-tornado \
|
||||
realtime-privileges \
|
||||
rhvoice-voice-bdl \
|
||||
screen \
|
||||
socat \
|
||||
sox \
|
||||
speech-dispatcher \
|
||||
w3m-git \
|
||||
wireplumber \
|
||||
xdg-user-dirs \
|
||||
xdg-utils ; do
|
||||
yay -Runcds --noconfirm "$packageName" &> /dev/null
|
||||
xdg-utils \
|
||||
xlibre-input-libinput \
|
||||
xlibre-video-dummy-with-vt \
|
||||
xlibre-video-fbdev \
|
||||
xlibre-xserver \
|
||||
xorg-xinit
|
||||
)
|
||||
|
||||
for packageName in "${serverRemovalPackages[@]}"; do
|
||||
yay "${yaySudoArgs[@]}" -Runcds --noconfirm "$packageName" &> /dev/null
|
||||
done
|
||||
|
||||
rm -rfv ~/.config
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [[ "$(whoami)" == "root" ]]; then
|
||||
msgbox "Please run configure-stormux as your user, not as root."
|
||||
return 1
|
||||
fi
|
||||
|
||||
sudoFlags=("${sudoFlags[@]}")
|
||||
yaySudoArgs=()
|
||||
if [[ ${#sudoFlags[@]} -gt 0 ]]; then
|
||||
yaySudoArgs=(--sudoflags "${sudoFlags[*]}")
|
||||
fi
|
||||
|
||||
confirmRemoval="$(yesno "This will remove the I38 desktop, disable GUI startup, remove the XLibre desktop packages installed for I38, and delete generated I38 configuration from your account. Continue?")"
|
||||
if [[ "$confirmRemoval" != "Yes" ]]; then
|
||||
msgbox "I38 removal cancelled."
|
||||
return 0
|
||||
fi
|
||||
|
||||
sudo "${sudoFlags[@]}" systemctl disable --now nodm.service 2> /dev/null || true
|
||||
|
||||
if [[ -f /var/lib/pacman/db.lck ]]; then
|
||||
removeLock="$(yesno "A pacman database lock was found at /var/lib/pacman/db.lck. If no package manager is running, it is usually safe to remove. Remove it and continue?")"
|
||||
if [[ "$removeLock" == "Yes" ]]; then
|
||||
sudo "${sudoFlags[@]}" rm -f /var/lib/pacman/db.lck
|
||||
else
|
||||
msgbox "Cannot safely remove packages while the pacman database is locked."
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
packages=(
|
||||
i38
|
||||
cthulhu
|
||||
nodm-dgw
|
||||
xlibre-input-libinput
|
||||
xlibre-video-dummy-with-vt
|
||||
xlibre-video-fbdev
|
||||
xlibre-xserver
|
||||
xorg-xinit
|
||||
)
|
||||
|
||||
installedPackages=()
|
||||
for packageName in "${packages[@]}"; do
|
||||
if pacman -Q "$packageName" > /dev/null 2>&1; then
|
||||
installedPackages+=("$packageName")
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ ${#installedPackages[@]} -gt 0 ]]; then
|
||||
yay "${yaySudoArgs[@]}" --noconfirm -Rns "${installedPackages[@]}"
|
||||
fi
|
||||
|
||||
removeConfig="$(yesno "Delete generated I38 files from $HOME? This removes ~/.config/i3, ~/.xinitrc, ~/.xprofile, and ~/git/I38 if present.")"
|
||||
if [[ "$removeConfig" == "Yes" ]]; then
|
||||
rm -rf -- "$HOME/.config/i3" "$HOME/.xinitrc" "$HOME/.xprofile" "$HOME/git/I38"
|
||||
fi
|
||||
|
||||
msgbox "I38 removal is complete. Reboot before relying on the new console-only startup state."
|
||||
@@ -0,0 +1,90 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
validate_sas_script() {
|
||||
local scriptPath="$1"
|
||||
|
||||
[[ -s "$scriptPath" ]] && python3 -c \
|
||||
'import ast, pathlib, sys; ast.parse(pathlib.Path(sys.argv[1]).read_text(encoding="utf-8"))' \
|
||||
"$scriptPath" 2> /dev/null
|
||||
}
|
||||
|
||||
start_installed_sas() {
|
||||
local installedSas="$1"
|
||||
local warning="$2"
|
||||
|
||||
if [[ -x "$installedSas" ]] && validate_sas_script "$installedSas"; then
|
||||
msgbox "$warning Starting the installed version instead."
|
||||
"$installedSas"
|
||||
return $?
|
||||
fi
|
||||
|
||||
msgbox "$warning No working copy of the Stormux Assistance Service is installed."
|
||||
return 1
|
||||
}
|
||||
|
||||
run_stormux_assistance_service() {
|
||||
local installedSas="/usr/local/bin/sas"
|
||||
local repositoryUrl="https://git.stormux.org/storm/sas"
|
||||
local tempDir
|
||||
local repositoryDir=""
|
||||
local latestSas
|
||||
local stagedSas="/usr/local/bin/.sas.new.$$"
|
||||
local attempt
|
||||
|
||||
if ! command -v ii &> /dev/null; then
|
||||
infobox "Installing the ii IRC client required by the Stormux Assistance Service..."
|
||||
install_package ii
|
||||
if ! command -v ii &> /dev/null; then
|
||||
msgbox "The ii IRC client could not be installed. The Stormux Assistance Service cannot start."
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
tempDir=$(mktemp -d /tmp/configure-stormux-sas.XXXXXX) || {
|
||||
start_installed_sas "$installedSas" \
|
||||
"A temporary directory could not be created to check for an update."
|
||||
return $?
|
||||
}
|
||||
|
||||
infobox "Checking for the latest Stormux Assistance Service..."
|
||||
for attempt in 1 2 3; do
|
||||
if GIT_TERMINAL_PROMPT=0 timeout 30s git clone --quiet --depth 1 \
|
||||
"$repositoryUrl" "$tempDir/repository-$attempt"; then
|
||||
repositoryDir="$tempDir/repository-$attempt"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ -z "$repositoryDir" ]]; then
|
||||
rm -rf -- "$tempDir"
|
||||
start_installed_sas "$installedSas" \
|
||||
"The latest Stormux Assistance Service could not be downloaded."
|
||||
return $?
|
||||
fi
|
||||
|
||||
latestSas="$repositoryDir/sas.py"
|
||||
if ! validate_sas_script "$latestSas"; then
|
||||
rm -rf -- "$tempDir"
|
||||
start_installed_sas "$installedSas" \
|
||||
"The downloaded Stormux Assistance Service failed validation."
|
||||
return $?
|
||||
fi
|
||||
|
||||
if [[ ! -x "$installedSas" ]] || ! cmp -s "$latestSas" "$installedSas"; then
|
||||
# sudoFlags is initialized by configure-stormux.sh before this file is sourced.
|
||||
# shellcheck disable=SC2154
|
||||
if ! sudo "${sudoFlags[@]}" install -m 0755 "$latestSas" "$stagedSas" ||
|
||||
! sudo "${sudoFlags[@]}" mv -f "$stagedSas" "$installedSas"; then
|
||||
sudo "${sudoFlags[@]}" rm -f "$stagedSas"
|
||||
rm -rf -- "$tempDir"
|
||||
start_installed_sas "$installedSas" \
|
||||
"The Stormux Assistance Service could not be updated."
|
||||
return $?
|
||||
fi
|
||||
fi
|
||||
|
||||
rm -rf -- "$tempDir"
|
||||
"$installedSas"
|
||||
}
|
||||
|
||||
run_stormux_assistance_service
|
||||
@@ -62,9 +62,6 @@ fi
|
||||
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
|
||||
@@ -99,8 +96,8 @@ while [[ "$choice" != "Exit" ]]; do
|
||||
yay -R --noconfirm linux-rpi
|
||||
install_package linux-rpi-16k
|
||||
;;
|
||||
"Install I38 Desktop")
|
||||
source .includes/gui.sh i3
|
||||
"Remove I38 Desktop")
|
||||
source .includes/remove-i38.sh
|
||||
;;
|
||||
"Screen reader")
|
||||
source .includes/screenreader.sh
|
||||
@@ -111,6 +108,9 @@ while [[ "$choice" != "Exit" ]]; do
|
||||
"Get help on IRC")
|
||||
source .includes/irc.sh
|
||||
;;
|
||||
"Stormux Assistance Service")
|
||||
source .includes/sas.sh
|
||||
;;
|
||||
"Update configure-stormux")
|
||||
sudo "${sudoFlags[@]}" git pull
|
||||
exit $?
|
||||
@@ -139,11 +139,12 @@ while [[ "$choice" != "Exit" ]]; do
|
||||
if [[ "${raspberryPiVersion%%0*}" == "Raspberry Pi 5" ]] && ! pacman -Q linux-rpi-16k &> /dev/null ; then
|
||||
options+=("Install Raspberry Pi 5 kernel")
|
||||
fi
|
||||
options+=("Install I38 Desktop"
|
||||
options+=("Remove I38 Desktop"
|
||||
"Screen reader"
|
||||
)
|
||||
options+=("Set timezone"
|
||||
"Get help on IRC"
|
||||
"Stormux Assistance Service"
|
||||
"Update configure-stormux"
|
||||
"Update EEPROM"
|
||||
"Update RHVoice dictionaries"
|
||||
|
||||
Reference in New Issue
Block a user