mystic/install-next.sh

269 lines
8.5 KiB
Bash
Raw Normal View History

2023-01-22 11:36:32 +01:00
#!/usr/bin/env bash
YW=$(echo "\033[33m")
BL=$(echo "\033[36m")
RD=$(echo "\033[01;31m")
BGN=$(echo "\033[4;92m")
GN=$(echo "\033[1;92m")
DGN=$(echo "\033[32m")
CL=$(echo "\033[m")
BFR="\\r\\033[K"
HOLD="-"
CM="${GN}${CL}"
2024-04-20 14:18:20 +02:00
APP="Mystic BBS"
2023-01-22 11:36:32 +01:00
MSDIR="/opt/mystic"
MSTEMPDIR="/usr/local/src/mystic"
2023-01-22 11:36:32 +01:00
TMP_DIR=$(mktemp -d)
2024-05-16 18:33:06 +02:00
SCRIPT_VER="v7"
2024-04-20 10:33:44 +02:00
GROUP=$(getent group mystic)
USER=$(getent shadow mystic)
FAIL2BAN_GROUP=$(getent group fail2ban)
IPBAN_GROUP=$(getent group ipban)
hostname="$(hostname)"
set -o errexit
set -o errtrace
set -o nounset
set -o pipefail
shopt -s expand_aliases
alias die='EXIT=$? LINE=$LINENO error_exit'
trap die ERR
function error_exit() {
trap - ERR
local reason="Unknown failure occured."
local msg="${1:-$reason}"
local flag="${RD}‼ ERROR ${CL}$EXIT@$LINE"
echo -e "$flag $msg" 1>&2
exit $EXIT
}
if command -v pveversion >/dev/null 2>&1; then echo -e "⚠️ Can't Install on Proxmox "; exit; fi
while true; do
read -p "This will Install ${APP} on $hostname. Proceed(y/n)?" yn
case $yn in
[Yy]*) break ;;
[Nn]*) exit ;;
*) echo "Please answer yes or no." ;;
esac
done
clear
function msg_info() {
local msg="$1"
echo -ne " ${HOLD} ${YW}${msg}..."
}
function msg_ok() {
local msg="$1"
echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
}
2023-01-22 11:36:32 +01:00
msg_info "Installing needed base packages"
2024-04-20 10:38:39 +02:00
apt update &>/dev/null
2024-05-10 20:17:18 +02:00
apt install lsb-release dpkg-dev wget curl figlet lolcat unzip whiptail dialog -y &>/dev/null
msg_ok "Installing needed base packages"
2024-04-20 11:50:46 +02:00
function header_info {
/usr/bin/env figlet -w 60 -c "Mystic BBS DbP Installer" | /usr/games/lolcat -f
}
header_info
ARCH=$(dpkg-architecture -qDEB_HOST_MULTIARCH)
2023-01-22 11:36:32 +01:00
DIST=$(lsb_release -i -s)
CODENAME=$(lsb_release -c -s)
LIBDIR=/usr/lib/${ARCH}
if [ "${ARCH}" = "x86_64-linux-gnu" ]; then
INIMOD_ARCH="amd64"
MYSTIC_ARCH="l64"
MYSTIC_EXT="rar"
2024-05-10 20:44:39 +02:00
RARLAB="rar"
2024-05-16 17:02:36 +02:00
DOSEMUVER="dosemu2"
2023-01-22 11:36:32 +01:00
elif [ "${ARCH}" = "i386-linux-gnu" ]; then
INIMOD_ARCH="amd32"
MYSTIC_ARCH="l32"
MYSTIC_EXT="rar"
2024-05-10 20:44:39 +02:00
RARLAB="rar"
2024-05-16 17:02:36 +02:00
DOSEMUVER="dosemu"
2023-01-22 11:36:32 +01:00
elif [ "${ARCH}" = "aarch64-linux-gnu" ]; then
INIMOD_ARCH="arm64"
MYSTIC_ARCH="p64"
MYSTIC_EXT="zip"
2024-05-10 20:44:39 +02:00
RARLAB=""
2024-05-16 17:02:36 +02:00
DOSEMUVER="dosemu2"
2023-01-22 11:36:32 +01:00
elif [ "${ARCH}" = "arm-linux-gnueabihf" ]; then
INIMOD_ARCH="arm32"
MYSTIC_ARCH="p32"
MYSTIC_EXT="zip"
2024-05-10 20:44:39 +02:00
RARLAB=""
2024-05-16 17:02:36 +02:00
DOSEMUVER=""
2023-01-22 11:36:32 +01:00
else
echo "Architecture not supported: ${ARCH}"
exit 1
fi
if [ "${CODENAME}" = "bookworm" ]; then
2024-04-20 10:44:41 +02:00
UBUNTU="kinetic"
2024-04-14 09:59:27 +02:00
elif [ "${CODENAME}" = "bullseye" ]; then
2024-04-20 10:44:41 +02:00
UBUNTU="focal"
2023-01-22 11:36:32 +01:00
elif [ "${CODENAME}" = "buster" ]; then
2024-04-20 10:44:41 +02:00
UBUNTU="bionic"
2023-01-22 11:36:32 +01:00
elif [ "${CODENAME}" = "stretch" ]; then
2024-04-20 10:44:41 +02:00
UBUNTU="xenial"
2023-01-22 11:36:32 +01:00
else
2024-04-20 10:44:41 +02:00
UBUNTU="${CODENAME}"
2023-01-22 11:36:32 +01:00
fi
if [ "${CODENAME}" = "bookworm" ]; then
msg_info "adding bullseye repository to bookworm for python2"
echo "deb http://deb.debian.org/debian bullseye contrib non-free main" > /etc/apt/sources.list.d/bullseye.list
echo "deb http://deb.debian.org/debian bullseye-updates contrib non-free main" >> /etc/apt/sources.list.d/bullseye.list
echo "deb http://security.debian.org bullseye-security contrib non-free main" >> /etc/apt/sources.list.d/bullseye.list
2024-04-20 10:09:35 +02:00
msg_ok "adding bullseye repository to bookworm for python2"
fi
2023-01-22 11:36:32 +01:00
msg_info "Setting up ${APP} Repository"
2024-04-14 09:59:27 +02:00
apt install -y software-properties-common &>/dev/null
2023-01-22 11:36:32 +01:00
if [ "${DIST}" = "Debian" ]; then
2024-04-20 10:38:39 +02:00
apt-add-repository -y contrib &>/dev/null
apt-add-repository -y non-free &>/dev/null
2023-01-22 11:36:32 +01:00
fi
if [ "${DIST}" = "Ubuntu" ]; then
2024-04-20 10:38:39 +02:00
apt-add-repository -y universe &>/dev/null
apt-add-repository -y restricted &>/dev/null
apt-add-repository -y multiverse &>/dev/null
2023-01-22 11:36:32 +01:00
fi
2024-04-14 09:59:27 +02:00
apt update &>/dev/null
2024-04-20 11:20:06 +02:00
apt install -y curl wget gnupg unzip unrar &>/dev/null
mkdir -p $MSTEMPDIR &>/dev/null
2024-04-20 11:07:14 +02:00
msg_ok "Setting up ${APP} Repository"
2023-01-22 11:36:32 +01:00
#==============================================================================================================
msg_info "Downloading ${APP} Mystic BBS Disconnected-by-Peer Installer Files"
wget -N https://gitea.disconnected-by-peer.at/geos_one/mystic/archive/main.zip -O $MSTEMPDIR/dbp-main.zip &>/dev/null
rm -rf $MSTEMPDIR/mystic &>/dev/null
pushd $MSTEMPDIR &>/dev/null
unzip dbp-main.zip &>/dev/null
popd &>/dev/null
msg_ok "Downloading ${APP} Mystic BBS Disconnected-by-Peer Installer Files"
#==============================================================================================================
2024-04-20 11:07:14 +02:00
# Mystic install Directory
source $MSTEMPDIR/mystic/mystic/prompt-${SCRIPT_VER}.sh
2024-04-20 11:07:14 +02:00
# Add Cryptlib support
source $MSTEMPDIR/mystic/cryptlib/prompt-${SCRIPT_VER}.sh
# Add Spellcheck
source $MSTEMPDIR/mystic/spellcheck/prompt-${SCRIPT_VER}.sh
# Add Multi Relay Chat Client
source $MSTEMPDIR/mystic/mrc-client/prompt-${SCRIPT_VER}.sh
# Add Multi Relay Chat Server
source $MSTEMPDIR/mystic/mrc-server/prompt-${SCRIPT_VER}.sh
# Add IP2Location
source $MSTEMPDIR/mystic/ip2location/prompt-${SCRIPT_VER}.sh
# Add DBP Scripts
source $MSTEMPDIR/mystic/dbp/prompt-${SCRIPT_VER}.sh
# Add Fail2ban | banip
source $MSTEMPDIR/mystic/fail2ban/prompt-${SCRIPT_VER}.sh
2024-05-11 10:27:47 +02:00
# Add Dosemu2
2024-05-16 17:02:36 +02:00
if [ -n "${DOSEMUVER}" ]; then
2024-04-20 11:07:14 +02:00
source $MSTEMPDIR/mystic/dosemu2/prompt-${SCRIPT_VER}.sh
2024-05-11 10:27:47 +02:00
fi
2023-01-22 11:36:32 +01:00
#==============================================================================================================
2024-04-20 12:20:30 +02:00
# Mystic install
2024-04-20 11:20:06 +02:00
source $MSTEMPDIR/mystic/mystic/install-${SCRIPT_VER}.sh
2024-04-20 12:20:30 +02:00
# Add Spellcheck
source $MSTEMPDIR/mystic/spellcheck/install-${SCRIPT_VER}.sh
# Add Multi Relay Chat Client
source $MSTEMPDIR/mystic/mrc-client/install-${SCRIPT_VER}.sh
# Add Multi Relay Chat Server
source $MSTEMPDIR/mystic/mrc-server/install-${SCRIPT_VER}.sh
2024-04-20 13:23:50 +02:00
# Add Cryptlib support
source $MSTEMPDIR/mystic/cryptlib/install-${SCRIPT_VER}.sh
2024-04-20 14:04:22 +02:00
# Add IP2Location
source $MSTEMPDIR/mystic/ip2location/install-${SCRIPT_VER}.sh
# Add DBP Scripts
source $MSTEMPDIR/mystic/dbp/install-${SCRIPT_VER}.sh
2024-04-20 14:18:20 +02:00
# Add Fail2ban | banip
source $MSTEMPDIR/mystic/fail2ban/install-${SCRIPT_VER}.sh
2024-05-11 10:27:47 +02:00
# Add Dosemu2
2024-05-16 17:02:36 +02:00
if [ -n "${DOSEMUVER}" ]; then
2024-04-20 14:18:20 +02:00
source $MSTEMPDIR/mystic/dosemu2/install-${SCRIPT_VER}.sh
2024-05-11 10:27:47 +02:00
fi
2024-04-20 11:20:06 +02:00
2023-01-22 11:36:32 +01:00
#==============================================================================================================
2024-04-20 14:46:05 +02:00
# Mystic install
source $MSTEMPDIR/mystic/mystic/config-${SCRIPT_VER}.sh
# Add Spellcheck
source $MSTEMPDIR/mystic/spellcheck/config-${SCRIPT_VER}.sh
# Add Multi Relay Chat Client
source $MSTEMPDIR/mystic/mrc-client/config-${SCRIPT_VER}.sh
# Add Multi Relay Chat Server
source $MSTEMPDIR/mystic/mrc-server/config-${SCRIPT_VER}.sh
# Add Cryptlib support
source $MSTEMPDIR/mystic/cryptlib/config-${SCRIPT_VER}.sh
# Add IP2Location
source $MSTEMPDIR/mystic/ip2location/config-${SCRIPT_VER}.sh
# Add DBP Scripts
source $MSTEMPDIR/mystic/dbp/config-${SCRIPT_VER}.sh
# Add Fail2ban | banip
source $MSTEMPDIR/mystic/fail2ban/config-${SCRIPT_VER}.sh
2024-05-11 10:27:47 +02:00
# Add Dosemu2
2024-05-16 17:02:36 +02:00
if [ -n "${DOSEMUVER}" ]; then
2024-04-20 14:46:05 +02:00
source $MSTEMPDIR/mystic/dosemu2/config-${SCRIPT_VER}.sh
2024-05-11 10:27:47 +02:00
fi
2023-01-22 11:36:32 +01:00
2024-04-20 14:46:05 +02:00
#==============================================================================================================
2023-01-22 11:36:32 +01:00
msg_ok "Completed Successfully!\n"
2024-04-20 15:22:04 +02:00
#==============================================================================================================
2024-04-20 15:52:30 +02:00
DBP_INFO=${MYSTIC_DIR}/docs/DbP-install.info
echo "==============================================================================================================" > ${DBP_INFO}
2024-04-20 15:22:04 +02:00
# Mystic install
source $MSTEMPDIR/mystic/mystic/info-${SCRIPT_VER}.sh
# Add Spellcheck
source $MSTEMPDIR/mystic/spellcheck/info-${SCRIPT_VER}.sh
# Add Multi Relay Chat Client
source $MSTEMPDIR/mystic/mrc-client/info-${SCRIPT_VER}.sh
# Add Multi Relay Chat Server
source $MSTEMPDIR/mystic/mrc-server/info-${SCRIPT_VER}.sh
# Add Cryptlib support
source $MSTEMPDIR/mystic/cryptlib/info-${SCRIPT_VER}.sh
# Add IP2Location
source $MSTEMPDIR/mystic/ip2location/info-${SCRIPT_VER}.sh
# Add DBP Scripts
source $MSTEMPDIR/mystic/dbp/info-${SCRIPT_VER}.sh
# Add Fail2ban | banip
source $MSTEMPDIR/mystic/fail2ban/info-${SCRIPT_VER}.sh
2024-05-11 10:27:47 +02:00
# Add Dosemu2
2024-05-16 17:02:36 +02:00
if [ -n "${DOSEMUVER}" ]; then
2024-04-20 15:22:04 +02:00
source $MSTEMPDIR/mystic/dosemu2/info-${SCRIPT_VER}.sh
2024-05-11 10:27:47 +02:00
fi
2024-04-20 15:22:04 +02:00
#==============================================================================================================
2024-04-20 15:52:30 +02:00
2024-05-11 08:09:45 +02:00
echo "if you want to start some mystic tools become the mystic user first (su - mystic) or" >> ${DBP_INFO}
echo "start the command with sudo -u mystic ./mis ...." >> ${DBP_INFO}
echo "when you switched to the ${MYSTIC_DIR}" >> ${DBP_INFO}
echo "" >> ${DBP_INFO}
echo "==============================================================================================================" >> ${DBP_INFO}
2024-04-20 15:52:30 +02:00
chown mystic:mystic -R ${MYSTIC_DIR} &>/dev/null
cat ${DBP_INFO}
2024-04-20 16:21:26 +02:00
2024-04-20 20:36:33 +02:00
echo "These Infos are also been put into ${DBP_INFO}"