add logging

This commit is contained in:
Mario Fetka 2024-07-06 15:06:52 +02:00
parent 17199a5a30
commit b83d80ef90

View File

@ -12,6 +12,7 @@ CM="${GN}✓${CL}"
APP="Mystic BBS" APP="Mystic BBS"
MSDIR="/opt/mystic" MSDIR="/opt/mystic"
MSTEMPDIR="/usr/local/src/mystic" MSTEMPDIR="/usr/local/src/mystic"
INSTALLLOG=$MSTEMPDIR/install.log
TMP_DIR=$(mktemp -d) TMP_DIR=$(mktemp -d)
SCRIPT_VER="v7" SCRIPT_VER="v7"
@ -39,6 +40,13 @@ function error_exit() {
exit $EXIT exit $EXIT
} }
function cmd_exec() {
{
printf "$(date '+%Y-%m-%d %H:%M:%S') %s\n" "$*"
"$@"
} >> $INSTALLLOG
}
if command -v pveversion >/dev/null 2>&1; then echo -e "⚠️ Can't Install on Proxmox "; exit; fi if command -v pveversion >/dev/null 2>&1; then echo -e "⚠️ Can't Install on Proxmox "; exit; fi
while true; do while true; do
read -p "This will Install ${APP} on $hostname. Proceed(y/n)?" yn read -p "This will Install ${APP} on $hostname. Proceed(y/n)?" yn
@ -60,9 +68,11 @@ function msg_ok() {
echo -e "${BFR} ${CM} ${GN}${msg}${CL}" echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
} }
mkdir -p $MSTEMPDIR &>/dev/null
msg_info "Installing needed base packages" msg_info "Installing needed base packages"
apt update &>/dev/null cmd_exec apt update &>$INSTALLLOG
apt install lsb-release dpkg-dev wget curl figlet lolcat unzip whiptail dialog -y &>/dev/null cmd_exec apt install lsb-release dpkg-dev wget curl figlet lolcat unzip whiptail dialog -y &>$INSTALLLOG
msg_ok "Installing needed base packages" msg_ok "Installing needed base packages"
function header_info { function header_info {