put prompt/install/config into own files

This commit is contained in:
Mario Fetka 2024-04-20 10:06:48 +02:00
parent f5dba27ec6
commit dc5525d2c1

View File

@ -13,8 +13,55 @@ APP="Mystic Installer"
MSDIR="/opt/mystic"
MSTEMPDIR="/usr/local/src/mystic"
TMP_DIR=$(mktemp -d)
SCRIPT_VER="v1"
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 {
/usr/bin/env figlet -w 60 -c "Mystic BBS DbP Installer" | /usr/games/lolcat -f
}
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 "Installing needed base packages"
apt install lsb-release dpkg-dev wget curl figlet lolcat unzip -y &>/dev/null
msg_ok "Installing needed base packages"
ARCH=$(dpkg-architecture -qDEB_HOST_MULTIARCH)
@ -29,7 +76,6 @@ IPBAN_GROUP=$(getent group ipban)
LIBDIR=/usr/lib/${ARCH}
MYSTIC_VER="112a48"
SCRIPT_VER="v1"
MRC_VER="129a"
MRC_SERVER_VER="129a"
@ -79,50 +125,6 @@ wget https://deb.freexian.com/extended-lts/archive-key.gpg -O /etc/apt/trusted.g
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
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 {
/usr/bin/env figlet -w 60 -c "Mystic BBS DbP Installer" | /usr/games/lolcat -f
}
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 update &>/dev/null
apt install -y software-properties-common &>/dev/null