From b83d80ef907c4d70cf3559d4bcf5b2a0ebb8334c Mon Sep 17 00:00:00 2001 From: Mario Fetka Date: Sat, 6 Jul 2024 15:06:52 +0200 Subject: [PATCH] add logging --- install-next.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/install-next.sh b/install-next.sh index 2037bb4..d50e0d8 100644 --- a/install-next.sh +++ b/install-next.sh @@ -12,6 +12,7 @@ CM="${GN}✓${CL}" APP="Mystic BBS" MSDIR="/opt/mystic" MSTEMPDIR="/usr/local/src/mystic" +INSTALLLOG=$MSTEMPDIR/install.log TMP_DIR=$(mktemp -d) SCRIPT_VER="v7" @@ -39,6 +40,13 @@ function error_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 while true; do 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}" } +mkdir -p $MSTEMPDIR &>/dev/null + msg_info "Installing needed base packages" -apt update &>/dev/null -apt install lsb-release dpkg-dev wget curl figlet lolcat unzip whiptail dialog -y &>/dev/null +cmd_exec apt update &>$INSTALLLOG +cmd_exec apt install lsb-release dpkg-dev wget curl figlet lolcat unzip whiptail dialog -y &>$INSTALLLOG msg_ok "Installing needed base packages" function header_info {