Expand cleanup_lxc to support more distros

The cleanup_lxc function now supports package manager cleanup for Fedora, Rocky, AlmaLinux, CentOS (dnf/yum), openSUSE (zypper), and Gentoo (emerge), in addition to Alpine and Debian/Ubuntu. All package manager and language tool cleanup commands now suppress error output for robustness. JSON files were reformatted for consistent indentation.
This commit is contained in:
CanbiZ 2025-12-04 14:55:00 +01:00
parent 3971eb49c7
commit 8aecfce5a3
12 changed files with 411 additions and 371 deletions

View File

@ -1,33 +1,35 @@
{
"name": "AlmaLinux",
"slug": "almalinux",
"categories": [0],
"date_created": "2025-12-04",
"type": "ct",
"updateable": true,
"privileged": false,
"interface_port": null,
"documentation": "https://wiki.almalinux.org/",
"website": "https://almalinux.org/",
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/webp/almalinux.webp",
"config_path": "",
"description": "AlmaLinux is an open-source, community-driven Linux distribution, 1:1 binary compatible with RHEL. A free alternative to CentOS.",
"install_methods": [
{
"type": "default",
"script": "ct/almalinux.sh",
"resources": {
"cpu": 1,
"ram": 512,
"hdd": 4,
"os": "almalinux",
"version": "10"
}
}
],
"default_credentials": {
"username": "root",
"password": null
},
"notes": []
"name": "AlmaLinux",
"slug": "almalinux",
"categories": [
0
],
"date_created": "2025-12-04",
"type": "ct",
"updateable": true,
"privileged": false,
"interface_port": null,
"documentation": "https://wiki.almalinux.org/",
"website": "https://almalinux.org/",
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/webp/almalinux.webp",
"config_path": "",
"description": "AlmaLinux is an open-source, community-driven Linux distribution, 1:1 binary compatible with RHEL. A free alternative to CentOS.",
"install_methods": [
{
"type": "default",
"script": "ct/almalinux.sh",
"resources": {
"cpu": 1,
"ram": 512,
"hdd": 4,
"os": "almalinux",
"version": "10"
}
}
],
"default_credentials": {
"username": "root",
"password": null
},
"notes": []
}

View File

@ -1,33 +1,35 @@
{
"name": "Alpine Linux",
"slug": "alpine",
"categories": [0],
"date_created": "2025-12-04",
"type": "ct",
"updateable": true,
"privileged": false,
"interface_port": null,
"documentation": "https://wiki.alpinelinux.org/",
"website": "https://alpinelinux.org/",
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/webp/alpine-linux.webp",
"config_path": "",
"description": "Alpine Linux is a security-oriented, lightweight Linux distribution based on musl libc and busybox. Perfect for containers due to its minimal footprint.",
"install_methods": [
{
"type": "default",
"script": "ct/alpine.sh",
"resources": {
"cpu": 1,
"ram": 512,
"hdd": 1,
"os": "alpine",
"version": "3.22"
}
}
],
"default_credentials": {
"username": "root",
"password": null
},
"notes": []
"name": "Alpine Linux",
"slug": "alpine",
"categories": [
0
],
"date_created": "2025-12-04",
"type": "ct",
"updateable": true,
"privileged": false,
"interface_port": null,
"documentation": "https://wiki.alpinelinux.org/",
"website": "https://alpinelinux.org/",
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/webp/alpine-linux.webp",
"config_path": "",
"description": "Alpine Linux is a security-oriented, lightweight Linux distribution based on musl libc and busybox. Perfect for containers due to its minimal footprint.",
"install_methods": [
{
"type": "default",
"script": "ct/alpine.sh",
"resources": {
"cpu": 1,
"ram": 512,
"hdd": 1,
"os": "alpine",
"version": "3.22"
}
}
],
"default_credentials": {
"username": "root",
"password": null
},
"notes": []
}

View File

@ -1,38 +1,40 @@
{
"name": "CentOS Stream",
"slug": "centos",
"categories": [0],
"date_created": "2025-12-04",
"type": "ct",
"updateable": true,
"privileged": false,
"interface_port": null,
"documentation": "https://docs.centos.org/",
"website": "https://www.centos.org/centos-stream/",
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/webp/centos.webp",
"config_path": "",
"description": "CentOS Stream is a continuously delivered Linux distribution that tracks just ahead of RHEL development. The upstream for the next RHEL release.",
"install_methods": [
{
"type": "default",
"script": "ct/centos.sh",
"resources": {
"cpu": 1,
"ram": 512,
"hdd": 4,
"os": "centos",
"version": "9"
}
}
],
"default_credentials": {
"username": "root",
"password": null
},
"notes": [
{
"text": "CentOS Stream is the upstream development platform for RHEL.",
"type": "info"
}
]
"name": "CentOS Stream",
"slug": "centos",
"categories": [
0
],
"date_created": "2025-12-04",
"type": "ct",
"updateable": true,
"privileged": false,
"interface_port": null,
"documentation": "https://docs.centos.org/",
"website": "https://www.centos.org/centos-stream/",
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/webp/centos.webp",
"config_path": "",
"description": "CentOS Stream is a continuously delivered Linux distribution that tracks just ahead of RHEL development. The upstream for the next RHEL release.",
"install_methods": [
{
"type": "default",
"script": "ct/centos.sh",
"resources": {
"cpu": 1,
"ram": 512,
"hdd": 4,
"os": "centos",
"version": "9"
}
}
],
"default_credentials": {
"username": "root",
"password": null
},
"notes": [
{
"text": "CentOS Stream is the upstream development platform for RHEL.",
"type": "info"
}
]
}

View File

@ -1,33 +1,35 @@
{
"name": "Debian",
"slug": "debian",
"categories": [0],
"date_created": "2025-12-04",
"type": "ct",
"updateable": true,
"privileged": false,
"interface_port": null,
"documentation": "https://www.debian.org/doc/",
"website": "https://www.debian.org/",
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/webp/debian.webp",
"config_path": "",
"description": "Debian is a free operating system (OS) that comes with over 59000 packages. It's known for its stability, security, and extensive software repository.",
"install_methods": [
{
"type": "default",
"script": "ct/debian.sh",
"resources": {
"cpu": 1,
"ram": 512,
"hdd": 4,
"os": "debian",
"version": "13"
}
}
],
"default_credentials": {
"username": "root",
"password": null
},
"notes": []
"name": "Debian",
"slug": "debian",
"categories": [
0
],
"date_created": "2025-12-04",
"type": "ct",
"updateable": true,
"privileged": false,
"interface_port": null,
"documentation": "https://www.debian.org/doc/",
"website": "https://www.debian.org/",
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/webp/debian.webp",
"config_path": "",
"description": "Debian is a free operating system (OS) that comes with over 59000 packages. It's known for its stability, security, and extensive software repository.",
"install_methods": [
{
"type": "default",
"script": "ct/debian.sh",
"resources": {
"cpu": 1,
"ram": 512,
"hdd": 4,
"os": "debian",
"version": "13"
}
}
],
"default_credentials": {
"username": "root",
"password": null
},
"notes": []
}

View File

@ -1,38 +1,40 @@
{
"name": "Devuan",
"slug": "devuan",
"categories": [0],
"date_created": "2025-12-04",
"type": "ct",
"updateable": true,
"privileged": false,
"interface_port": null,
"documentation": "https://www.devuan.org/os/documentation",
"website": "https://www.devuan.org/",
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/webp/devuan.webp",
"config_path": "",
"description": "Devuan is a fork of Debian without systemd. It uses sysvinit and other alternative init systems, providing freedom of choice.",
"install_methods": [
{
"type": "default",
"script": "ct/devuan.sh",
"resources": {
"cpu": 1,
"ram": 512,
"hdd": 4,
"os": "devuan",
"version": "5.0"
}
}
],
"default_credentials": {
"username": "root",
"password": null
},
"notes": [
{
"text": "Devuan uses sysvinit instead of systemd.",
"type": "info"
}
]
"name": "Devuan",
"slug": "devuan",
"categories": [
0
],
"date_created": "2025-12-04",
"type": "ct",
"updateable": true,
"privileged": false,
"interface_port": null,
"documentation": "https://www.devuan.org/os/documentation",
"website": "https://www.devuan.org/",
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/webp/devuan.webp",
"config_path": "",
"description": "Devuan is a fork of Debian without systemd. It uses sysvinit and other alternative init systems, providing freedom of choice.",
"install_methods": [
{
"type": "default",
"script": "ct/devuan.sh",
"resources": {
"cpu": 1,
"ram": 512,
"hdd": 4,
"os": "devuan",
"version": "5.0"
}
}
],
"default_credentials": {
"username": "root",
"password": null
},
"notes": [
{
"text": "Devuan uses sysvinit instead of systemd.",
"type": "info"
}
]
}

View File

@ -1,33 +1,35 @@
{
"name": "Fedora",
"slug": "fedora",
"categories": [0],
"date_created": "2025-12-04",
"type": "ct",
"updateable": true,
"privileged": false,
"interface_port": null,
"documentation": "https://docs.fedoraproject.org/",
"website": "https://fedoraproject.org/",
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/webp/fedora.webp",
"config_path": "",
"description": "Fedora is a cutting-edge Linux distribution sponsored by Red Hat. It features the latest software and technologies while maintaining stability.",
"install_methods": [
{
"type": "default",
"script": "ct/fedora.sh",
"resources": {
"cpu": 1,
"ram": 512,
"hdd": 4,
"os": "fedora",
"version": "42"
}
}
],
"default_credentials": {
"username": "root",
"password": null
},
"notes": []
"name": "Fedora",
"slug": "fedora",
"categories": [
0
],
"date_created": "2025-12-04",
"type": "ct",
"updateable": true,
"privileged": false,
"interface_port": null,
"documentation": "https://docs.fedoraproject.org/",
"website": "https://fedoraproject.org/",
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/webp/fedora.webp",
"config_path": "",
"description": "Fedora is a cutting-edge Linux distribution sponsored by Red Hat. It features the latest software and technologies while maintaining stability.",
"install_methods": [
{
"type": "default",
"script": "ct/fedora.sh",
"resources": {
"cpu": 1,
"ram": 512,
"hdd": 4,
"os": "fedora",
"version": "42"
}
}
],
"default_credentials": {
"username": "root",
"password": null
},
"notes": []
}

View File

@ -1,38 +1,40 @@
{
"name": "Gentoo",
"slug": "gentoo",
"categories": [0],
"date_created": "2025-12-04",
"type": "ct",
"updateable": true,
"privileged": false,
"interface_port": null,
"documentation": "https://wiki.gentoo.org/",
"website": "https://www.gentoo.org/",
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/webp/gentoo.webp",
"config_path": "",
"description": "Gentoo is a highly customizable source-based Linux distribution. Users compile software optimized for their specific hardware.",
"install_methods": [
{
"type": "default",
"script": "ct/gentoo.sh",
"resources": {
"cpu": 2,
"ram": 1024,
"hdd": 8,
"os": "gentoo",
"version": "current"
}
}
],
"default_credentials": {
"username": "root",
"password": null
},
"notes": [
{
"text": "Gentoo compiles packages from source. Initial setup may take time.",
"type": "warning"
}
]
"name": "Gentoo",
"slug": "gentoo",
"categories": [
0
],
"date_created": "2025-12-04",
"type": "ct",
"updateable": true,
"privileged": false,
"interface_port": null,
"documentation": "https://wiki.gentoo.org/",
"website": "https://www.gentoo.org/",
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/webp/gentoo.webp",
"config_path": "",
"description": "Gentoo is a highly customizable source-based Linux distribution. Users compile software optimized for their specific hardware.",
"install_methods": [
{
"type": "default",
"script": "ct/gentoo.sh",
"resources": {
"cpu": 2,
"ram": 1024,
"hdd": 8,
"os": "gentoo",
"version": "current"
}
}
],
"default_credentials": {
"username": "root",
"password": null
},
"notes": [
{
"text": "Gentoo compiles packages from source. Initial setup may take time.",
"type": "warning"
}
]
}

View File

@ -1,33 +1,35 @@
{
"name": "openEuler",
"slug": "openeuler",
"categories": [0],
"date_created": "2025-12-04",
"type": "ct",
"updateable": true,
"privileged": false,
"interface_port": null,
"documentation": "https://docs.openeuler.org/",
"website": "https://www.openeuler.org/",
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/webp/openeuler.webp",
"config_path": "",
"description": "openEuler is an open-source Linux distribution from Huawei. It's designed for servers and cloud computing with enterprise-grade features.",
"install_methods": [
{
"type": "default",
"script": "ct/openeuler.sh",
"resources": {
"cpu": 1,
"ram": 512,
"hdd": 4,
"os": "openeuler",
"version": "25.03"
}
}
],
"default_credentials": {
"username": "root",
"password": null
},
"notes": []
"name": "openEuler",
"slug": "openeuler",
"categories": [
0
],
"date_created": "2025-12-04",
"type": "ct",
"updateable": true,
"privileged": false,
"interface_port": null,
"documentation": "https://docs.openeuler.org/",
"website": "https://www.openeuler.org/",
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/webp/openeuler.webp",
"config_path": "",
"description": "openEuler is an open-source Linux distribution from Huawei. It's designed for servers and cloud computing with enterprise-grade features.",
"install_methods": [
{
"type": "default",
"script": "ct/openeuler.sh",
"resources": {
"cpu": 1,
"ram": 512,
"hdd": 4,
"os": "openeuler",
"version": "25.03"
}
}
],
"default_credentials": {
"username": "root",
"password": null
},
"notes": []
}

View File

@ -1,33 +1,35 @@
{
"name": "openSUSE",
"slug": "opensuse",
"categories": [0],
"date_created": "2025-12-04",
"type": "ct",
"updateable": true,
"privileged": false,
"interface_port": null,
"documentation": "https://doc.opensuse.org/",
"website": "https://www.opensuse.org/",
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/webp/opensuse.webp",
"config_path": "",
"description": "openSUSE is a stable, easy-to-use, and complete Linux distribution. Known for its YaST configuration tool and zypper package manager.",
"install_methods": [
{
"type": "default",
"script": "ct/opensuse.sh",
"resources": {
"cpu": 1,
"ram": 512,
"hdd": 4,
"os": "opensuse",
"version": "15.6"
}
}
],
"default_credentials": {
"username": "root",
"password": null
},
"notes": []
"name": "openSUSE",
"slug": "opensuse",
"categories": [
0
],
"date_created": "2025-12-04",
"type": "ct",
"updateable": true,
"privileged": false,
"interface_port": null,
"documentation": "https://doc.opensuse.org/",
"website": "https://www.opensuse.org/",
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/webp/opensuse.webp",
"config_path": "",
"description": "openSUSE is a stable, easy-to-use, and complete Linux distribution. Known for its YaST configuration tool and zypper package manager.",
"install_methods": [
{
"type": "default",
"script": "ct/opensuse.sh",
"resources": {
"cpu": 1,
"ram": 512,
"hdd": 4,
"os": "opensuse",
"version": "15.6"
}
}
],
"default_credentials": {
"username": "root",
"password": null
},
"notes": []
}

View File

@ -1,33 +1,35 @@
{
"name": "Rocky Linux",
"slug": "rockylinux",
"categories": [0],
"date_created": "2025-12-04",
"type": "ct",
"updateable": true,
"privileged": false,
"interface_port": null,
"documentation": "https://docs.rockylinux.org/",
"website": "https://rockylinux.org/",
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/webp/rocky-linux.webp",
"config_path": "",
"description": "Rocky Linux is an enterprise-grade Linux distribution designed to be 100% bug-for-bug compatible with Red Hat Enterprise Linux (RHEL).",
"install_methods": [
{
"type": "default",
"script": "ct/rockylinux.sh",
"resources": {
"cpu": 1,
"ram": 512,
"hdd": 4,
"os": "rockylinux",
"version": "10"
}
}
],
"default_credentials": {
"username": "root",
"password": null
},
"notes": []
"name": "Rocky Linux",
"slug": "rockylinux",
"categories": [
0
],
"date_created": "2025-12-04",
"type": "ct",
"updateable": true,
"privileged": false,
"interface_port": null,
"documentation": "https://docs.rockylinux.org/",
"website": "https://rockylinux.org/",
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/webp/rocky-linux.webp",
"config_path": "",
"description": "Rocky Linux is an enterprise-grade Linux distribution designed to be 100% bug-for-bug compatible with Red Hat Enterprise Linux (RHEL).",
"install_methods": [
{
"type": "default",
"script": "ct/rockylinux.sh",
"resources": {
"cpu": 1,
"ram": 512,
"hdd": 4,
"os": "rockylinux",
"version": "10"
}
}
],
"default_credentials": {
"username": "root",
"password": null
},
"notes": []
}

View File

@ -1,33 +1,35 @@
{
"name": "Ubuntu",
"slug": "ubuntu",
"categories": [0],
"date_created": "2025-12-04",
"type": "ct",
"updateable": true,
"privileged": false,
"interface_port": null,
"documentation": "https://help.ubuntu.com/",
"website": "https://ubuntu.com/",
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/webp/ubuntu.webp",
"config_path": "",
"description": "Ubuntu is a popular Linux distribution based on Debian. Known for its ease of use and regular release cycle with LTS versions.",
"install_methods": [
{
"type": "default",
"script": "ct/ubuntu.sh",
"resources": {
"cpu": 1,
"ram": 512,
"hdd": 4,
"os": "ubuntu",
"version": "24.04"
}
}
],
"default_credentials": {
"username": "root",
"password": null
},
"notes": []
"name": "Ubuntu",
"slug": "ubuntu",
"categories": [
0
],
"date_created": "2025-12-04",
"type": "ct",
"updateable": true,
"privileged": false,
"interface_port": null,
"documentation": "https://help.ubuntu.com/",
"website": "https://ubuntu.com/",
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/webp/ubuntu.webp",
"config_path": "",
"description": "Ubuntu is a popular Linux distribution based on Debian. Known for its ease of use and regular release cycle with LTS versions.",
"install_methods": [
{
"type": "default",
"script": "ct/ubuntu.sh",
"resources": {
"cpu": 1,
"ram": 512,
"hdd": 4,
"os": "ubuntu",
"version": "24.04"
}
}
],
"default_credentials": {
"username": "root",
"password": null
},
"notes": []
}

View File

@ -686,7 +686,7 @@ get_header() {
local app_type=${APP_TYPE:-ct} # Default zu 'ct' falls nicht gesetzt
local header_url="https://git.community-scripts.org/community-scripts/ProxmoxVED/raw/branch/main/${app_type}/headers/${app_name}"
local local_header_path="/usr/local/community-scripts/headers/${app_type}/${app_name}"
mkdir -p "$(dirname "$local_header_path")"
if [ ! -s "$local_header_path" ]; then
@ -787,7 +787,8 @@ is_verbose_mode() {
# cleanup_lxc()
#
# - Comprehensive cleanup of package managers, caches, and logs
# - Supports Alpine (apk), Debian/Ubuntu (apt), and language package managers
# - Supports Alpine (apk), Debian/Ubuntu (apt), Fedora/Rocky/CentOS (dnf/yum),
# openSUSE (zypper), Gentoo (emerge), and language package managers
# - Cleans: Python (pip/uv), Node.js (npm/yarn/pnpm), Go, Rust, Ruby, PHP
# - Truncates log files and vacuums systemd journal
# - Run at end of container creation to minimize disk usage
@ -795,13 +796,30 @@ is_verbose_mode() {
cleanup_lxc() {
msg_info "Cleaning up"
# OS-specific package manager cleanup
if is_alpine; then
$STD apk cache clean || true
$STD apk cache clean 2>/dev/null || true
rm -rf /var/cache/apk/*
else
$STD apt -y autoremove || true
$STD apt -y autoclean || true
$STD apt -y clean || true
elif command -v apt &>/dev/null; then
# Debian/Ubuntu/Devuan
$STD apt -y autoremove 2>/dev/null || true
$STD apt -y autoclean 2>/dev/null || true
$STD apt -y clean 2>/dev/null || true
elif command -v dnf &>/dev/null; then
# Fedora/Rocky/AlmaLinux/CentOS 8+
$STD dnf clean all 2>/dev/null || true
$STD dnf autoremove -y 2>/dev/null || true
elif command -v yum &>/dev/null; then
# CentOS 7/older RHEL
$STD yum clean all 2>/dev/null || true
elif command -v zypper &>/dev/null; then
# openSUSE
$STD zypper clean --all 2>/dev/null || true
elif command -v emerge &>/dev/null; then
# Gentoo
$STD emerge --quiet --depclean 2>/dev/null || true
$STD eclean-dist -d 2>/dev/null || true
$STD eclean-pkg -d 2>/dev/null || true
fi
# Clear temp artifacts (keep sockets/FIFOs; ignore errors)
@ -815,22 +833,22 @@ cleanup_lxc() {
fi
# Node.js npm
if command -v npm &>/dev/null; then $STD npm cache clean --force || true; fi
if command -v npm &>/dev/null; then $STD npm cache clean --force 2>/dev/null || true; fi
# Node.js yarn
if command -v yarn &>/dev/null; then $STD yarn cache clean || true; fi
if command -v yarn &>/dev/null; then $STD yarn cache clean 2>/dev/null || true; fi
# Node.js pnpm
if command -v pnpm &>/dev/null; then $STD pnpm store prune || true; fi
if command -v pnpm &>/dev/null; then $STD pnpm store prune 2>/dev/null || true; fi
# Go
if command -v go &>/dev/null; then $STD go clean -cache -modcache || true; fi
if command -v go &>/dev/null; then $STD go clean -cache -modcache 2>/dev/null || true; fi
# Rust cargo
if command -v cargo &>/dev/null; then $STD cargo clean || true; fi
if command -v cargo &>/dev/null; then $STD cargo clean 2>/dev/null || true; fi
# Ruby gem
if command -v gem &>/dev/null; then $STD gem cleanup || true; fi
if command -v gem &>/dev/null; then $STD gem cleanup 2>/dev/null || true; fi
# 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 2>/dev/null || true; fi
if command -v journalctl &>/dev/null; then
$STD journalctl --vacuum-time=10m || true
$STD journalctl --vacuum-time=10m 2>/dev/null || true
fi
msg_ok "Cleaned"
}