From f5dba27ec6b24f62b84f42ec76e225bd8a14da0e Mon Sep 17 00:00:00 2001 From: Mario Fetka Date: Sat, 20 Apr 2024 10:00:07 +0200 Subject: [PATCH] put prompt/install/config into own files --- cryptlib/prompt-v1.sh | 0 dbp/cron.sh | 13 ++ dbp/dbp.ini | 8 +- dbp/prompt-v1.sh | 0 fail2ban/prompt-v1.sh | 0 install-next.sh | 142 ++++++++++-------- install.sh | 2 +- mrc-client/install-v0.sh | 10 +- mrc-client/install-v1.sh | 4 +- mrc-client/mrc.service | 33 ---- .../{mrc-start.sh => mrc_client-start.sh} | 0 .../{mrc-stop.sh => mrc_client-stop.sh} | 0 mrc-client/prompt-v1.sh | 0 mrc-server/install-v1.sh | 4 +- .../{mrc-start.sh => mrc_server-start.sh} | 20 +-- .../{mrc-stop.sh => mrc_server-stop.sh} | 26 ++-- mrc-server/prompt-v1.sh | 0 {mis => mystic}/install-v0.sh | 0 {mis => mystic}/install-v1.sh | 2 +- {mis => mystic}/mis-start.sh | 0 {mis => mystic}/mis-stop.sh | 0 {mis => mystic}/mis.service | 0 mystic/prompt-v1.sh | 13 ++ 23 files changed, 143 insertions(+), 134 deletions(-) create mode 100644 cryptlib/prompt-v1.sh create mode 100644 dbp/prompt-v1.sh create mode 100644 fail2ban/prompt-v1.sh delete mode 100644 mrc-client/mrc.service rename mrc-client/{mrc-start.sh => mrc_client-start.sh} (100%) rename mrc-client/{mrc-stop.sh => mrc_client-stop.sh} (100%) create mode 100644 mrc-client/prompt-v1.sh rename mrc-server/{mrc-start.sh => mrc_server-start.sh} (70%) rename mrc-server/{mrc-stop.sh => mrc_server-stop.sh} (68%) create mode 100644 mrc-server/prompt-v1.sh rename {mis => mystic}/install-v0.sh (100%) rename {mis => mystic}/install-v1.sh (93%) rename {mis => mystic}/mis-start.sh (100%) rename {mis => mystic}/mis-stop.sh (100%) rename {mis => mystic}/mis.service (100%) create mode 100644 mystic/prompt-v1.sh diff --git a/cryptlib/prompt-v1.sh b/cryptlib/prompt-v1.sh new file mode 100644 index 0000000..e69de29 diff --git a/dbp/cron.sh b/dbp/cron.sh index ca39f69..c409614 100755 --- a/dbp/cron.sh +++ b/dbp/cron.sh @@ -36,6 +36,9 @@ ERROR_KEEP=`${MYSTIC_DIR}/inimod r ${INIFILE} -S ErrorLog -k RetentionTime --sil MRCCHAT_ENABLE=`${MYSTIC_DIR}/inimod r ${INIFILE} -S GeneralDbP -k MrcChatLog --silent` MRCCHAT_KEEP=`${MYSTIC_DIR}/inimod r ${INIFILE} -S MrcChatLog -k RetentionTime --silent` +MRCSERVER_ENABLE=`${MYSTIC_DIR}/inimod r ${INIFILE} -S GeneralDbP -k MrcServerLog --silent` +MRCSERVER_KEEP=`${MYSTIC_DIR}/inimod r ${INIFILE} -S MrcServerLog -k RetentionTime --silent` + NODE_ENABLE=`${MYSTIC_DIR}/inimod r ${INIFILE} -S GeneralDbP -k NodeLog --silent` NODE_COUNT=`${MYSTIC_DIR}/inimod r ${INIFILE} -S NodeLog -k MaxNodes --silent` NODE_KEEP=`${MYSTIC_DIR}/inimod r ${INIFILE} -S NodeLog -k RetentionTime --silent` @@ -91,6 +94,16 @@ if [ $MRCCHAT_ENABLE = "true" ]; then find ${MYSTIC_DIR}/logs/ -type f -mtime +${MRCCHAT_KEEP} -name 'mrcchat.*' -exec rm {} \; fi +if [ $MRCSERVER_ENABLE = "true" ]; then + touch ${MYSTIC_DIR}/logs/mrcserver.${NOW}.log + touch ${MYSTIC_DIR}/logs/mrcserver.${TOMORROW}.log + mkdir -p ${MYSTIC_DIR}/data/mrc/ + ln -sf ../../logs/mrcserver.${NOW}.log ${MYSTIC_DIR}/data/mrc/mrcserver.log + ln -sf mrcserver.${NOW}.log ${MYSTIC_DIR}/logs/mrcserver.log + [ -f /${MYSTIC_DIR}/logs/mrcserver.${YESTERDAY}.log ] && gzip -9 ${MYSTIC_DIR}/logs/mrcserver.${YESTERDAY}.log + find ${MYSTIC_DIR}/logs/ -type f -mtime +${MRCserver_KEEP} -name 'mrcserver.*' -exec rm {} \; +fi + if [ $NODE_ENABLE = "true" ]; then for i in $(eval echo "{$NODE_START..$NODE_COUNT}") diff --git a/dbp/dbp.ini b/dbp/dbp.ini index a4bd315..67acfa1 100644 --- a/dbp/dbp.ini +++ b/dbp/dbp.ini @@ -45,7 +45,11 @@ MaxNodes=32 RetentionTime=7 [MrcChatLog] -; Set maximum days of logs to keep for the Multo Relay Chat +; Set maximum days of logs to keep for the Multi Relay Chat +RetentionTime=7 + +[MrcServerLog] +; Set maximum days of logs to keep for the Multi Relay Chat Server RetentionTime=7 [BanUnbanIP] @@ -53,5 +57,5 @@ RetentionTime=7 ; depends on what you seleted in the install stage BanningService=fail2ban -;Also unban in Mystic when useng the unban +;Also unban in Mystic when using the unban UnbanInMystic=true diff --git a/dbp/prompt-v1.sh b/dbp/prompt-v1.sh new file mode 100644 index 0000000..e69de29 diff --git a/fail2ban/prompt-v1.sh b/fail2ban/prompt-v1.sh new file mode 100644 index 0000000..e69de29 diff --git a/install-next.sh b/install-next.sh index bd62150..354c29c 100644 --- a/install-next.sh +++ b/install-next.sh @@ -9,11 +9,12 @@ CL=$(echo "\033[m") BFR="\\r\\033[K" HOLD="-" CM="${GN}✓${CL}" -APP="Mystic" +APP="Mystic Installer" MSDIR="/opt/mystic" +MSTEMPDIR="/usr/local/src/mystic" TMP_DIR=$(mktemp -d) -apt install lsb-release dpkg-dev wget curl figlet lolcat -y &>/dev/null +apt install lsb-release dpkg-dev wget curl figlet lolcat unzip -y &>/dev/null ARCH=$(dpkg-architecture -qDEB_HOST_MULTIARCH) @@ -29,6 +30,8 @@ IPBAN_GROUP=$(getent group ipban) LIBDIR=/usr/lib/${ARCH} MYSTIC_VER="112a48" SCRIPT_VER="v1" +MRC_VER="129a" +MRC_SERVER_VER="129a" if [ "${ARCH}" = "x86_64-linux-gnu" ]; then INIMOD_ARCH="amd64" @@ -63,9 +66,18 @@ else DIST="${CODENAME}" 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 +msg_ok "Finisched adding bullseye repository" +fi - -MRC_VER="129a" +msg_info "adding jessie repository for openssl 1.0" +wget https://deb.freexian.com/extended-lts/archive-key.gpg -O /etc/apt/trusted.gpg.d/freexian-archive-extended-lts.gpg +echo "deb http://deb.freexian.com/extended-lts jessie main contrib non-free" > /etc/apt/sources.list.d/jessie-extended-lts.list +msg_ok "Finisched adding jessie repository" hostname="$(hostname)" set -o errexit @@ -84,6 +96,7 @@ function error_exit() { 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 @@ -94,6 +107,7 @@ while true; do esac done clear + function header_info { /usr/bin/env figlet -w 60 -c "Mystic BBS DbP Installer" | /usr/games/lolcat -f } @@ -125,11 +139,25 @@ apt update &>/dev/null apt install -y curl &>/dev/null apt install -y wget &>/dev/null apt install -y gnupg &>/dev/null -mkdir -p /usr/local/src/mystic &>/dev/null +mkdir -p $MSTEMPDIR &>/dev/null msg_ok "Setup ${APP} Repository" #============================================================================================================== +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" + +#============================================================================================================== + +source $MSTEMPDIR/mystic/mystic/prompt-${SCRIPT_VER}.sh + +exit 0 + MSAPPDIR=$(whiptail --inputbox "Mystic Install Directory that also must be set in the Mystic insallation Programm." 8 58 $MSDIR --title "Install Directory" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? if [ -z $MSAPPDIR ]; then @@ -212,21 +240,12 @@ 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 -apt update &>/dev/null -msg_ok "Finisched adding bullseye repository" -fi - msg_info "Starting ${APP} Installation !!!! Plz set Installation dir the same as bevor !!!" apt install -y unrar-free python3 python2 libpython2.7 &>/dev/null -wget -N http://www.mysticbbs.com/downloads/mys${MYSTIC_VER}_${MYSTIC_ARCH}.${MYSTIC_EXT} -O /usr/local/src/mystic/mys${MYSTIC_VER}_${MYSTIC_ARCH}.${MYSTIC_EXT} &>/dev/null -rm -rf /usr/local/src/mystic/mystic-${MYSTIC_VER} &>/dev/null -mkdir -p /usr/local/src/mystic/mystic-${MYSTIC_VER} &>/dev/null -pushd /usr/local/src/mystic/mystic-${MYSTIC_VER} &>/dev/null +wget -N http://www.mysticbbs.com/downloads/mys${MYSTIC_VER}_${MYSTIC_ARCH}.${MYSTIC_EXT} -O $MSTEMPDIR/mys${MYSTIC_VER}_${MYSTIC_ARCH}.${MYSTIC_EXT} &>/dev/null +rm -rf $MSTEMPDIR/mystic-${MYSTIC_VER} &>/dev/null +mkdir -p $MSTEMPDIR/mystic-${MYSTIC_VER} &>/dev/null +pushd $MSTEMPDIR/mystic-${MYSTIC_VER} &>/dev/null if [ "${MYSTIC_EXT}" = "rar" ]; then unrar -x ../mys${MYSTIC_VER}_${MYSTIC_ARCH}.${MYSTIC_EXT} &>/dev/null elif [ "${MYSTIC_EXT}" = "zip" ]; then @@ -239,16 +258,9 @@ chmod +x install &>/dev/null popd &>/dev/null msg_ok "Finisched ${APP} Installation" -msg_info "Downloading ${APP} Systemd Start/Stop Scripts and Service File" -wget -N https://gitea.disconnected-by-peer.at/geos_one/mystic/archive/main.zip -O /usr/local/src/mystic/dbp-main.zip &>/dev/null -rm -rf /usr/local/src/mystic/mystic &>/dev/null -pushd /usr/local/src/mystic &>/dev/null -unzip dbp-main.zip &>/dev/null -popd &>/dev/null -msg_ok "Downloading ${APP} Systemd Start/Stop Scripts and Service File" msg_info "Installing ${APP} Systemd Start/Stop Scripts and Service File" -pushd /usr/local/src/mystic/mystic/mis &>/dev/null +pushd $MSTEMPDIR/mystic/mis &>/dev/null bash install-${SCRIPT_VER}.sh $MYSTIC_DIR &>/dev/null popd &>/dev/null msg_ok "Installing ${APP} Systemd Start/Stop Scripts and Service File" @@ -282,10 +294,10 @@ msg_ok "Creating ${APP} und setting Permissions in ${MYSTIC_DIR}" if [ $SPELL = "Yes" ]; then msg_info "Setting up Spellcheck for ${APP}" apt install -y libhunspell-dev &>/dev/null -wget -N http://www.mysticbbs.com/downloads/mystic_spellcheck_v2.zip -O /usr/local/src/mystic/mystic_spellcheck_v2.zip &>/dev/null -rm -rf /usr/local/src/mystic/mystic_spellcheck_v2 &>/dev/null -mkdir -p /usr/local/src/mystic/mystic_spellcheck_v2 &>/dev/null -pushd /usr/local/src/mystic/mystic_spellcheck_v2 &>/dev/null +wget -N http://www.mysticbbs.com/downloads/mystic_spellcheck_v2.zip -O $MSTEMPDIR/mystic_spellcheck_v2.zip &>/dev/null +rm -rf $MSTEMPDIR/mystic_spellcheck_v2 &>/dev/null +mkdir -p $MSTEMPDIR/mystic_spellcheck_v2 &>/dev/null +pushd $MSTEMPDIR/mystic_spellcheck_v2 &>/dev/null unzip ../mystic_spellcheck_v2.zip &>/dev/null cp dictionary.* ${MYSTIC_DIR}/data/ cp wordlist.txt ${MYSTIC_DIR}/data/ @@ -301,10 +313,10 @@ fi if [ $MRC = "Yes" ]; then msg_info "Setting up Multi Relay Chat for ${APP}" apt install -y build-essential &>/dev/null -wget -N https://www.phenomprod.com/releases/mystic/pn-mrc${MRC_VER}.zip -O /usr/local/src/mystic/pn-mrc${MRC_VER}.zip &>/dev/null -rm -rf /usr/local/src/mystic/pn-mrc${MRC_VER} &>/dev/null -mkdir -p /usr/local/src/mystic/pn-mrc${MRC_VER} &>/dev/null -pushd /usr/local/src/mystic/pn-mrc${MRC_VER} &>/dev/null +wget -N https://www.phenomprod.com/releases/mystic/pn-mrc${MRC_VER}.zip -O $MSTEMPDIR/pn-mrc${MRC_VER}.zip &>/dev/null +rm -rf $MSTEMPDIR/pn-mrc${MRC_VER} &>/dev/null +mkdir -p $MSTEMPDIR/pn-mrc${MRC_VER} &>/dev/null +pushd $MSTEMPDIR/pn-mrc${MRC_VER} &>/dev/null unzip ../pn-mrc${MRC_VER}.zip &>/dev/null cp mrc_${MRC_VER}/mrc_{client,config}.py ${MYSTIC_DIR}/ cp mrc_${MRC_VER}/scripts/* ${MYSTIC_DIR}/themes/default/scripts/ @@ -314,7 +326,7 @@ popd &>/dev/null msg_ok "Setting up Multi Relay Chat for ${APP}" msg_info "Installing Multi Relay Chat Systemd Start/Stop Scripts and Service File" -pushd /usr/local/src/mystic/mystic/mrc-client &>/dev/null +pushd $MSTEMPDIR/mystic/mrc-client &>/dev/null bash install-${SCRIPT_VER}.sh $MYSTIC_DIR &>/dev/null popd &>/dev/null msg_ok "Installing Multi Relay Chat Systemd Start/Stop Scripts and Service File" @@ -329,15 +341,15 @@ apt install -y build-essential &>/dev/null apt install -y gcc-9 g++-9 cpp-9 gcc g++ cpp &>/dev/null apt install -y patch &>/dev/null apt install -y dos2unix &>/dev/null -wget -N http://www.mysticbbs.com/downloads/cl345.zip -O /usr/local/src/mystic/cryptlib345.zip &>/dev/null -rm -rf /usr/local/src/mystic/cryptlib-3.4.5 &>/dev/null -mkdir -p /usr/local/src/mystic/cryptlib-3.4.5 &>/dev/null -pushd /usr/local/src/mystic/cryptlib-3.4.5 &>/dev/null +wget -N http://www.mysticbbs.com/downloads/cl345.zip -O $MSTEMPDIR/cryptlib345.zip &>/dev/null +rm -rf $MSTEMPDIR/cryptlib-3.4.5 &>/dev/null +mkdir -p $MSTEMPDIR/cryptlib-3.4.5 &>/dev/null +pushd $MSTEMPDIR/cryptlib-3.4.5 &>/dev/null unzip ../cryptlib345.zip &>/dev/null dos2unix tools/* &>/dev/null dos2unix kernel/* &>/dev/null -patch -p1 -i /usr/local/src/mystic/mystic/cryptlib/gccversion-345.patch &>/dev/null -patch -p0 -i /usr/local/src/mystic/mystic/cryptlib/cl-linux-yield.patch &>/dev/null +patch -p1 -i $MSTEMPDIR/mystic/cryptlib/gccversion-345.patch &>/dev/null +patch -p0 -i $MSTEMPDIR/mystic/cryptlib/cl-linux-yield.patch &>/dev/null ln -sf gcc-9 /usr/bin/gcc &>/dev/null ln -sf g++-9 /usr/bin/g++ &>/dev/null ln -sf cpp-9 /usr/bin/cpp &>/dev/null @@ -357,10 +369,10 @@ fi if [ $IP2L = "Yes" ]; then msg_info "Setting up IP2Location Download Client for ${APP}" apt install -y libwww-perl &>/dev/null -wget -N https://www.ip2location.com/downloads/ip2location-downloader-linux.zip -O /usr/local/src/mystic/ip2location-downloader-linux.zip &>/dev/null -rm -rf /usr/local/src/mystic/ip2location-downloader-linux &>/dev/null -mkdir -p /usr/local/src/mystic/ip2location-downloader-linux &>/dev/null -pushd /usr/local/src/mystic/ip2location-downloader-linux &>/dev/null +wget -N https://www.ip2location.com/downloads/ip2location-downloader-linux.zip -O $MSTEMPDIR/ip2location-downloader-linux.zip &>/dev/null +rm -rf $MSTEMPDIR/ip2location-downloader-linux &>/dev/null +mkdir -p $MSTEMPDIR/ip2location-downloader-linux &>/dev/null +pushd $MSTEMPDIR/ip2location-downloader-linux &>/dev/null unzip ../ip2location-downloader-linux.zip &>/dev/null cp download.pl ${MYSTIC_DIR}/ip2location chmod +x ${MYSTIC_DIR}/ip2location @@ -373,10 +385,10 @@ fi if [ $DBPSCRIPTS = "Yes" ]; then msg_info "Installing bbs.disconnected-by-peer.at Scripts Dependencies for ${APP}" -wget -N https://ftp.disconnected-by-peer.at/IniMod/IniMod_linux_${INIMOD_ARCH}.zip -O /usr/local/src/mystic/IniMod_linux_${INIMOD_ARCH}.zip &>/dev/null -rm -rf /usr/local/src/mystic/IniMod_linux_${INIMOD_ARCH} &>/dev/null -mkdir -p /usr/local/src/mystic/IniMod_linux_${INIMOD_ARCH} &>/dev/null -pushd /usr/local/src/mystic/IniMod_linux_${INIMOD_ARCH} &>/dev/null +wget -N https://ftp.disconnected-by-peer.at/IniMod/IniMod_linux_${INIMOD_ARCH}.zip -O $MSTEMPDIR/IniMod_linux_${INIMOD_ARCH}.zip &>/dev/null +rm -rf $MSTEMPDIR/IniMod_linux_${INIMOD_ARCH} &>/dev/null +mkdir -p $MSTEMPDIR/IniMod_linux_${INIMOD_ARCH} &>/dev/null +pushd $MSTEMPDIR/IniMod_linux_${INIMOD_ARCH} &>/dev/null unzip ../IniMod_linux_${INIMOD_ARCH}.zip &>/dev/null cp inimod ${MYSTIC_DIR} chmod +x ${MYSTIC_DIR}/inimod @@ -385,7 +397,7 @@ popd &>/dev/null msg_ok "Installing bbs.disconnected-by-peer.at Scripts Dependencies for ${APP}" msg_info "Installing DbP Cron/banip/unbanip Scripts" -pushd /usr/local/src/mystic/mystic/dbp &>/dev/null +pushd $MSTEMPDIR/mystic/dbp &>/dev/null bash install-${SCRIPT_VER}.sh $MYSTIC_DIR &>/dev/null popd &>/dev/null msg_ok "Installing DbP Cron/banip/unbanip Scripts" @@ -406,7 +418,7 @@ usermod --append --groups fail2ban mystic &>/dev/null msg_ok "Installing Fail2Ban Dependencies for ${APP}" msg_info "Installing Fail2Ban Scripts for ${APP}" -pushd /usr/local/src/mystic/mystic/fail2ban &>/dev/null +pushd $MSTEMPDIR/mystic/fail2ban &>/dev/null bash install-${SCRIPT_VER}.sh $MYSTIC_DIR &>/dev/null popd &>/dev/null msg_ok "Installing Fail2Ban Scripts for ${APP}" @@ -415,18 +427,18 @@ fi if [ $BANUNBAN = "ipban" ]; then msg_info "Installing IpBan Dependencies for ${APP}" -pushd /usr/local/src/mystic &>/dev/null -wget -N https://github.com/DigitalRuby/IPBan/raw/master/IPBanCore/Linux/Scripts/Install.sh -O /usr/local/src/mystic/ipban-install.sh &>/dev/null +pushd $MSTEMPDIR &>/dev/null +wget -N https://github.com/DigitalRuby/IPBan/raw/master/IPBanCore/Linux/Scripts/Install.sh -O $MSTEMPDIR/ipban-install.sh &>/dev/null apt install -y fail2ban &>/dev/null apt install -y iptables &>/dev/null apt install -y ipset &>/dev/null apt install -y xmlstarlet &>/dev/null -sed -i '/yum/d' /usr/local/src/mystic/ipban-install.sh &>/dev/null -sed -i '/systemctl/d' /usr/local/src/mystic/ipban-install.sh &>/dev/null -sed -e 's!sudo !!g' -i /usr/local/src/mystic/ipban-install.sh &>/dev/null -sed -e 's!-qq!-qqo!g' -i /usr/local/src/mystic/ipban-install.sh &>/dev/null -sed -i '/nano/d' /usr/local/src/mystic/ipban-install.sh &>/dev/null -bash /usr/local/src/mystic/ipban-install.sh &>/dev/null +sed -i '/yum/d' $MSTEMPDIR/ipban-install.sh &>/dev/null +sed -i '/systemctl/d' $MSTEMPDIR/ipban-install.sh &>/dev/null +sed -e 's!sudo !!g' -i $MSTEMPDIR/ipban-install.sh &>/dev/null +sed -e 's!-qq!-qqo!g' -i $MSTEMPDIR/ipban-install.sh &>/dev/null +sed -i '/nano/d' $MSTEMPDIR/ipban-install.sh &>/dev/null +bash $MSTEMPDIR/ipban-install.sh &>/dev/null if [ -z "${IPBAN_GROUP}" ]; then groupadd ipban &>/dev/null fi @@ -438,7 +450,7 @@ popd &>/dev/null msg_ok "Installing IpBan Dependencies for ${APP}" #msg_info "Installing Fail2Ban Scripts for ${APP}" -#pushd /usr/local/src/mystic/mystic/ipban &>/dev/null +#pushd $MSTEMPDIR/mystic/ipban &>/dev/null #bash install-${SCRIPT_VER}.sh $MYSTIC_DIR &>/dev/null #popd &>/dev/null #msg_ok "Installing Fail2Ban Scripts for ${APP}" @@ -449,16 +461,16 @@ fi if [ $DOSEMU = "Yes" ]; then msg_info "Installing DosEmu2 Dependencies for ${APP}" -pushd /usr/local/src/mystic &>/dev/null +pushd $MSTEMPDIR &>/dev/null curl 'https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x6d9cd73b401a130336ed0a56ebe1b5ded2ad45d6' | tee /etc/apt/trusted.gpg.d/code.launchpad.net-dosemu2.asc &>/dev/null echo "deb https://ppa.launchpadcontent.net/dosemu2/ppa/ubuntu $DIST main" | tee /etc/apt/sources.list.d/dosemu2.list &>/dev/null apt update &>/dev/null apt install -y dosemu2 &>/dev/null apt install -y install-otherdos &>/dev/null -#rm -rf /usr/local/src/mystic/IniMod_linux${INIMOD_ARCH} &>/dev/null -#mkdir -p /usr/local/src/mystic/IniMod_linux${INIMOD_ARCH} &>/dev/null -#pushd /usr/local/src/mystic/IniMod_linux${INIMOD_ARCH} &>/dev/null +#rm -rf $MSTEMPDIR/IniMod_linux${INIMOD_ARCH} &>/dev/null +#mkdir -p $MSTEMPDIR/IniMod_linux${INIMOD_ARCH} &>/dev/null +#pushd $MSTEMPDIR/IniMod_linux${INIMOD_ARCH} &>/dev/null #unzip ../IniMod_linux${INIMOD_ARCH}.zip &>/dev/null #cp inimod ${MYSTIC_DIR} #chmod +x ${MYSTIC_DIR}/inimod @@ -467,7 +479,7 @@ apt install -y install-otherdos &>/dev/null msg_ok "Installing DosEmu2 Dependencies for ${APP}" #msg_info "Installing DbP Cron/banip/unbanip Scripts" -#pushd /usr/local/src/mystic/mystic/dbp &>/dev/null +#pushd $MSTEMPDIR/mystic/dbp &>/dev/null #bash install-${SCRIPT_VER}.sh $MYSTIC_DIR &>/dev/null #popd &>/dev/null #msg_ok "Installing DbP Cron/banip/unbanip Scripts" diff --git a/install.sh b/install.sh index 89c51c7..7bb76eb 100644 --- a/install.sh +++ b/install.sh @@ -263,7 +263,7 @@ popd &>/dev/null msg_ok "Downloading ${APP} Systemd Start/Stop Scripts and Service File" msg_info "Installing ${APP} Systemd Start/Stop Scripts and Service File" -pushd /usr/local/src/mystic/mystic/mis &>/dev/null +pushd /usr/local/src/mystic/mystic/mystic &>/dev/null bash install-${SCRIPT_VER}.sh $MYSTIC_DIR &>/dev/null popd &>/dev/null msg_ok "Installing ${APP} Systemd Start/Stop Scripts and Service File" diff --git a/mrc-client/install-v0.sh b/mrc-client/install-v0.sh index 97afaab..cb26bbf 100644 --- a/mrc-client/install-v0.sh +++ b/mrc-client/install-v0.sh @@ -2,10 +2,10 @@ MYSTIC_DIR="$1" -sed -e "s!@MYSTIC_DIR@!${MYSTIC_DIR}!g" mrc-start.sh > ${MYSTIC_DIR}/mrc-start -chmod +x ${MYSTIC_DIR}/mrc-start -sed -e "s!@MYSTIC_DIR@!${MYSTIC_DIR}!g" mrc-stop.sh > ${MYSTIC_DIR}/mrc-stop -chmod +x ${MYSTIC_DIR}/mrc-stop -sed -e "s!@MYSTIC_DIR@!${MYSTIC_DIR}!g" mrc.service > /etc/systemd/system/mrc.service +sed -e "s!@MYSTIC_DIR@!${MYSTIC_DIR}!g" mrc_client-start.sh > ${MYSTIC_DIR}/mrc_client-start +chmod +x ${MYSTIC_DIR}/mrc_client-start +sed -e "s!@MYSTIC_DIR@!${MYSTIC_DIR}!g" mrc_client-stop.sh > ${MYSTIC_DIR}/mrc_client-stop +chmod +x ${MYSTIC_DIR}/mrc_client-stop +sed -e "s!@MYSTIC_DIR@!${MYSTIC_DIR}!g" mrc-client.service > /etc/systemd/system/mrc-client.service systemctl daemon-reload diff --git a/mrc-client/install-v1.sh b/mrc-client/install-v1.sh index a2760f2..cb26bbf 100644 --- a/mrc-client/install-v1.sh +++ b/mrc-client/install-v1.sh @@ -2,9 +2,9 @@ MYSTIC_DIR="$1" -sed -e "s!@MYSTIC_DIR@!${MYSTIC_DIR}!g" mrc-start.sh > ${MYSTIC_DIR}/mrc_client-start +sed -e "s!@MYSTIC_DIR@!${MYSTIC_DIR}!g" mrc_client-start.sh > ${MYSTIC_DIR}/mrc_client-start chmod +x ${MYSTIC_DIR}/mrc_client-start -sed -e "s!@MYSTIC_DIR@!${MYSTIC_DIR}!g" mrc-stop.sh > ${MYSTIC_DIR}/mrc_client-stop +sed -e "s!@MYSTIC_DIR@!${MYSTIC_DIR}!g" mrc_client-stop.sh > ${MYSTIC_DIR}/mrc_client-stop chmod +x ${MYSTIC_DIR}/mrc_client-stop sed -e "s!@MYSTIC_DIR@!${MYSTIC_DIR}!g" mrc-client.service > /etc/systemd/system/mrc-client.service systemctl daemon-reload diff --git a/mrc-client/mrc.service b/mrc-client/mrc.service deleted file mode 100644 index 9b8d55d..0000000 --- a/mrc-client/mrc.service +++ /dev/null @@ -1,33 +0,0 @@ -#================================================================================================== -# This systemd service file can be used to start and stop the 'Multi Relay Chat' python script as # -# a proper service module. In order for it to work correctly, it must be set to 'Type=forking'. # -# As a forking service, it will decide if start/stop was a failure based on the returned error # -# code. A return of 0 will be considered success, and a return of 1 will be a failure. The MRC # -# python script should ideally be launched as the same user who owns the mystic directories. To # -# do this, be sure to uncomment and set the 'User=' option in the [Service] section below. If you # -# don't, the script will be executed as root, which may have security implications. This file is # -# indended to work with Debian, Ubuntu, Raspbian and other debian based distributions, but may # -# work with others as well. # -# # -# Be sure to set the location of your mrc-start.sh and mrc-stop.sh scripts in the [Service] # -# section below, and to optionally set your user as described above. # -#================================================================================================== - -[Unit] -Description=Multi Relay Chat for Mystic BBS -After=network.target -After=systemd-user-sessions.service -After=network-online.target - -[Service] -Restart=on-failure -RestartSec=5s -Type=forking -# Be sure to set 'User' below to the user who owns your mystic directory. -User=mystic -# Ensure that the paths and filenames below are correct. -ExecStart=@MYSTIC_DIR@/mrc-start -ExecStop=@MYSTIC_DIR@/mrc-stop - -[Install] -WantedBy=multi-user.target \ No newline at end of file diff --git a/mrc-client/mrc-start.sh b/mrc-client/mrc_client-start.sh similarity index 100% rename from mrc-client/mrc-start.sh rename to mrc-client/mrc_client-start.sh diff --git a/mrc-client/mrc-stop.sh b/mrc-client/mrc_client-stop.sh similarity index 100% rename from mrc-client/mrc-stop.sh rename to mrc-client/mrc_client-stop.sh diff --git a/mrc-client/prompt-v1.sh b/mrc-client/prompt-v1.sh new file mode 100644 index 0000000..e69de29 diff --git a/mrc-server/install-v1.sh b/mrc-server/install-v1.sh index c6e18ea..a2733dd 100644 --- a/mrc-server/install-v1.sh +++ b/mrc-server/install-v1.sh @@ -2,9 +2,9 @@ MYSTIC_DIR="$1" -sed -e "s!@MYSTIC_DIR@!${MYSTIC_DIR}!g" mrc-start.sh > ${MYSTIC_DIR}/mrc_server-start +sed -e "s!@MYSTIC_DIR@!${MYSTIC_DIR}!g" mrc_server-start.sh > ${MYSTIC_DIR}/mrc_server-start chmod +x ${MYSTIC_DIR}/mrc_server-start -sed -e "s!@MYSTIC_DIR@!${MYSTIC_DIR}!g" mrc-stop.sh > ${MYSTIC_DIR}/mrc_server-stop +sed -e "s!@MYSTIC_DIR@!${MYSTIC_DIR}!g" mrc_server-stop.sh > ${MYSTIC_DIR}/mrc_server-stop chmod +x ${MYSTIC_DIR}/mrc_server-stop sed -e "s!@MYSTIC_DIR@!${MYSTIC_DIR}!g" mrc-server.service > /etc/systemd/system/mrc-server.service systemctl daemon-reload diff --git a/mrc-server/mrc-start.sh b/mrc-server/mrc_server-start.sh similarity index 70% rename from mrc-server/mrc-start.sh rename to mrc-server/mrc_server-start.sh index d0b52cf..3f14db1 100755 --- a/mrc-server/mrc-start.sh +++ b/mrc-server/mrc_server-start.sh @@ -1,7 +1,7 @@ #!/bin/bash #================================================================================================== # This shell script will launch the 'Multi Relay Chat' python script. It is intended to be called # -# via a forked systemd .service file. The script will check that mrc_client.py is not already # +# via a forked systemd .service file. The script will check that mrc_server.py is not already # # running then will launch it. To avoid problems, it should be launched using the same user that # # owns the mystic install directory. If executing manually, use 'sudo -u username' or ensure you # # are logged into the terminal as the user that owns the mystic directory. In a systemd .service # @@ -12,34 +12,34 @@ # MRC Variables: MRC_PATH=@MYSTIC_DIR@ -MRC_SERVER=mrc.bottomlessabyss.net +MRC_SERVER=0.0.0.0 MRC_PORT=5000 -MRC_PID=$(ps auxwww | grep "/usr/bin/python2 ./mrc_client.py" | grep -v grep | awk '{print $2}') +MRC_PID=$(ps auxwww | grep "/usr/bin/python2 ./mrc_server.py" | grep -v grep | awk '{print $2}') -echo "Attempting to start the Multi Relay Chat (MRC) python script.." +echo "Attempting to start the Multi Relay Chat Server (MRC) python script.." -# Make sure the mrc_client.py script isn't already running: +# Make sure the mrc_server.py script isn't already running: if [ ! -z "$MRC_PID" ] then - echo "Error: mrc_client.py script is already running at PID $MRC_PID. Stop it first." + echo "Error: mrc_server.py script is already running at PID $MRC_PID. Stop it first." exit 1 fi # Starting the MRC python script cd $MRC_PATH >/dev/null -/usr/bin/python2 ./mrc_client.py $MRC_SERVER $MRC_PORT & +/usr/bin/python2 ./mrc_server.py $MRC_SERVER:$MRC_PORT > logs/mrcserver.log 2>&1 & cd - >/dev/null # Wait 3 seconds and check for a PID sleep 3 -MRC_PID=$(ps auxwww | grep "/usr/bin/python2 ./mrc_client.py" | grep -v grep | awk '{print $2}') +MRC_PID=$(ps auxwww | grep "/usr/bin/python2 ./mrc_server.py" | grep -v grep | awk '{print $2}') # Making sure it started successfully if [ ! -z "$MRC_PID" ] then - echo "Success! The mrc_client.py script is now running with PID $MRC_PID" + echo "Success! The mrc_server.py script is now running with PID $MRC_PID" exit 0 else - echo "Error: mrc_client.py failed to start. Exiting." + echo "Error: mrc_server.py failed to start. Exiting." exit 1 fi \ No newline at end of file diff --git a/mrc-server/mrc-stop.sh b/mrc-server/mrc_server-stop.sh similarity index 68% rename from mrc-server/mrc-stop.sh rename to mrc-server/mrc_server-stop.sh index 82aa9a0..85a4c08 100755 --- a/mrc-server/mrc-stop.sh +++ b/mrc-server/mrc_server-stop.sh @@ -1,7 +1,7 @@ #!/bin/bash #================================================================================================== -# This shell script will stop the 'Multi Relay Chat' python script. It is intended to be called # -# via a forked systemd .service file. The script will check that mrc_client.py is running then # +# This shell script will stop the 'Multi Relay server' python script. It is intended to be called # +# via a forked systemd .service file. The script will check that mrc_server.py is running then # # will stop it via SIGTERM. If it can't be stopped gracefully within 30 seconds, it will be # # forcefully stopped. The script will exit with an appropriate error code to indicate whether it # # was successful or not. This script is indended to work only with Debian, Ubuntu, Raspbian and # @@ -10,16 +10,16 @@ # MRC Variables. Be sure to set your MRC script path (usually your main mystic directory) MRC_PATH=@MYSTIC_DIR@ -MRC_SERVER=mrc.bottomlessabyss.net +MRC_SERVER=0.0.0.0 MRC_PORT=5000 -MRC_PID=$(ps auxwww | grep "/usr/bin/python2 ./mrc_client.py" | grep -v grep | awk '{print $2}') +MRC_PID=$(ps auxwww | grep "/usr/bin/python2 ./mrc_server.py" | grep -v grep | awk '{print $2}') -echo "Attempting to stop the Multi Relay Chat (MRC) python script.." +echo "Attempting to stop the Multi Relay server (MRC) python script.." -# Make sure the mrc_client.py script is running: +# Make sure the mrc_server.py script is running: if [ -z "$MRC_PID" ] then - echo "Error: mrc_client.py is not running so can't be stopped." + echo "Error: mrc_server.py is not running so can't be stopped." exit 1 fi @@ -33,13 +33,13 @@ echo "Checking to ensure the process stops.." while [ $MRC_COUNTER -lt 6 ] do - MRC_PID=$(ps auxwww | grep "/usr/bin/python2 ./mrc_client.py" | grep -v grep | awk '{print $2}') + MRC_PID=$(ps auxwww | grep "/usr/bin/python2 ./mrc_server.py" | grep -v grep | awk '{print $2}') if [ ! -z "$MRC_PID" ] then echo "Process still running. Waiting 5 seconds.." sleep 5 else - echo "Finished! mrc_client.py script has been stopped successfully." + echo "Finished! mrc_server.py script has been stopped successfully." exit 0 fi let MRC_COUNTER=MRC_COUNTER+1 @@ -48,18 +48,18 @@ done # If it's still running after 30 seconds (6 intervals) then use kill -9 if [ "$MRC_COUNTER" -eq 6 ] && [ ! -z "$MRC_PID" ] then - echo "The mrc_client.py script failed to stop after 60 seconds. Stopping forcefully.." + echo "The mrc_server.py script failed to stop after 60 seconds. Stopping forcefully.." kill -9 $MRC_PID fi # Wait 5 seconds, then double check to ensure it stopped. Otherwise it's considered a failure. sleep 5 -MRC_PID=$(ps auxwww | grep "/usr/bin/python2 ./mrc_client.py" | grep -v grep | awk '{print $2}') +MRC_PID=$(ps auxwww | grep "/usr/bin/python2 ./mrc_server.py" | grep -v grep | awk '{print $2}') if [ ! -z "$MRC_PID" ] then - echo "Error: Failed to kill the mrc_client.py script." + echo "Error: Failed to kill the mrc_server.py script." exit 1 else - echo "Success. The mrc_client.py script was forcefully stopped." + echo "Success. The mrc_server.py script was forcefully stopped." exit 0 fi \ No newline at end of file diff --git a/mrc-server/prompt-v1.sh b/mrc-server/prompt-v1.sh new file mode 100644 index 0000000..e69de29 diff --git a/mis/install-v0.sh b/mystic/install-v0.sh similarity index 100% rename from mis/install-v0.sh rename to mystic/install-v0.sh diff --git a/mis/install-v1.sh b/mystic/install-v1.sh similarity index 93% rename from mis/install-v1.sh rename to mystic/install-v1.sh index f7a7c57..7f9b7a8 100644 --- a/mis/install-v1.sh +++ b/mystic/install-v1.sh @@ -6,6 +6,6 @@ sed -e "s!@MYSTIC_DIR@!${MYSTIC_DIR}!g" mis-start.sh > ${MYSTIC_DIR}/mis-start chmod +x ${MYSTIC_DIR}/mis-start sed -e "s!@MYSTIC_DIR@!${MYSTIC_DIR}!g" mis-stop.sh > ${MYSTIC_DIR}/mis-stop chmod +x ${MYSTIC_DIR}/mis-stop -sed -e "s!@MYSTIC_DIR@!${MYSTIC_DIR}!g" mis.service > /etc/systemd/system/mis.service +sed -e "s!@MYSTIC_DIR@!${MYSTIC_DIR}!g" mis.service > /etc/systemd/system/mystic.service systemctl daemon-reload diff --git a/mis/mis-start.sh b/mystic/mis-start.sh similarity index 100% rename from mis/mis-start.sh rename to mystic/mis-start.sh diff --git a/mis/mis-stop.sh b/mystic/mis-stop.sh similarity index 100% rename from mis/mis-stop.sh rename to mystic/mis-stop.sh diff --git a/mis/mis.service b/mystic/mis.service similarity index 100% rename from mis/mis.service rename to mystic/mis.service diff --git a/mystic/prompt-v1.sh b/mystic/prompt-v1.sh new file mode 100644 index 0000000..b04a9bb --- /dev/null +++ b/mystic/prompt-v1.sh @@ -0,0 +1,13 @@ +MSAPPDIR=$(whiptail --inputbox "Mystic Install Directory that also must be set in the Mystic insallation Programm." 8 58 $MSDIR --title "Install Directory" --cancel-button Exit-Script 3>&1 1>&2 2>&3) +exitstatus=$? +if [ -z $MSAPPDIR ]; then + MYSTIC_DIR="$MSDIR" + echo -e "${DGN}Installing Mystic to: ${BGN}$MYSTIC_DIR${CL}" +else + if [ $exitstatus = 0 ]; then + MYSTIC_DIR="$MSAPPDIR" + echo -e "${DGN}Installing Mystic to: ${BGN}$MYSTIC_DIR${CL}" + fi +fi + +MUTIL_DIR=${MYSTIC_DIR}/mutil.d