fixing outputs

This commit is contained in:
CanbiZ 2025-11-11 11:16:03 +01:00
parent fbb451374d
commit 59d684731d
2 changed files with 20 additions and 16 deletions

View File

@ -422,6 +422,7 @@ function msg_debug() {
cleanup_lxc() { cleanup_lxc() {
msg_info "Cleaning up" msg_info "Cleaning up"
if is_alpine; then if is_alpine; then
$STD apk cache clean || true $STD apk cache clean || true
rm -rf /var/cache/apk/* rm -rf /var/cache/apk/*
@ -431,36 +432,38 @@ cleanup_lxc() {
$STD apt -y clean || true $STD apt -y clean || true
fi fi
rm -rf /tmp/* /var/tmp/* # Clear temp artifacts (keep sockets/FIFOs; ignore errors)
# Remove temp files created by mktemp/tempfile
find /tmp /var/tmp -type f -name 'tmp*' -delete 2>/dev/null || true find /tmp /var/tmp -type f -name 'tmp*' -delete 2>/dev/null || true
find /tmp /var/tmp -type f -name 'tempfile*' -delete 2>/dev/null || true find /tmp /var/tmp -type f -name 'tempfile*' -delete 2>/dev/null || true
find /var/log -type f -exec truncate -s 0 {} + # Truncate writable log files silently (permission errors ignored)
if command -v truncate >/dev/null 2>&1; then
find /var/log -type f -writable -print0 2>/dev/null |
xargs -0 -n1 truncate -s 0 2>/dev/null || true
fi
# Python pip # Python pip
if command -v pip &>/dev/null; then pip cache purge || true; fi if command -v pip &>/dev/null; then $STD pip cache purge || true; fi
# Python uv # Python uv
if command -v uv &>/dev/null; then uv cache clear || true; fi if command -v uv &>/dev/null; then $STD uv cache clear || true; fi
# Node.js npm # Node.js npm
if command -v npm &>/dev/null; then npm cache clean --force || true; fi if command -v npm &>/dev/null; then $STD npm cache clean --force || true; fi
# Node.js yarn # Node.js yarn
if command -v yarn &>/dev/null; then yarn cache clean || true; fi if command -v yarn &>/dev/null; then $STD yarn cache clean || true; fi
# Node.js pnpm # Node.js pnpm
if command -v pnpm &>/dev/null; then pnpm store prune || true; fi if command -v pnpm &>/dev/null; then $STD pnpm store prune || true; fi
# Go # Go
if command -v go &>/dev/null; then go clean -cache -modcache || true; fi if command -v go &>/dev/null; then $STD go clean -cache -modcache || true; fi
# Rust cargo # Rust cargo
if command -v cargo &>/dev/null; then cargo clean || true; fi if command -v cargo &>/dev/null; then $STD cargo clean || true; fi
# Ruby gem # Ruby gem
if command -v gem &>/dev/null; then gem cleanup || true; fi if command -v gem &>/dev/null; then $STD gem cleanup || true; fi
# Composer (PHP) # Composer (PHP)
if command -v composer &>/dev/null; then $STD composer clear-cache || true; fi if command -v composer &>/dev/null; then $STD composer clear-cache || true; fi
if command -v journalctl &>/dev/null; then if command -v journalctl &>/dev/null; then
$STD journalctl --rotate $STD journalctl --rotate || true
$STD journalctl --vacuum-time=10m $STD journalctl --vacuum-time=10m || true
fi fi
msg_ok "Cleaned" msg_ok "Cleaned"
} }

View File

@ -2779,8 +2779,9 @@ function setup_java() {
fi fi
# Validate INSTALLED_VERSION is not empty if matched # Validate INSTALLED_VERSION is not empty if matched
local JDK_COUNT=$(dpkg -l 2>/dev/null | grep -c "temurin-.*-jdk" || echo "0") local JDK_COUNT=0
if [[ -z "$INSTALLED_VERSION" && "$JDK_COUNT" -gt 0 ]]; then JDK_COUNT=$(dpkg -l 2>/dev/null | grep -c "temurin-.*-jdk" || echo "0")
if [[ -z "$INSTALLED_VERSION" && "${JDK_COUNT:-0}" -gt 0 ]]; then
msg_warn "Found Temurin JDK but cannot determine version" msg_warn "Found Temurin JDK but cannot determine version"
INSTALLED_VERSION="0" INSTALLED_VERSION="0"
fi fi