82 lines
2.1 KiB
Bash
Executable File
82 lines
2.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Configure Server
|
|
|
|
if [[ "$(whoami)" == "root" ]]; then
|
|
echo "Please run configure-server as your user, not as root."
|
|
exit 0
|
|
fi
|
|
|
|
logFile="/tmp/configure-server.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)
|
|
|
|
unset sudoFlags
|
|
if [[ -x /etc/audibleprompt.sh ]]; then
|
|
export SUDO_ASKPASS=/etc/audibleprompt.sh
|
|
export sudoFlags=("-A")
|
|
fi
|
|
|
|
source .includes/functions.sh
|
|
source .includes/ui.sh
|
|
|
|
copyparty_installed() {
|
|
pacman -Q copyparty &> /dev/null
|
|
}
|
|
|
|
while true; do
|
|
menuOptions=("Firewall" "MiniDLNA" "Mumble Server" "Nginx" "Top Speed Server" "Top Speed Console" "Copyparty")
|
|
if copyparty_installed; then
|
|
menuOptions+=("Show Copyparty Address")
|
|
fi
|
|
menuOptions+=("Exit")
|
|
|
|
choice="$(menulist "${menuOptions[@]}")" || break
|
|
case "$choice" in
|
|
"Firewall")
|
|
source .includes/firewall.sh
|
|
;;
|
|
"MiniDLNA")
|
|
source .includes/minidlna.sh
|
|
;;
|
|
"Mumble Server")
|
|
source .includes/mumble.sh
|
|
;;
|
|
"Nginx")
|
|
source .includes/nginx.sh
|
|
;;
|
|
"Top Speed Server")
|
|
source .includes/topspeed.sh install
|
|
;;
|
|
"Top Speed Console")
|
|
source .includes/topspeed.sh console
|
|
;;
|
|
"Copyparty")
|
|
source .includes/copyparty.sh
|
|
;;
|
|
"Show Copyparty Address")
|
|
source .includes/copyparty.sh show-address
|
|
;;
|
|
"Exit")
|
|
break
|
|
;;
|
|
esac
|
|
done
|
|
|
|
exit 0
|