#!/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}" APP="Mystic" MSDIR="/opt/mystic" TMP_DIR=$(mktemp -d) ARCH=$(dpkg-architecture -qDEB_HOST_MULTIARCH) apt install lsb-release -y &>/dev/null DIST=$(lsb_release -i -s) CODENAME=$(lsb_release -c -s) GROUP=$(getent group mystic) USER=$(getent shadow mystic) FAIL2BAN_GROUP=$(getent group fail2ban) IPBAN_GROUP=$(getent group ipban) LIBDIR=/usr/lib/${ARCH} MYSTIC_VER="112a48" if [ "${ARCH}" = "x86_64-linux-gnu" ]; then INIMOD_ARCH="amd64" MYSTIC_ARCH="l64" MYSTIC_EXT="rar" elif [ "${ARCH}" = "i386-linux-gnu" ]; then INIMOD_ARCH="amd32" MYSTIC_ARCH="l32" MYSTIC_EXT="rar" elif [ "${ARCH}" = "aarch64-linux-gnu" ]; then INIMOD_ARCH="arm64" MYSTIC_ARCH="p64" MYSTIC_EXT="zip" elif [ "${ARCH}" = "arm-linux-gnueabihf" ]; then INIMOD_ARCH="arm32" MYSTIC_ARCH="p32" MYSTIC_EXT="zip" else echo "Architecture not supported: ${ARCH}" exit 1 fi if [ "${CODENAME}" = "bullseye" ]; then DIST="kinetic" elif [ "${CODENAME}" = "bullseye" ]; then DIST="focal" elif [ "${CODENAME}" = "buster" ]; then DIST="bionic" elif [ "${CODENAME}" = "stretch" ]; then DIST="xenial" else DIST="${CODENAME}" fi MRC_VER="129a" 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 header_info { echo -e "${BL} __ __ _ _ ____ ____ _____ | \/ | | | (_) | _ \| _ \ / ____| | \ / |_ _ ___| |_ _ ___ | |_) | |_) | (___ | |\/| | | | / __| __| |/ __| | _ <| _ < \___ \ | | | | |_| \__ \ |_| | (__ | |_) | |_) |____) | |_| |_|\__, |___/\__|_|\___| |____/|____/|_____/ __/ | _____ _ |___/ _____ _ _ _ | __ \| | | __ \ |_ _| | | | | | | | | | |__ | |__) | | | _ __ ___| |_ __ _| | | ___ _ __ | | | | '_ \| ___/ | | | '_ \/ __| __/ _ | | |/ _ \ __| | |__| | |_) | | _| |_| | | \__ \ || (_| | | | __/ | |_____/|_ __/|_| |_____|_| |_|___/\__\__ _|_|_|\___|_| ${CL}" } header_info function msg_info() { local msg="$1" echo -ne " ${HOLD} ${YW}${msg}..." } function msg_ok() { local msg="$1" echo -e "${BFR} ${CM} ${GN}${msg}${CL}" } msg_info "Setting up ${APP} Repository" apt-get update &>/dev/null apt-get install -y software-properties-common &>/dev/null if [ "${DIST}" = "Debian" ]; then apt-add-repository contrib &>/dev/null apt-add-repository non-free &>/dev/null fi if [ "${DIST}" = "Ubuntu" ]; then apt-add-repository universe &>/dev/null apt-add-repository restricted &>/dev/null apt-add-repository multiverse &>/dev/null fi apt-get update &>/dev/null apt-get install -y curl &>/dev/null apt-get install -y wget &>/dev/null apt-get install -y gnupg &>/dev/null mkdir -p /usr/local/src/mystic &>/dev/null msg_ok "Setup ${APP} Repository" #============================================================================================================== 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 CRYPT=$(whiptail --title "SSL SSH Support in Mystic" --radiolist --cancel-button Exit-Script "Choose Yes No" 8 58 2 \ "Yes" "Add ssl Support" ON \ "No" "Don't add ssl Support" OFF \ 3>&1 1>&2 2>&3) exitstatus=$? if [ $exitstatus = 0 ]; then echo -e "${DGN}Add ssl Support: ${BGN}$CRYPT${CL}" fi SPELL=$(whiptail --title "Spellcheck Support in Mystic" --radiolist --cancel-button Exit-Script "Choose Yes No" 8 58 2 \ "Yes" "Add Spellcheck Support" ON \ "No" "Don't add Spellcheck Support" OFF \ 3>&1 1>&2 2>&3) exitstatus=$? if [ $exitstatus = 0 ]; then echo -e "${DGN}Add Spellcheck Support: ${BGN}$SPELL${CL}" fi MRC=$(whiptail --title "Multi Relay Chat Support in Mystic" --radiolist --cancel-button Exit-Script "Choose Yes No" 8 58 2 \ "Yes" "Add MrC Support" ON \ "No" "Don't add MrC Support" OFF \ 3>&1 1>&2 2>&3) exitstatus=$? if [ $exitstatus = 0 ]; then echo -e "${DGN}Add Multi Realy Chat Support: ${BGN}$MRC${CL}" fi IP2L=$(whiptail --title "Add The IP2Location Download Client to Mystic" --radiolist --cancel-button Exit-Script "Choose Yes No" 8 58 2 \ "Yes" "Add IP2Location Download Client" ON \ "No" "Don't Add IP2Location Download Client" OFF \ 3>&1 1>&2 2>&3) exitstatus=$? if [ $exitstatus = 0 ]; then echo -e "${DGN}Add DbP Script: ${BGN}$IP2L${CL}" fi DBPSCRIPTS=$(whiptail --title "Add The Disconnected by Peer Script to Mystic" --radiolist --cancel-button Exit-Script "Choose Yes No" 8 58 2 \ "Yes" "Add DbP Script" ON \ "No" "Don't add DbP Script" OFF \ 3>&1 1>&2 2>&3) exitstatus=$? if [ $exitstatus = 0 ]; then echo -e "${DGN}Add DbP Script: ${BGN}$DBPSCRIPTS${CL}" fi BANUNBAN=$(whiptail --title "Add Ban / Anban to Mystic" --radiolist --cancel-button Exit-Script "Choose Fail2Ban IpBan No" 12 58 5 \ "fail2ban" "Add Fail2Ban" ON \ "ipban" "Add IpBan" OFF \ "No" "Don't add IP Banning" OFF \ 3>&1 1>&2 2>&3) exitstatus=$? if [ $exitstatus = 0 ]; then echo -e "${DGN}Add Fail2Ban: ${BGN}$BANUNBAN${CL}" fi DOSEMU=$(whiptail --title "Add DosEmu2 to Mystic" --radiolist --cancel-button Exit-Script "Choose Yes No" 8 58 2 \ "Yes" "Add DosEmu2 Script" ON \ "No" "Don't add DosEmu2 Script" OFF \ 3>&1 1>&2 2>&3) exitstatus=$? if [ $exitstatus = 0 ]; then echo -e "${DGN}Add DbP Script: ${BGN}$DOSEMU${CL}" fi #============================================================================================================== msg_info "Starting ${APP} Installation !!!! Plz set Installation dir the same as bevor !!!" apt-get install -y unrar-free python3 python2 &>/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 if [ "${MYSTIC_EXT}" = "rar" ]; then unrar -x ../mys${MYSTIC_VER}_${MYSTIC_ARCH}.${MYSTIC_EXT} &>/dev/null elif [ "${MYSTIC_EXT}" = "zip" ]; then unzip ../mys${MYSTIC_VER}_${MYSTIC_ARCH}.${MYSTIC_EXT} &>/dev/null else exit 1 fi chmod +x install &>/dev/null ./install 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 bash install.sh $MYSTIC_DIR &>/dev/null popd &>/dev/null msg_ok "Installing ${APP} Systemd Start/Stop Scripts and Service File" msg_info "Creating ${APP} und setting Permissions in ${MYSTIC_DIR}" if [ -z "${GROUP}" ]; then groupadd mystic &>/dev/null fi if [ -z "${USER}" ]; then useradd --home-dir ${MYSTIC_DIR} -g mystic mystic &>/dev/null fi chown mystic:mystic -R ${MYSTIC_DIR} &>/dev/null find ${MYSTIC_DIR} -name '*.txt' -type f -exec dos2unix {} \; &>/dev/null find ${MYSTIC_DIR} -name '*.ini' -type f -exec dos2unix {} \; &>/dev/null find ${MYSTIC_DIR} -name '*.txt' -type f -exec chmod 0664 {} \; &>/dev/null find ${MYSTIC_DIR} -name '*.ini' -type f -exec chmod 0664 {} \; &>/dev/null find ${MYSTIC_DIR} -name '*.dat' -type f -exec chmod 0664 {} \; &>/dev/null find ${MYSTIC_DIR} -name '*.ans' -type f -exec chmod 0664 {} \; &>/dev/null find ${MYSTIC_DIR} -name '*.asc' -type f -exec chmod 0664 {} \; &>/dev/null find ${MYSTIC_DIR} -name '*.hlp' -type f -exec chmod 0664 {} \; &>/dev/null find ${MYSTIC_DIR} -name '*.mnu' -type f -exec chmod 0664 {} \; &>/dev/null find ${MYSTIC_DIR} -name '*.mnu' -type f -exec chmod 0664 {} \; &>/dev/null find ${MYSTIC_DIR} -name '*.mps' -type f -exec chmod 0664 {} \; &>/dev/null find ${MYSTIC_DIR} -name '*.mpx' -type f -exec chmod 0664 {} \; &>/dev/null find ${MYSTIC_DIR} -name '*.mpy' -type f -exec chmod 0664 {} \; &>/dev/null find ${MYSTIC_DIR} -name '*.ms' -type f -exec chmod 0664 {} \; &>/dev/null msg_ok "Creating ${APP} und setting Permissions in ${MYSTIC_DIR}" #============================================================================================================== if [ $SPELL = "Yes" ]; then msg_info "Setting up Spellcheck for ${APP}" apt-get 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 unzip ../mystic_spellcheck_v2.zip &>/dev/null cp dictionary.* ${MYSTIC_DIR}/data/ cp wordlist.txt ${MYSTIC_DIR}/data/ cp README.txt ${MYSTIC_DIR}/docs/Spellcheck_README.txt echo "; List secondary dicitinoaries in this File" > ${MYSTIC_DIR}/data/dictlist.txt echo "; more details in the Spellcheck_README.txt" >> ${MYSTIC_DIR}/data/dictlist.txt popd &>/dev/null msg_ok "Setting up Spellcheck for ${APP}" fi #============================================================================================================== if [ $MRC = "Yes" ]; then msg_info "Setting up Multi Relay Chat for ${APP}" apt-get 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 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/ cp mrc_${MRC_VER}/text/* ${MYSTIC_DIR}/themes/default/text/ cp installation.asc ${MYSTIC_DIR}/docs/mrc_installation.asc 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 &>/dev/null bash install.sh $MYSTIC_DIR &>/dev/null popd &>/dev/null msg_ok "Installing Multi Relay Chat Systemd Start/Stop Scripts and Service File" fi #============================================================================================================== if [ $CRYPT = "Yes" ]; then msg_info "Setting up ${APP} cryptlib for ssh/ssl (be patient compiling cryptlib)" apt-get install -y build-essential &>/dev/null apt-get install -y gcc-9 g++-9 cpp-9 gcc g++ cpp &>/dev/null apt-get install -y patch &>/dev/null apt-get 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 unzip ../cryptlib345.zip &>/dev/null dos2unix tools/* &>/dev/null patch -p1 -i /usr/local/src/mystic/mystic/cryptlib/gccversion-345.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 make shared &>/dev/null apt-get purge -y gcc g++ cpp &>/dev/null apt-get install -y gcc g++ cpp &>/dev/null cp libcl.so.3.4.5 ${LIBDIR}/ &>/dev/null ln -sf libcl.so.3.4.5 ${LIBDIR}/libcl.so.3.4 &>/dev/null ln -sf libcl.so.3.4 ${LIBDIR}/libcl.so.3 &>/dev/null ln -sf libcl.so.3 ${LIBDIR}/libcl.so &>/dev/null popd &>/dev/null msg_ok "Setting up ${APP} cryptlib for ssh/ssl (be patient compiling cryptlib)" fi #============================================================================================================== if [ $IP2L = "Yes" ]; then msg_info "Setting up IP2Location Download Client for ${APP}" apt-get 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 unzip ../ip2location-downloader-linux.zip &>/dev/null cp download.pl ${MYSTIC_DIR}/ip2location chmod +x ${MYSTIC_DIR}/ip2location cp readme.txt ${MYSTIC_DIR}/docs/ip2location_README.txt popd &>/dev/null msg_ok "Setting up IP2Location Download Client for ${APP}" 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 unzip ../IniMod_linux_${INIMOD_ARCH}.zip &>/dev/null cp inimod ${MYSTIC_DIR} chmod +x ${MYSTIC_DIR}/inimod cp README.txt ${MYSTIC_DIR}/docs/inimod_README.txt 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 bash install.sh $MYSTIC_DIR &>/dev/null popd &>/dev/null msg_ok "Installing DbP Cron/banip/unbanip Scripts" fi #============================================================================================================== if [ $BANUNBAN = "fail2ban" ]; then msg_info "Installing Fail2Ban Dependencies for ${APP}" apt-get install -y fail2ban &>/dev/null apt-get install -y iptables &>/dev/null apt-get install -y ipset &>/dev/null if [ -z "${FAIL2BAN_GROUP}" ]; then groupadd fail2ban &>/dev/null fi 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 bash install.sh $MYSTIC_DIR &>/dev/null popd &>/dev/null msg_ok "Installing Fail2Ban Scripts for ${APP}" 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 apt-get install -y fail2ban &>/dev/null apt-get install -y iptables &>/dev/null apt-get install -y ipset &>/dev/null apt-get 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 if [ -z "${IPBAN_GROUP}" ]; then groupadd ipban &>/dev/null fi usermod --append --groups ipban mystic &>/dev/null chown -R root:ipban /opt/ipban &>/dev/null chmod 775 /opt/ipban/ &>/dev/null dos2unix /opt/ipban/*.{config,xml,md} &>/dev/null 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 #bash install.sh $MYSTIC_DIR &>/dev/null #popd &>/dev/null #msg_ok "Installing Fail2Ban Scripts for ${APP}" fi #============================================================================================================== if [ $DOSEMU = "Yes" ]; then msg_info "Installing DosEmu2 Dependencies for ${APP}" pushd /usr/local/src/mystic &>/dev/null echo "deb [trusted=yes] https://ppa.launchpadcontent.net/dosemu2/ppa/ubuntu $DIST main" | tee /etc/apt/sources.list.d/dosemu2.list &>/dev/null apt-get update &>/dev/null apt-get install -y dosemu2 &>/dev/null apt-get 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 #unzip ../IniMod_linux${INIMOD_ARCH}.zip &>/dev/null #cp inimod ${MYSTIC_DIR} #chmod +x ${MYSTIC_DIR}/inimod #cp README.txt ${MYSTIC_DIR}/docs/inimod_README.txt #popd &>/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 #bash install.sh $MYSTIC_DIR &>/dev/null #popd &>/dev/null #msg_ok "Installing DbP Cron/banip/unbanip Scripts" fi #============================================================================================================== sed -e 's/\\/\//g' -i ${MYSTIC_DIR}/mutil.ini sed -e "s!c:/mystic!${MYSTIC_DIR}!g" -i ${MYSTIC_DIR}/mutil.ini sed -e "s!d:/mystic!${MYSTIC_DIR}!g" -i ${MYSTIC_DIR}/mutil.ini sed -e "s!d:/nodelist!${MYSTIC_DIR}/files/nodelist!g" -i ${MYSTIC_DIR}/mutil.ini sed -e 's/\\/\//g' -i ${MYSTIC_DIR}/mide.ini sed -e "s!c:/mystic!${MYSTIC_DIR}!g" -i ${MYSTIC_DIR}/mide.ini mkdir -p ${MYSTIC_DIR}/mutil.d cat ${MYSTIC_DIR}/mutil.ini | sed '/\[General\]/q' | sed '$d' > ${MUTIL_DIR}/README.txt cat ${MYSTIC_DIR}/mutil.ini | sed -n '/\[General\]/, /\[/p' | sed '$d' > ${MUTIL_DIR}/General cat ${MYSTIC_DIR}/mutil.ini | sed -n '/\[Import_FIDONET\.NA\]/, /\[/p' | sed '$d' > ${MUTIL_DIR}/Import_FIDONET.NA configarray=('Import_FIDONET.NA') cat ${MYSTIC_DIR}/mutil.ini | sed -n '/\[Import_FILEBONE\.NA\]/, /\[/p' | sed '$d' > ${MUTIL_DIR}/Import_FILEBONE.NA configarray+=('Import_FILEBONE.NA') cat ${MYSTIC_DIR}/mutil.ini | sed -n '/\[Export_FILEBONE\.NA\]/, /\[/p' | sed '$d' > ${MUTIL_DIR}/Export_FILEBONE.NA configarray+=('Export_FILEBONE.NA') cat ${MYSTIC_DIR}/mutil.ini | sed -n '/\[Export_AREAS\.BBS\]/, /\[/p' | sed '$d' > ${MUTIL_DIR}/Export_AREAS.BBS configarray+=('Export_AREAS.BBS') cat ${MYSTIC_DIR}/mutil.ini | sed -n '/\[Export_GOLDED\]/, /\[/p' | sed '$d' > ${MUTIL_DIR}/Export_GOLDED configarray+=('Export_GOLDED') cat ${MYSTIC_DIR}/mutil.ini | sed -n '/\[Import_FILES\.BBS\]/, /\[/p' | sed '$d' > ${MUTIL_DIR}/Import_FILES.BBS configarray+=('Import_FILES.BBS') cat ${MYSTIC_DIR}/mutil.ini | sed -n '/\[MassUpload\]/, /\[/p' | sed '$d' > ${MUTIL_DIR}/MassUpload configarray+=('MassUpload') cat ${MYSTIC_DIR}/mutil.ini | sed -n '/\[GenerateTopLists\]/, /\[/p' | sed '$d' > ${MUTIL_DIR}/GenerateTopLists configarray+=('GenerateTopLists') cat ${MYSTIC_DIR}/mutil.ini | sed -n '/\[GenerateAllFiles\]/, /\[/p' | sed '$d' > ${MUTIL_DIR}/GenerateAllFiles configarray+=('GenerateAllFiles') cat ${MYSTIC_DIR}/mutil.ini | sed -n '/\[PurgeMessageBases\]/, /\[/p' | sed '$d' > ${MUTIL_DIR}/PurgeMessageBases configarray+=('PurgeMessageBases') cat ${MYSTIC_DIR}/mutil.ini | sed -n '/\[PackMessageBases\]/, /\[/p' | sed '$d' > ${MUTIL_DIR}/PackMessageBases configarray+=('PackMessageBases') cat ${MYSTIC_DIR}/mutil.ini | sed -n '/\[PostTextFiles\]/, /\[/p' | sed '$d' > ${MUTIL_DIR}/PostTextFiles configarray+=('PostTextFiles') cat ${MYSTIC_DIR}/mutil.ini | sed -n '/\[Import_MessageBase\]/, /\[/p' | sed '$d' > ${MUTIL_DIR}/Import_MessageBase configarray+=('Import_MessageBase') cat ${MYSTIC_DIR}/mutil.ini | sed -n '/\[ImportEchoMail\]/, /\[/p' | sed '$d' > ${MUTIL_DIR}/ImportEchoMail configarray+=('ImportEchoMail') cat ${MYSTIC_DIR}/mutil.ini | sed -n '/\[ExportEchoMail\]/, /\[/p' | sed '$d' > ${MUTIL_DIR}/ExportEchoMail configarray+=('ExportEchoMail') cat ${MYSTIC_DIR}/mutil.ini | sed -n '/\[MergeNodeLists\]/, /\[/p' | sed '$d' > ${MUTIL_DIR}/MergeNodeLists configarray+=('MergeNodeLists') cat ${MYSTIC_DIR}/mutil.ini | sed -n '/\[FileToss\]/, /\[/p' | sed '$d' > ${MUTIL_DIR}/FileToss configarray+=('FileToss') cat ${MYSTIC_DIR}/mutil.ini | sed -n '/\[PackFileBases\]/, /\[/p' | sed '$d' > ${MUTIL_DIR}/PackFileBases configarray+=('PackFileBases') cat ${MYSTIC_DIR}/mutil.ini | sed -n '/\[LinkMessages\]/, /\[/p' | sed '$d' > ${MUTIL_DIR}/LinkMessages configarray+=('LinkMessages') cat ${MYSTIC_DIR}/mutil.ini | sed -n '/\[PurgeUserBase\]/, /\[/p' | sed '$d' > ${MUTIL_DIR}/PurgeUserBase configarray+=('PurgeUserBase') cat ${MYSTIC_DIR}/mutil.ini | sed -n '/\[PackUserBase\]/, /\[/p' | sed '$d' > ${MUTIL_DIR}/PackUserBase configarray+=('PackUserBase') cat ${MYSTIC_DIR}/mutil.ini | sed -n '/\[FileSort\]/, /\[/p' | sed '$d' > ${MUTIL_DIR}/FileSort configarray+=('FileSort') cat ${MYSTIC_DIR}/mutil.ini | sed -n '/\[AutoHatch\]/, /\[/p' | sed '$d' > ${MUTIL_DIR}/AutoHatch configarray+=('AutoHatch') cat ${MYSTIC_DIR}/mutil.ini | sed -n '/\[EchoNodeTracker\]/, $p' | sed '$d' > ${MUTIL_DIR}/EchoNodeTracker configarray+=('EchoNodeTracker') pushd ${MUTIL_DIR} &>/dev/null #=====================================================================================# configfile="maint.ini" config=('PurgeMessageBases' 'PackMessageBases' 'MergeNodeLists' 'PackFileBases' 'PurgeUserBase' 'PackUserBase' 'FileSort') preparray=("${configarray[@]}") for el in ${config[@]} do preparray=("${preparray[@]/$el}") done cat General ${config[@]} > ${MYSTIC_DIR}/${configfile} for el in ${preparray[@]} do sed -e "/$el/d" -i ${MYSTIC_DIR}/${configfile} done #=====================================================================================# configfile="mailout.ini" config=('ExportEchoMail') preparray=("${configarray[@]}") for el in ${config[@]} do preparray=("${preparray[@]/$el}") done cat General ${config[@]} > ${MYSTIC_DIR}/${configfile} for el in ${preparray[@]} do sed -e "/$el/d" -i ${MYSTIC_DIR}/${configfile} done #=====================================================================================# configfile="mailin.ini" config=('ImportEchoMail' 'FileToss') preparray=("${configarray[@]}") for el in ${config[@]} do preparray=("${preparray[@]/$el}") done cat General ${config[@]} > ${MYSTIC_DIR}/${configfile} for el in ${preparray[@]} do sed -e "/$el/d" -i ${MYSTIC_DIR}/${configfile} done #=====================================================================================# configfile="importna.ini" config=('Import_FIDONET.NA' 'Import_FILEBONE.NA') preparray=("${configarray[@]}") for el in ${config[@]} do preparray=("${preparray[@]/$el}") done cat General ${config[@]} > ${MYSTIC_DIR}/${configfile} for el in ${preparray[@]} do sed -e "/$el/d" -i ${MYSTIC_DIR}/${configfile} done #=====================================================================================# chown mystic:mystic -R ${MYSTIC_DIR} &>/dev/null popd &>/dev/null msg_ok "Completed Successfully!\n"