untangle the mess

This commit is contained in:
Michel Roegl-Brunner 2025-04-11 09:29:59 +02:00
parent 8bc31939c8
commit 20c9572c90
3 changed files with 20 additions and 18 deletions

View File

@ -1204,7 +1204,9 @@ build_container() {
if [ "$var_os" == "alpine" ]; then if [ "$var_os" == "alpine" ]; then
export FUNCTIONS_FILE_PATH="$(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/alpine-install.func)" export FUNCTIONS_FILE_PATH="$(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/alpine-install.func)"
else else
export FUNCTIONS_FILE_PATH="$(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/install.func)" FUNCTIONS_FILE_PATH="$(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/core.func)"
FUNCTIONS_FILE_PATH+="$(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/install.func)"
export FUNCTIONS_FILE_PATH
fi fi
export RANDOM_UUID="$RANDOM_UUID" export RANDOM_UUID="$RANDOM_UUID"
export CACHER="$APT_CACHER" export CACHER="$APT_CACHER"

View File

@ -92,6 +92,21 @@ spinner_guard() {
fi fi
} }
log_message() {
local level="$1"
local message="$2"
local timestamp
local logdate
timestamp=$(date '+%Y-%m-%d %H:%M:%S')
logdate=$(date '+%Y-%m-%d')
LOGDIR="/usr/local/community-scripts/logs"
mkdir -p "$LOGDIR"
LOGFILE="${LOGDIR}/${logdate}_${NSAPP}.log"
echo "$timestamp - $level: $message" >>"$LOGFILE"
}
msg_info() { msg_info() {
local msg="$1" local msg="$1"
if [ "${SPINNER_ACTIVE:-0}" -eq 1 ]; then if [ "${SPINNER_ACTIVE:-0}" -eq 1 ]; then
@ -128,6 +143,7 @@ msg_error() {
SPINNER_ACTIVE=0 SPINNER_ACTIVE=0
log_message "ERROR" "$msg" log_message "ERROR" "$msg"
} }
shell_check() { shell_check() {
if [[ "$(basename "$SHELL")" != "bash" ]]; then if [[ "$(basename "$SHELL")" != "bash" ]]; then
clear clear
@ -137,6 +153,7 @@ shell_check() {
exit exit
fi fi
} }
root_check() { root_check() {
if [[ "$(id -u)" -ne 0 || $(ps -o comm= -p $PPID) == "sudo" ]]; then if [[ "$(id -u)" -ne 0 || $(ps -o comm= -p $PPID) == "sudo" ]]; then
clear clear
@ -180,21 +197,6 @@ ssh_check() {
fi fi
} }
log_message() {
local level="$1"
local message="$2"
local timestamp
local logdate
timestamp=$(date '+%Y-%m-%d %H:%M:%S')
logdate=$(date '+%Y-%m-%d')
LOGDIR="/usr/local/community-scripts/logs"
mkdir -p "$LOGDIR"
LOGFILE="${LOGDIR}/${logdate}_${NSAPP}.log"
echo "$timestamp - $level: $message" >>"$LOGFILE"
}
exit-script() { exit-script() {
clear clear
echo -e "\n${CROSS}${RD}User exited script${CL}\n" echo -e "\n${CROSS}${RD}User exited script${CL}\n"

View File

@ -6,8 +6,6 @@
# License: MIT # License: MIT
# https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE # https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE
source <(wget -qO - https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/core.func)
verb_ip6() { verb_ip6() {
set_std_mode # Set STD mode based on VERBOSE set_std_mode # Set STD mode based on VERBOSE