Convert to Server option added. This should be used on a fresh Stormux image, and only by people who know what they are doing.

This commit is contained in:
Storm Dragon 2024-03-06 02:09:55 -05:00
parent 7026da6e73
commit 2d140354df
2 changed files with 78 additions and 0 deletions

74
.includes/convert-to-server.sh Executable file
View File

@ -0,0 +1,74 @@
#!/bin/bash
if [[ "$(whoami)" == "root" ]]; then
dialog --backtitle "Configure Stormux" \
--msgbox "This must be ran without root privileges." -1 -1 --stdout
exit 1
fi
if [[ "$(whoami)" == "stormux" ]]; then
dialog --backtitle "Configure Stormux" \
--msgbox "Default username \"stormux\" and default password \"stormux\" is a huge security risk for a server. Please change your username and password before proceeding." -1 -1 --stdout
exit 1
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." -1 -1 --stdout || exit 0
dialog --backtitle "Configure Stormux" \
--msgbox "Now let's upload your ssh key. It is a good idea to go ahead and connect via ssh now, in case something goes wrong you will have a chance to fix it manually. This will be used to login to your server, so whatever you do, don't lose it. If you have not yet created an ssh key, you can do so with the ssh-keygen command. Magic-wormhole will be used to upload the key. if you are doing this from a Windows based ssh session, you can install magic-wormhole with scoop: https://github.com/ScoopInstaller/Scoop" -1 -1 --stdout
mkdir -p ~/.ssh
wormhole ssh invite
if ! [[ -e ~/.ssh/authorized_keys ]]; then
exit 1
fi
sudo sed -i 's/^#PasswordAuthentication yes$/PasswordAuthentication no/' /etc/ssh/sshd_config
for i in \
alsa-firmware \
alsa-utils \
bluez \
bluez-utils \
brltty \
cloud-utils \
espeak-ng \
fenrir-git \
growpartfs \
go \
nodm-dgw \
pipewire \
pipewire-alsa \
pipewire-jack \
pipewire-pulse \
poppler \
python-pyudev \
python-daemonize \
python-evdev \
python-dbus \
python-pyte \
rhvoice-voice-bdl \
screen \
sox \
speech-dispatcher \
wireplumber \
xdg-user-dirs \
xdg-utils ; do
yay -Runcds --noconfirm $i
done
rm -rfv ~/.config
rm -rfv ~/Documents
rm -rfv ~/Desktop
rm -rfv ~/Downloads
rm -rfv ~/Music
rm -rfv ~/Pictures
rm -rfv ~/Public
rm -rfv ~/Templates
rm -rfv ~/Videos
sudo rm -rf /opt/configure-stormux
sudo rm -fv /local/bin/configure-stormux
dialog --backtitle "Configure Stormux" \
--msgbox "Hopefully everything went well and your server is ready to go, if not, see you on the other side of the reimage. Reboot for changes to ssh to be applied." -1 -1 --stdout
exit 0

View File

@ -103,6 +103,9 @@ while [[ "$choice" != "Exit" ]]; do
sudo "${sudoFlags[@]}" git pull
exit $?
;;
"Convert to Server")
source .includes/convert-to-server.sh
;;
esac
options=(
"Change username"
@ -123,6 +126,7 @@ while [[ "$choice" != "Exit" ]]; do
options+=("Set timezone"
"Get help on IRC"
"Update configure-stormux"
"Convert to Server"
)
choice="$(menulist "${options[@]}")" || break
done