Compare commits

..
Author SHA1 Message Date
MickLesk 81e1c81247 ArchiveBox: keep the reclaim quiet
memory.reclaim reports EAGAIN when it frees less than asked, which put an
I/O error into the journal on every start.
2026-11-20 17:15:27 +01:00
MickLesk 18dbb1c25c ArchiveBox: free the page cache before the memory checks
0.9.77 takes memory.max - memory.current as free memory, and memory.current
includes the page cache, so in an Incus container archivebox install saw
30 MiB free of 1 GB right after the package installs and refused to start;
archivebox server does the same check. Reclaiming through the cgroup's
memory.reclaim before both lets them run. Upstream fixed it on dev
(ArchiveBox#1966), not yet released.
2026-11-20 16:52:05 +01:00
MickLesk 33991d0819 ArchiveBox: stay on port 8000
Updates keep the port a container already has, so 0.7 installs stayed on
8000 while new installs moved to 5797. One port for both keeps the URL the
website and the script print right for every container.
2026-11-20 16:51:53 +01:00
MickLesk 48687c5b2f Merge main into fix/archivebox-0.9 2026-11-20 16:50:12 +01:00
MickLesk 8c9a017c63 ArchiveBox: keep the 1 GB default
Raising it to 2 GB made every existing container count as under-provisioned on update, and an unattended update stops there.
2026-11-16 14:00:54 +01:00
MickLesk 575e7921d2 Merge main into fix/archivebox-0.9
ArchiveBox runs as root and drops to its own account, so the service user, sudo and the BASE_URL guesswork go. The 0.9 update is pinned through check_for_gh_release, migrated containers drop the old system package, the Playwright cache and the NodeSource Node.js whose npm refused mercury's git dependency.
2026-11-16 13:34:25 +01:00
MickLesk dd38ed34e0 Let ArchiveBox 0.9 actually crawl, and serve its snapshots
Every extractor binary 0.9 cannot find aborts the crawl runner, and abx-plugins
keeps adding new ones, so a fixed apt list always falls behind while the service
user cannot run apt. archivebox install now runs as root with the service user's
home, the way upstream's own package does, and resolves every system dependency
itself; mercury stays disabled because npm refuses its git dependency. Snapshot
iframes are built from BASE_URL, so the update sets it when missing or when it is
a stale IP, and migrated 0.7 collections get their snapshots re-indexed.
2026-09-28 09:25:34 +02:00
MickLesk 049f2dd151 Name the admin account the way the docs do
createsuperuser was given admin, but the documented default user is archivebox -
which is what 0.7.4 produced, because its expect block sent an empty username and
Django then fell back to the OS user the command ran as.
2026-09-25 18:12:51 +02:00
MickLesk 57c299d068 Treat extractors as optional
@postlight/parser depends on a git URL and npm refuses to fetch those, so one
unreachable extractor aborted the whole install; readability and trafilatura cover
the same job and provision fine.
2026-09-25 16:14:52 +02:00
MickLesk 959a86983c Build the venv on the distro python and drop the obsolete extractors
A uv-managed interpreter lives where the service user cannot execute it, so every
archivebox call as that user died with 'Permission denied' while 0.9 drops privileges
on import; Debian 13 ships python3.13 in apt, so the venv now points at /usr/bin.
0.9 also provisions single-file and readability itself through abx-dl - the two npm
modules no longer exist - and it needs BASE_URL pinned plus tesseract, imagemagick,
ffmpeg, unzip and wget present, or archivebox install reaches for apt as a user that
has no root.
2026-09-25 14:30:30 +02:00
MickLesk eb1005e9b5 minor fixes 2026-09-25 13:43:44 +02:00
MickLesk 6a33fc45ad Let ArchiveBox reach 0.9 instead of staying on 0.7.4
uv pip install --system targets the container's Python 3.11, and every ArchiveBox
release from 0.9 on requires 3.13, so the resolver silently fell back to 0.7.4.
The package now lives in its own 3.13 venv, with the interpreter outside root's
home because ArchiveBox drops privileges while importing. The expect block is
gone: init and createsuperuser both run unattended now, and the server moved to
its new default port.
2026-09-25 11:30:16 +02:00
26 changed files with 141 additions and 455 deletions

No files matched your search

-39
View File
@@ -586,51 +586,12 @@ Exercise vigilance regarding copycat or coat-tailing sites that seek to exploit
## 2026-11-20
### 🆕 New Scripts
- Grimmory [@MickLesk](https://github.com/MickLesk) ([#18880](https://github.com/community-scripts/ProxmoxVE/pull/18880))
### 🚀 Updated Scripts
- #### 🐞 Bug Fixes
- Remove thumbnails as opencloud user [@jheyens](https://github.com/jheyens) ([#18865](https://github.com/community-scripts/ProxmoxVE/pull/18865))
- NPMplus: hand Docker the usable DNS servers when resolv.conf has a zone ID [@MickLesk](https://github.com/MickLesk) ([#18860](https://github.com/community-scripts/ProxmoxVE/pull/18860))
- Nginx Proxy Manager: fetch the nginx HTTP/2 patches from the GitHub API [@MickLesk](https://github.com/MickLesk) ([#18855](https://github.com/community-scripts/ProxmoxVE/pull/18855))
- deCONZ: fetch libssl1.1 over HTTPS on arm64 [@MickLesk](https://github.com/MickLesk) ([#18798](https://github.com/community-scripts/ProxmoxVE/pull/18798))
- #### ✨ New Features
- Stalwart: migrate to v1 with stalwart-migrate [@MickLesk](https://github.com/MickLesk) ([#18794](https://github.com/community-scripts/ProxmoxVE/pull/18794))
- #### 🔧 Refactor
- Kasm: show the installer's last lines when it fails [@MickLesk](https://github.com/MickLesk) ([#18869](https://github.com/community-scripts/ProxmoxVE/pull/18869))
- Immich: skip oazapfts in mise install, the build never runs it [@MickLesk](https://github.com/MickLesk) ([#18859](https://github.com/community-scripts/ProxmoxVE/pull/18859))
- QoL - Postgres: keep installing when the Adminer prompt reads a closed console [@MickLesk](https://github.com/MickLesk) ([#18857](https://github.com/community-scripts/ProxmoxVE/pull/18857))
- Plane: install the API from uv.lock, v1.5.0 dropped the requirements files [@MickLesk](https://github.com/MickLesk) ([#18856](https://github.com/community-scripts/ProxmoxVE/pull/18856))
- Pi.Alert: install the crontab after the first scans [@MickLesk](https://github.com/MickLesk) ([#18858](https://github.com/community-scripts/ProxmoxVE/pull/18858))
### 💾 Core
- core: Keep the root filesystem lookup a soft failure [@MickLesk](https://github.com/MickLesk) ([core#280](https://github.com/community-scripts/core/pull/280))
- fix: vm - name why an image step failed and open one message for the disk import [@MickLesk](https://github.com/MickLesk) ([core#279](https://github.com/community-scripts/core/pull/279))
### 🧰 Tools
- #### 🐞 Bug Fixes
- Install the Scrutiny collector on TrueNAS SCALE without apt [@MickLesk](https://github.com/MickLesk) ([#18870](https://github.com/community-scripts/ProxmoxVE/pull/18870))
- #### 🔧 Refactor
- Refactor: Tailscale Script [@MickLesk](https://github.com/MickLesk) ([#18868](https://github.com/community-scripts/ProxmoxVE/pull/18868))
- Report an interrupted update-apps backup as cancelled, not failed [@MickLesk](https://github.com/MickLesk) ([#18867](https://github.com/community-scripts/ProxmoxVE/pull/18867))
- FSTrim: skip a container that will not start instead of ending fstrim [@MickLesk](https://github.com/MickLesk) ([#18864](https://github.com/community-scripts/ProxmoxVE/pull/18864))
- Say which containers update-lxcs failed on and why [@MickLesk](https://github.com/MickLesk) ([#18863](https://github.com/community-scripts/ProxmoxVE/pull/18863))
- clean-lxc: say which containers clean-lxcs failed on and why [@MickLesk](https://github.com/MickLesk) ([#18862](https://github.com/community-scripts/ProxmoxVE/pull/18862))
- LXC-Executer: run the execute command once per container and keep going on failure [@MickLesk](https://github.com/MickLesk) ([#18861](https://github.com/community-scripts/ProxmoxVE/pull/18861))
## 2026-11-19
### 🆕 New Scripts
+40 -22
View File
@@ -12,7 +12,7 @@ var_cpu="${var_cpu:-2}"
var_ram="${var_ram:-1024}"
var_disk="${var_disk:-8}"
var_os="${var_os:-debian}"
var_version="${var_version:-12}"
var_version="${var_version:-13}"
var_arm64="${var_arm64:-yes}"
var_unprivileged="${var_unprivileged:-1}"
@@ -30,30 +30,48 @@ function update_script() {
exit
fi
NODE_VERSION="22" NODE_MODULE="@postlight/parser@latest,single-file-cli@latest" setup_nodejs
PYTHON_VERSION="3.13" setup_uv
if check_for_gh_release "archivebox" "ArchiveBox/ArchiveBox"; then
msg_info "Stopping ArchiveBox"
systemctl stop archivebox
msg_ok "Stopped ArchiveBox"
ensure_dependencies chromium
export UV_PYTHON_INSTALL_DIR="/opt/archivebox/python"
PYTHON_VERSION="3.13" setup_uv
ensure_dependencies chromium
msg_info "Stopping Service"
systemctl stop archivebox
msg_ok "Stopped Service"
if [[ ! -x /opt/archivebox/.venv/bin/archivebox ]]; then
msg_info "Migrating ArchiveBox to 0.9"
$STD uv pip uninstall --system --break-system-packages archivebox playwright
rm -rf /home/archivebox/.cache/ms-playwright
remove_old_tool_version "nodejs" "nodesource"
sed -i -e '/^User=archivebox$/d' -e 's|^ExecStart=/usr/local/bin/archivebox |ExecStart=/opt/archivebox/.venv/bin/archivebox |' /etc/systemd/system/archivebox.service
sed -i '/^ExecStart=/i ExecStartPre=-/bin/sh -c "echo 1G 2>/dev/null >/sys/fs/cgroup/memory.reclaim"' /etc/systemd/system/archivebox.service
systemctl daemon-reload
$STD uv venv --python 3.13 /opt/archivebox/.venv
msg_ok "Migrated ArchiveBox to 0.9"
fi
msg_info "Upgrading Playwright"
$STD uv pip install playwright --system --break-system-packages
$STD playwright install-deps chromium
msg_ok "Upgraded Playwright"
msg_info "Updating ArchiveBox"
$STD uv pip install --python /opt/archivebox/.venv/bin/python "archivebox==${CHECK_UPDATE_RELEASE#v}"
ln -sf /opt/archivebox/.venv/bin/archivebox /usr/local/bin/archivebox
cd /opt/archivebox/data
$STD archivebox init
if ! grep -q "^BASE_URL" ArchiveBox.conf; then
$STD archivebox config --set "BASE_URL=http://${LOCAL_IP}:$(grep -oP 'server 0\.0\.0\.0:\K[0-9]+' /etc/systemd/system/archivebox.service)"
fi
echo 1G 2>/dev/null >/sys/fs/cgroup/memory.reclaim || true
$STD archivebox install
$STD archivebox update --migrate-only
cat <<EOF >~/.archivebox
${CHECK_UPDATE_RELEASE#v}
EOF
msg_ok "Updated ArchiveBox"
msg_info "Updating ArchiveBox"
cd /opt/archivebox/data
$STD uv pip install --system --break-system-packages --upgrade --no-reinstall archivebox
sudo -u archivebox archivebox init
msg_ok "Updated ArchiveBox"
msg_info "Starting Service"
systemctl start archivebox
msg_ok "Started Service"
msg_ok "Updated successfully!"
msg_info "Starting ArchiveBox"
systemctl start archivebox
msg_ok "Started ArchiveBox"
msg_ok "Updated successfully!"
fi
exit
}
@@ -64,4 +82,4 @@ description
msg_ok "Completed successfully!\n"
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
echo -e "${INFO}${YW}Access it using the following URL:${CL}"
echo -e "${GATEWAY}${BGN}http://${IP}:8000/admin/login${CL}"
echo -e "${GATEWAY}${BGN}http://${IP}:8000/admin/${CL}"
+5 -10
View File
@@ -93,15 +93,6 @@ function update_script() {
rm -rf /opt/browserless /root/.cache/ms-playwright
$STD apt purge -y microsoft-edge-stable
rm -f /etc/apt/sources.list.d/microsoft-edge-stable.list
sed -i 's/browserless\.service/sockpuppetbrowser.service/g' "$SERVICE_FILE"
sed -i -e '/^WEBDRIVER_URL=/d' \
-e 's|^PLAYWRIGHT_DRIVER_URL=ws://localhost:3000/chrome.*|PLAYWRIGHT_DRIVER_URL=ws://127.0.0.1:3000/?headful=true\&--window-size=1920,1080|' \
/opt/changedetection/.env
msg_ok "Replaced Browserless with SockPuppetBrowser"
fi
if [[ ! -f /etc/systemd/system/sockpuppetbrowser.service ]]; then
msg_info "Creating SockPuppetBrowser Service"
cat <<EOF >/etc/systemd/system/sockpuppetbrowser.service
[Unit]
Description=SockPuppetBrowser
@@ -119,9 +110,13 @@ Restart=on-failure
[Install]
WantedBy=multi-user.target
EOF
sed -i 's/browserless\.service/sockpuppetbrowser.service/g' "$SERVICE_FILE"
sed -i -e '/^WEBDRIVER_URL=/d' \
-e 's|^PLAYWRIGHT_DRIVER_URL=ws://localhost:3000/chrome.*|PLAYWRIGHT_DRIVER_URL=ws://127.0.0.1:3000/?headful=true\&--window-size=1920,1080|' \
/opt/changedetection/.env
systemctl daemon-reload
systemctl enable -q sockpuppetbrowser
msg_ok "Created SockPuppetBrowser Service"
msg_ok "Replaced Browserless with SockPuppetBrowser"
fi
systemctl daemon-reload
-2
View File
@@ -32,8 +32,6 @@ function update_script() {
msg_info "Updating deCONZ"
apt_update_safe
$STD apt upgrade -y
setcap -r /usr/bin/deCONZ 2>/dev/null || true
systemctl restart deconz
msg_ok "Updated deCONZ"
msg_ok "Updated successfully!"
exit
-61
View File
@@ -1,61 +0,0 @@
#!/usr/bin/env bash
_cs_boot="${COMMUNITY_SCRIPTS_CORE_DIR:-$(dirname "${BASH_SOURCE[0]}")/../../core}/core/build.func"
source "$_cs_boot" 2>/dev/null || source <(curl -fsSL "${COMMUNITY_SCRIPTS_CORE_URL:-https://raw.githubusercontent.com/community-scripts/core/main}/core/build.func")
# Copyright (c) 2021-2026 community-scripts ORG
# Author: MickLesk (CanbiZ)
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://github.com/grimmory-tools/grimmory
APP="Grimmory"
var_tags="${var_tags:-books;ebooks;library}"
var_cpu="${var_cpu:-2}"
var_ram="${var_ram:-2048}"
var_disk="${var_disk:-8}"
var_os="${var_os:-debian}"
var_version="${var_version:-13}"
var_arm64="${var_arm64:-no}" # release jar bundles x64-only PDFium natives
var_unprivileged="${var_unprivileged:-1}"
header_info "$APP"
variables
color
catch_errors
function update_script() {
header_info
check_container_storage
check_container_resources
if [[ ! -f /opt/grimmory/grimmory.jar ]]; then
msg_error "No ${APP} Installation Found!"
exit
fi
if check_for_gh_release "kepubify" "pgaskin/kepubify"; then
fetch_and_deploy_gh_release "kepubify" "pgaskin/kepubify" "singlefile" "latest" "/usr/local/bin" "kepubify-linux-64bit"
fi
if check_for_gh_release "grimmory" "grimmory-tools/grimmory"; then
msg_info "Stopping Grimmory"
systemctl stop grimmory
msg_ok "Stopped Grimmory"
JAVA_VERSION="25" setup_java
USE_ORIGINAL_FILENAME="true" fetch_and_deploy_gh_release "grimmory" "grimmory-tools/grimmory" "singlefile" "latest" "/opt/grimmory" "grimmory.jar"
msg_info "Starting Grimmory"
systemctl start grimmory
msg_ok "Started Grimmory"
msg_ok "Updated successfully!"
fi
exit
}
start
build_container
description
msg_ok "Completed successfully!\n"
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:6060${CL}"
+1 -1
View File
@@ -227,7 +227,7 @@ EOF
# plugins
cd "$SRC_DIR"
export MISE_TRUSTED_CONFIG_PATHS="$SRC_DIR"/mise.toml
export MISE_DISABLE_TOOLS=github:jellyfin/jellyfin-ffmpeg,java,terragrunt,opentofu,restic,npm:@openapitools/openapi-generator-cli,npm:oazapfts
export MISE_DISABLE_TOOLS=github:jellyfin/jellyfin-ffmpeg,java,terragrunt,opentofu,restic,npm:@openapitools/openapi-generator-cli
export MISE_LOCKFILE_MODE=merge MISE_LOCKFILE_PLATFORMS="linux-$(arch_resolve x64 arm64)"
mise_ok=0
for i in 1 2 3; do
+1 -4
View File
@@ -68,10 +68,7 @@ function update_script() {
msg_info "Patching nginx HTTP/2 (CVE-2026-123007, CVE-2026-123633)"
for commit in 61031503dc8087c2c17cd2142c9b4b19062f90c4 2df48a501d0fb8212b7d39dffeeff5876332ba59 e27f5fa84fe6e98505e70bc543b748747dad0a3b; do
curl_with_retry "https://api.github.com/repos/nginx/nginx/commits/${commit}" "/tmp/nginx-${commit}.patch" "-HAccept:application/vnd.github.patch" ||
curl_with_retry "https://github.com/nginx/nginx/commit/${commit}.patch" "/tmp/nginx-${commit}.patch"
patch -d /opt/openresty/bundle/nginx-1.31.8 -p1 --forward -s <"/tmp/nginx-${commit}.patch"
rm -f "/tmp/nginx-${commit}.patch"
curl_with_retry "https://github.com/nginx/nginx/commit/${commit}.patch" "-" | patch -d /opt/openresty/bundle/nginx-1.31.8 -p1 --forward -s
done
msg_ok "Patched nginx HTTP/2"
+1 -1
View File
@@ -90,7 +90,7 @@ function update_script() {
# 9.0: the default space quota is read only under its new name, and thumbnails are cached in thumbnails/cache
sed -i 's/^GRAPH_SPACES_DEFAULT_QUOTA=/OC_SPACES_DEFAULT_QUOTA=/' /etc/opencloud/opencloud.env
sudo -u opencloud rm -rf /var/lib/opencloud/thumbnails/files
rm -rf /var/lib/opencloud/thumbnails/files
msg_info "Starting services"
systemctl start opencloud opencloud-wopi
+2 -3
View File
@@ -57,11 +57,10 @@ function update_script() {
$STD pnpm turbo run build --filter=web --filter=admin --filter=space --filter=live
msg_ok "Rebuilt Frontend"
PYTHON_VERSION="3.12" UV_PROJECT_DIR="/opt/plane/apps/api" setup_uv
msg_info "Updating Python Dependencies"
cd /opt/plane/apps/api
UV_PROJECT_ENVIRONMENT=/opt/plane-venv $STD uv sync --locked --no-default-groups --group production
export VIRTUAL_ENV=/opt/plane-venv
$STD uv pip install --upgrade -r requirements/production.txt
msg_ok "Updated Python Dependencies"
msg_info "Running Migrations"
+29 -55
View File
@@ -15,69 +15,43 @@ update_os
msg_info "Installing Dependencies"
$STD apt install -y \
git \
expect \
libssl-dev \
libldap2-dev \
libsasl2-dev \
procps \
dnsutils \
ripgrep \
libatomic1 \
chromium
msg_ok "Installed Dependencies"
msg_info "Installing Python Dependencies"
$STD apt install -y \
python3-ldap \
python3-msgpack \
python3-regex
msg_ok "Installed Python Dependencies"
NODE_VERSION="22" NODE_MODULE="@postlight/parser@latest,single-file-cli@latest" setup_nodejs
export UV_PYTHON_INSTALL_DIR="/opt/archivebox/python"
PYTHON_VERSION="3.13" setup_uv
msg_info "Installing Playwright"
$STD uv pip install playwright --system --break-system-packages
$STD playwright install-deps chromium
msg_ok "Installed Playwright"
msg_info "Installing ArchiveBox"
mkdir -p /opt/archivebox/{data,.npm,.cache,.local}
$STD adduser --system --shell /bin/bash --gecos 'Archive Box User' --group --disabled-password --home /home/archivebox archivebox
chown -R archivebox:archivebox /opt/archivebox/{data,.npm,.cache,.local}
chmod -R 755 /opt/archivebox/data
$STD uv pip install archivebox --system --break-system-packages
cd /opt/archivebox/data
ADMIN_PASS=$(random_password 20)
expect <<EOF
set timeout -1
log_user 0
spawn sudo -u archivebox playwright install chromium
spawn sudo -u archivebox archivebox setup
expect "Username"
send "\r"
expect "Email address"
send "\r"
expect "Password"
send "${ADMIN_PASS}\r"
expect "Password (again)"
send "${ADMIN_PASS}\r"
expect eof
ARCHIVEBOX_VERSION="${var_appversion:-$(get_latest_github_release "ArchiveBox/ArchiveBox")}"
mkdir -p /opt/archivebox/data
$STD uv venv --python 3.13 /opt/archivebox/.venv
$STD uv pip install --python /opt/archivebox/.venv/bin/python "archivebox==${ARCHIVEBOX_VERSION#v}"
ln -sf /opt/archivebox/.venv/bin/archivebox /usr/local/bin/archivebox
cat <<EOF >~/.archivebox
${ARCHIVEBOX_VERSION#v}
EOF
{
echo "ArchiveBox Credentials"
echo "Username: archivebox"
echo "Password: ${ADMIN_PASS}"
} >~/archivebox.creds
msg_ok "Installed ArchiveBox"
msg_info "Initializing ArchiveBox"
cd /opt/archivebox/data
$STD archivebox init
ADMIN_PASS=$(random_password 20)
DJANGO_SUPERUSER_USERNAME=archivebox DJANGO_SUPERUSER_EMAIL=archivebox@archivebox.local DJANGO_SUPERUSER_PASSWORD="$ADMIN_PASS" $STD archivebox manage createsuperuser --noinput
$STD archivebox config --set "BASE_URL=http://${LOCAL_IP}:8000"
cat <<EOF >~/archivebox.creds
ArchiveBox Credentials
Username: archivebox
Password: ${ADMIN_PASS}
EOF
msg_ok "Initialized ArchiveBox"
msg_info "Installing ArchiveBox Extractors"
# 0.9.77 counts page cache as used memory under a cgroup limit and refuses to run (ArchiveBox#1966)
echo 1G 2>/dev/null >/sys/fs/cgroup/memory.reclaim || true
$STD archivebox install
msg_ok "Installed ArchiveBox Extractors"
msg_info "Creating Service"
cat <<EOF >/etc/systemd/system/archivebox.service
[Unit]
@@ -85,9 +59,9 @@ Description=ArchiveBox Server
After=network.target
[Service]
User=archivebox
WorkingDirectory=/opt/archivebox/data
ExecStart=/usr/local/bin/archivebox server 0.0.0.0:8000
ExecStartPre=-/bin/sh -c "echo 1G 2>/dev/null >/sys/fs/cgroup/memory.reclaim"
ExecStart=/opt/archivebox/.venv/bin/archivebox server 0.0.0.0:8000
Restart=always
[Install]
+3 -5
View File
@@ -22,13 +22,11 @@ setup_deb822_repo \
msg_ok "Setup Phoscon Repository"
msg_info "Installing deConz"
pool="$(arch_resolve "https://security.ubuntu.com/ubuntu/pool/main/o/openssl/" "https://ports.ubuntu.com/ubuntu-ports/pool/main/o/openssl/")"
libssl=$(curl -fsSL --proto '=https' "$pool" | grep -o "libssl1\.1_1\.1\.1f-1ubuntu2\.2[^\"]*$(arch_resolve)\.deb" | head -n1)
curl -fsSL --proto '=https' "$pool$libssl" -o "$libssl"
pool="$(arch_resolve "https://security.ubuntu.com/ubuntu/pool/main/o/openssl/" "http://ports.ubuntu.com/ubuntu-ports/pool/main/o/openssl/")"
libssl=$(curl -fsSL --proto '=http,https' "$pool" | grep -o "libssl1\.1_1\.1\.1f-1ubuntu2\.2[^\"]*$(arch_resolve)\.deb" | head -n1)
curl -fsSL --proto '=http,https' "$pool$libssl" -o "$libssl"
$STD dpkg -i "$libssl"
$STD apt install -y deconz
# The service runs as root; the postinst file caps break exec in privileged Incus containers
setcap -r /usr/bin/deCONZ 2>/dev/null || true
rm -rf "$libssl"
msg_ok "Installed deConz"
-61
View File
@@ -1,61 +0,0 @@
#!/usr/bin/env bash
# Copyright (c) 2021-2026 community-scripts ORG
# Author: MickLesk (CanbiZ)
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://github.com/grimmory-tools/grimmory
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
color
verb_ip6
catch_errors
setting_up_container
network_check
update_os
setup_ffmpeg
JAVA_VERSION="25" setup_java
setup_mariadb
MARIADB_DB_NAME="grimmory" MARIADB_DB_USER="grimmory" MARIADB_DB_CREDS_FILE="/dev/null" setup_mariadb_db
fetch_and_deploy_gh_release "kepubify" "pgaskin/kepubify" "singlefile" "latest" "/usr/local/bin" "kepubify-linux-64bit"
USE_ORIGINAL_FILENAME="true" fetch_and_deploy_gh_release "grimmory" "grimmory-tools/grimmory" "singlefile" "latest" "/opt/grimmory" "grimmory.jar"
msg_info "Configuring Grimmory"
mkdir -p /opt/grimmory_data/{data,books,bookdrop}
cat <<EOF >/opt/grimmory_data/.env
DATABASE_HOST=localhost
DATABASE_NAME=${MARIADB_DB_NAME}
DATABASE_USERNAME=${MARIADB_DB_USER}
DATABASE_PASSWORD=${MARIADB_DB_PASS}
APP_PATH_CONFIG=/opt/grimmory_data/data
APP_BOOKDROP_FOLDER=/opt/grimmory_data/bookdrop
SERVER_PORT=6060
EOF
chmod 600 /opt/grimmory_data/.env
msg_ok "Configured Grimmory"
msg_info "Creating Service"
cat <<EOF >/etc/systemd/system/grimmory.service
[Unit]
Description=Grimmory
After=network.target mariadb.service
Requires=mariadb.service
[Service]
Type=simple
WorkingDirectory=/opt/grimmory_data
EnvironmentFile=/opt/grimmory_data/.env
ExecStart=/usr/bin/java -XX:+UseCompactObjectHeaders -XX:MaxRAMPercentage=60.0 -XX:+ExitOnOutOfMemoryError --enable-native-access=ALL-UNNAMED --enable-preview -jar /opt/grimmory/grimmory.jar
SuccessExitStatus=143
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target
EOF
systemctl enable -q --now grimmory
msg_ok "Created Service"
motd_ssh
customize
cleanup_lxc
+1 -1
View File
@@ -284,7 +284,7 @@ cp -a web/build "$APP_DIR"/www
cp LICENSE "$APP_DIR"
cd "$SRC_DIR"
export MISE_TRUSTED_CONFIG_PATHS="$SRC_DIR"/mise.toml
export MISE_DISABLE_TOOLS=github:jellyfin/jellyfin-ffmpeg,java,terragrunt,opentofu,restic,npm:@openapitools/openapi-generator-cli,npm:oazapfts
export MISE_DISABLE_TOOLS=github:jellyfin/jellyfin-ffmpeg,java,terragrunt,opentofu,restic,npm:@openapitools/openapi-generator-cli
export MISE_LOCKFILE_MODE=merge MISE_LOCKFILE_PLATFORMS="linux-$(arch_resolve x64 arm64)"
mise_ok=0
for i in 1 2 3; do
+1 -6
View File
@@ -63,12 +63,7 @@ curl_download "/opt/kasm_release_${KASM_VERSION}.tar.gz" "$KASM_URL"
cd /opt
tar -xf "kasm_release_${KASM_VERSION}.tar.gz"
chmod +x /opt/kasm_release/install.sh
bash /opt/kasm_release/install.sh --accept-eula --no-swap-check --no-check-disk --ignore-dep-failures >~/kasm-install.output 2>&1 || {
KASM_RC=$?
$STD tail -n 25 ~/kasm-install.output
msg_error "The Kasm installer failed (exit ${KASM_RC}), see ~/kasm-install.output"
exit "$KASM_RC"
}
bash /opt/kasm_release/install.sh --accept-eula --no-swap-check --no-check-disk --ignore-dep-failures >~/kasm-install.output 2>&1
awk '
/^Kasm UI Login Credentials$/ {capture=1}
capture {print}
+1 -4
View File
@@ -42,10 +42,7 @@ fetch_and_deploy_from_url "https://openresty.org/download/openresty-${OPENRESTY_
msg_info "Patching nginx HTTP/2 (CVE-2026-123007, CVE-2026-123633)"
for commit in 61031503dc8087c2c17cd2142c9b4b19062f90c4 2df48a501d0fb8212b7d39dffeeff5876332ba59 e27f5fa84fe6e98505e70bc543b748747dad0a3b; do
curl_with_retry "https://api.github.com/repos/nginx/nginx/commits/${commit}" "/tmp/nginx-${commit}.patch" "-HAccept:application/vnd.github.patch" ||
curl_with_retry "https://github.com/nginx/nginx/commit/${commit}.patch" "/tmp/nginx-${commit}.patch"
patch -d /opt/openresty/bundle/nginx-1.31.8 -p1 --forward -s <"/tmp/nginx-${commit}.patch"
rm -f "/tmp/nginx-${commit}.patch"
curl_with_retry "https://github.com/nginx/nginx/commit/${commit}.patch" "-" | patch -d /opt/openresty/bundle/nginx-1.31.8 -p1 --forward -s
done
msg_ok "Patched nginx HTTP/2"
-5
View File
@@ -68,11 +68,6 @@ yq -i "
(map(select(. != \"TZ=*\" and . != \"ACME_EMAIL=*\" and . != \"INITIAL_ADMIN_EMAIL=*\" and . != \"INITIAL_ADMIN_PASSWORD=*\")) +
[\"TZ=$TZ_INPUT\", \"ACME_EMAIL=$ACME_EMAIL_INPUT\", \"INITIAL_ADMIN_EMAIL=admin@local.com\", \"INITIAL_ADMIN_PASSWORD=${ADMIN_PASS}\"])
" /opt/compose.yaml
# nginx in the NPMplus image cannot parse a link-local resolver with a zone ID (fe80::1%eth0)
DNS_SERVERS="$(awk '/^nameserver/ && $2 !~ /%/ {print $2}' /etc/resolv.conf)"
if grep -qE '^nameserver[[:space:]]+[^[:space:]]*%' /etc/resolv.conf && [[ -n "$DNS_SERVERS" ]]; then
DNS_SERVERS="$DNS_SERVERS" yq -i '.services.npmplus.dns = (strenv(DNS_SERVERS) | split("\n"))' /opt/compose.yaml
fi
{
echo "NPMplus Credentials"
echo "Email: admin@local.com"
+1 -1
View File
@@ -83,6 +83,7 @@ for file in pialert.vendors.log pialert.IP.log pialert.1.log pialert.cleanup.log
done
sed -i 's#PIALERT_PATH\s*=\s*'\''/home/pi/pialert'\''#PIALERT_PATH = '\''/opt/pialert'\''#' /opt/pialert/config/pialert.conf
sed -i 's/$HOME/\/opt/g' /opt/pialert/install/pialert.cron
crontab /opt/pialert/install/pialert.cron
echo "python3 /opt/pialert/back/pialert.py 1" >/usr/bin/scan
chmod +x /usr/bin/scan
echo "/opt/pialert/back/pialert-cli set_permissions --lxc" >/usr/bin/permissions
@@ -95,7 +96,6 @@ msg_info "Start Pi.Alert Scan (Patience)"
$STD python3 /opt/pialert/back/pialert.py update_vendors
$STD python3 /opt/pialert/back/pialert.py internet_IP
$STD python3 /opt/pialert/back/pialert.py 1
crontab /opt/pialert/install/pialert.cron
msg_ok "Finished Pi.Alert Scan"
motd_ssh
+4 -4
View File
@@ -96,11 +96,11 @@ $STD pnpm install --frozen-lockfile
$STD pnpm turbo run build --filter=web --filter=admin --filter=space --filter=live
msg_ok "Built Frontend Apps"
PYTHON_VERSION="3.12" UV_PROJECT_DIR="/opt/plane/apps/api" setup_uv
msg_info "Setting up Python API"
cd /opt/plane/apps/api
UV_PROJECT_ENVIRONMENT=/opt/plane-venv $STD uv sync --locked --no-default-groups --group production
setup_uv
$STD uv venv /opt/plane-venv
export VIRTUAL_ENV=/opt/plane-venv
$STD uv pip install -r /opt/plane/apps/api/requirements/production.txt
msg_ok "Set up Python API"
msg_info "Configuring Plane"
+2 -2
View File
@@ -127,7 +127,7 @@ EOF
msg_ok "Installed PostgreSQL"
prompt="${var_postgresql_adminer:-}"
[[ -n "$prompt" ]] || read -r -p "${TAB3}Would you like to add Adminer? <y/N> " prompt || true
[[ -n "$prompt" ]] || read -r -p "${TAB3}Would you like to add Adminer? <y/N> " prompt
if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then
msg_info "Installing Adminer"
$STD apt install -y adminer
@@ -167,7 +167,7 @@ setup_alpine() {
msg_ok "Configured and Restarted PostgreSQL"
prompt="${var_postgresql_adminer:-}"
[[ -n "$prompt" ]] || read -r -p "${TAB3}Would you like to install Adminer with lighttpd? <y/N>: " prompt || true
[[ -n "$prompt" ]] || read -r -p "${TAB3}Would you like to install Adminer with lighttpd? <y/N>: " prompt
if [[ ${prompt,,} =~ ^(y|yes)$ ]]; then
msg_info "Installing Adminer and dependencies"
$STD apk add --no-cache \
+14 -32
View File
@@ -89,22 +89,13 @@ esac
CTID_CONFIG_PATH="/etc/pve/lxc/${CTID}.conf"
# Snapshots follow the container's own settings as [name] sections, so a line
# appended to the file ends up in the last snapshot instead of the container.
CONF_MAIN=$(awk '/^\[/ {exit} {print}' "$CTID_CONFIG_PATH")
CONF_SNAPSHOTS=$(awk '/^\[/ {s=1} s' "$CTID_CONFIG_PATH")
CONF_ADD=""
grep -q "^lxc.cgroup2.devices.allow: c 10:200 rwm" <<<"$CONF_MAIN" || CONF_ADD+=$'\n'"lxc.cgroup2.devices.allow: c 10:200 rwm"
grep -q "^lxc.mount.entry: /dev/net/tun" <<<"$CONF_MAIN" || CONF_ADD+=$'\n'"lxc.mount.entry: /dev/net/tun dev/net/tun none bind,create=file"
if [[ -n "$CONF_ADD" && -n "$CONF_SNAPSHOTS" ]]; then
printf '%s%s\n\n%s\n' "$CONF_MAIN" "$CONF_ADD" "$CONF_SNAPSHOTS" >"$CTID_CONFIG_PATH"
elif [[ -n "$CONF_ADD" ]]; then
printf '%s\n' "${CONF_ADD#$'\n'}" >>"$CTID_CONFIG_PATH"
fi
# Skip if already configured
grep -q "lxc.cgroup2.devices.allow: c 10:200 rwm" "$CTID_CONFIG_PATH" || echo "lxc.cgroup2.devices.allow: c 10:200 rwm" >>"$CTID_CONFIG_PATH"
grep -q "lxc.mount.entry: /dev/net/tun" "$CTID_CONFIG_PATH" || echo "lxc.mount.entry: /dev/net/tun dev/net/tun none bind,create=file" >>"$CTID_CONFIG_PATH"
msg_info "Installing Tailscale in CT $CTID"
$STD pct exec "$CTID" -- bash -c '
pct exec "$CTID" -- bash -c '
set -e
# Detect OS inside container
@@ -128,8 +119,6 @@ if [ -f /etc/alpine-release ]; then
else
# ── Debian / Ubuntu ──
export DEBIAN_FRONTEND=noninteractive
# The helpers then print apt output instead of logging it inside the container.
export VERBOSE=yes
# Source os-release properly (handles quoted values)
. /etc/os-release
@@ -141,8 +130,7 @@ else
# Check DNS resolution using multiple methods (dig may not be installed)
dns_check_failed=true
if command -v dig >/dev/null 2>&1; then
# dig prints its own errors (";; no servers could be reached") on stdout
if dig +short pkgs.tailscale.com 2>/dev/null | grep -E "^[0-9.]+$" | grep -qvE "^127\.|^0\.0\.0\.0$"; then
if dig +short pkgs.tailscale.com 2>/dev/null | grep -qvE "^127\.|^0\.0\.0\.0$|^$"; then
dns_check_failed=false
fi
elif command -v host >/dev/null 2>&1; then
@@ -168,8 +156,6 @@ else
cp "$ORIG_RESOLV" "$BACKUP_RESOLV"
echo "nameserver 1.1.1.1" >"$ORIG_RESOLV"
fi
RESTORE_RESOLV="[ ! -f $BACKUP_RESOLV ] || mv -f $BACKUP_RESOLV $ORIG_RESOLV"
trap "$RESTORE_RESOLV" EXIT
if ! command -v curl >/dev/null 2>&1; then
echo "[INFO] curl not found, installing..."
@@ -180,13 +166,6 @@ else
# Reuse the shared repository helper instead of hand-rolling the sources entry
source <(curl -fsSL "${COMMUNITY_SCRIPTS_CORE_URL:-https://raw.githubusercontent.com/community-scripts/core/main}/core/core.func")
source <(curl -fsSL "${COMMUNITY_SCRIPTS_CORE_URL:-https://raw.githubusercontent.com/community-scripts/core/main}/lib/tools.func")
# core.func sets its own EXIT trap
trap "$RESTORE_RESOLV" EXIT
# A failed download is sourced as an empty file
if ! declare -f load_functions setup_deb822_repo >/dev/null; then
echo "[ERROR] Could not download the community-scripts helpers inside the container. Check its network and DNS." >&2
exit 7
fi
load_functions
# Drop the legacy keyring from the pre-deb822 layout
@@ -199,15 +178,18 @@ else
"${VERSION_CODENAME}" \
"main"
apt-get install -y tailscale
apt-get install -y tailscale >/dev/null
if [ -f /tmp/resolv.conf.backup ]; then
echo "[INFO] Restoring original /etc/resolv.conf"
mv /tmp/resolv.conf.backup /etc/resolv.conf
fi
fi
'
# The tag is cosmetic; Tailscale is installed by now.
TAGS=$(pct config "$CTID" | awk -F': ' '/^tags:/ {print $2}')
if [[ ";${TAGS};" != *";tailscale;"* ]] && ! TAG_OUTPUT=$(pct set "$CTID" -tags "${TAGS:+$TAGS;}tailscale" 2>&1); then
msg_warn "Could not add the tailscale tag to CT $CTID: ${TAG_OUTPUT}"
fi
TAGS=$(awk -F': ' '/^tags:/ {print $2}' "$CTID_CONFIG_PATH")
TAGS="${TAGS:+$TAGS; }tailscale"
pct set "$CTID" -tags "$TAGS"
msg_ok "Tailscale installed on CT $CTID"
echo -e "${YW}Reboot the container${CL}, then run 'tailscale up' inside the container to activate."
+6 -36
View File
@@ -49,11 +49,6 @@ if ! excluded_containers=$(whiptail --backtitle "Proxmox VE Helper Scripts" --ti
exit 0
fi
# The failing containers' output, for the user and for the telemetry trace.
RUN_LOG="/tmp/clean-lxcs-$(date +%Y%m%d_%H%M%S).log"
SILENT_LOGFILE="$RUN_LOG"
CLEAN_OUTPUT=$(mktemp)
function run_lxc_clean() {
local container=$1
header_info
@@ -84,19 +79,7 @@ function run_lxc_clean() {
apt -y autoclean
apt update
fi
' 2>&1 | tee "$CLEAN_OUTPUT"
}
# record_failure <ctid> <what> [output file] - adds the output's last error line
function record_failure() {
local name reason=""
name=$(pct config "$1" 2>/dev/null | awk '/^hostname:/ {print $2}' || true)
if [[ -s "${3:-}" ]]; then
reason=$(sed 's/\x1b\[[0-9;]*[a-zA-Z]//g; s/\r//g' "$3" | grep -E '^(E:|ERROR|Error|error)' | tail -n1 || true)
[[ -n "$reason" ]] || reason=$(sed 's/\x1b\[[0-9;]*[a-zA-Z]//g; s/\r//g' "$3" | grep -v '^[[:space:]]*$' | tail -n1 || true)
{ echo "CT $1${name:+ ($name)}: $2"; tail -n 20 "$3"; echo; } >>"$RUN_LOG"
fi
failed_containers+=("$1${name:+ ($name)}: $2${reason:+ - $reason}")
'
}
failed_containers=()
@@ -124,43 +107,30 @@ for container in $(pct list | awk '{if(NR>1) print $1}'); do
continue
fi
if ! status=$(pct status "$container" 2>&1); then
record_failure "$container" "pct status failed: $status"
continue
fi
status=$(pct status "$container")
template=$(pct config "$container" | grep -q "template:" && echo "true" || echo "false")
if [ "$template" == "false" ] && [ "$status" == "status: stopped" ]; then
echo -e "${BL}[Info]${GN} Starting${BL} $container ${CL} \n"
if ! pct start "$container" >"$CLEAN_OUTPUT" 2>&1; then
cat "$CLEAN_OUTPUT"
record_failure "$container" "did not start" "$CLEAN_OUTPUT"
if ! pct start "$container"; then
failed_containers+=("$container (start)")
continue
fi
echo -e "${BL}[Info]${GN} Waiting For${BL} $container${CL}${GN} To Start ${CL} \n"
sleep 5
rc=0
run_lxc_clean "$container" || rc=$?
[ "$rc" -eq 0 ] || record_failure "$container" "cleaning exited with $rc" "$CLEAN_OUTPUT"
run_lxc_clean "$container" || failed_containers+=("$container")
echo -e "${BL}[Info]${GN} Shutting down${BL} $container ${CL} \n"
pct shutdown "$container" &
elif [ "$status" == "status: running" ]; then
rc=0
run_lxc_clean "$container" || rc=$?
[ "$rc" -eq 0 ] || record_failure "$container" "cleaning exited with $rc" "$CLEAN_OUTPUT"
run_lxc_clean "$container" || failed_containers+=("$container")
fi
done
wait
rm -f "$CLEAN_OUTPUT"
header_info
if [ "${#failed_containers[@]}" -gt 0 ]; then
echo -e "${RD}Cleaning failed in these containers:${CL}"
printf '%s\n' "${failed_containers[@]}"
echo ""
[ -s "$RUN_LOG" ] && echo -e "Their output: $RUN_LOG\n"
printf -v CS_ERROR_MSG '%s; ' "${failed_containers[@]}"
CS_ERROR_MSG="Cleaning failed in ${#failed_containers[@]} container(s): ${CS_ERROR_MSG%; }"
exit 1
fi
echo -e "${GN} Finished, Selected Containers Cleaned. ${CL} \n"
+9 -14
View File
@@ -51,20 +51,18 @@ header_info
echo "One moment please...\n"
function execute_in() {
local container=$1 name rc=0
name=$(pct config "$container" | awk '/^hostname:/ {print $2}')
echo -e "${BL}[Info]${GN} Execute inside${BL} ${container} (${name})${GN} with output: ${CL}"
# Run once; a failure in one container must not end the run for the others.
pct exec "$container" -- bash -c "${custom_command}" | tee || rc=$?
if [ "$rc" -eq 127 ]; then
echo -e "${BL}[Info]${RD} ${container} (${name}) has no command: ${custom_command}${CL}"
elif [ "$rc" -ne 0 ]; then
echo -e "${BL}[Info]${RD} Command exited with code ${rc} in ${container} (${name})${CL}"
container=$1
name=$(pct exec "$container" hostname)
echo -e "${BL}[Info]${GN} Execute inside${BL} ${name}${GN} with output: ${CL}"
if ! pct exec "$container" -- bash -c "command ${custom_command} >/dev/null 2>&1"; then
echo -e "${BL}[Info]${GN} Skipping ${name} ${RD}$container has no command: ${custom_command}"
else
pct exec "$container" -- bash -c "${custom_command}" | tee
fi
}
for container in $(pct list | awk '{if(NR>1) print $1}'); do
if [[ " ${excluded_containers} " == *" ${container} "* ]]; then
if [[ " ${excluded_containers[@]} " =~ " $container " ]]; then
echo -e "${BL}[Info]${GN} Skipping ${BL}$container${CL}"
else
os=$(pct config "$container" | awk '/^ostype/ {print $2}')
@@ -77,10 +75,7 @@ for container in $(pct list | awk '{if(NR>1) print $1}'); do
template=$(pct config "$container" | grep -q "template:" && echo "true" || echo "false")
if [ "$template" == "false" ] && [ "$status" == "status: stopped" ]; then
echo -e "${BL}[Info]${GN} Starting${BL} $container ${CL}"
if ! pct start "$container"; then
echo -e "${BL}[Info]${RD} Skipping ${container}, it did not start${CL}"
continue
fi
pct start "$container"
echo -e "${BL}[Info]${GN} Waiting For${BL} $container${CL}${GN} To Start ${CL}"
sleep 5
execute_in "$container"
+1 -11
View File
@@ -141,7 +141,6 @@ function trim_container() {
sleep 0.5
}
NOT_STARTED=()
for LINE in "${CTLINES[@]}"; do
CTID=$(awk '{print $1}' <<<"$LINE")
STATUS=$(awk '{print $2}' <<<"$LINE")
@@ -162,13 +161,7 @@ for LINE in "${CTLINES[@]}"; do
if [[ -n "${WAS_STOPPED[$CTID]:-}" ]]; then
header_info
echo -e "${BL}[Info]${GN} Starting $CTID ($NAME) for trim...${CL}"
if ! start_output=$(pct start "$CTID" 2>&1); then
echo -e "${RD}$CTID ($NAME) did not start, skipping it: ${start_output}${CL}"
echo "$(date '+%Y-%m-%d %H:%M:%S') | CTID=$CTID | Name=$NAME | skipped, did not start: ${start_output//$'\n'/ }" >>"$LOGFILE"
NOT_STARTED+=("$CTID ($NAME)")
sleep 1
continue
fi
pct start "$CTID"
sleep 2
else
header_info
@@ -196,9 +189,6 @@ for LINE in "${CTLINES[@]}"; do
done
header_info
if [ ${#NOT_STARTED[@]} -gt 0 ]; then
echo -e "${RD}Not trimmed, did not start: ${NOT_STARTED[*]}${CL}\n"
fi
echo -e "${GN}Finished, LXC Containers Trimmed.${CL} \n"
echo -e "${BL}If you want to see the complete log: cat $LOGFILE${CL}"
exit 0
+10 -29
View File
@@ -15,10 +15,7 @@ set -Eeuo pipefail
APP="Scrutiny-Collector"
APP_TYPE="tools"
BIN_DIR="/usr/local/bin"
# TrueNAS SCALE mounts /usr read-only.
[[ -w "$BIN_DIR" ]] || BIN_DIR="/var/lib/scrutiny"
BIN="${BIN_DIR}/scrutiny-collector-metrics"
BIN="/usr/local/bin/scrutiny-collector-metrics"
CONFIG_DIR="/etc/scrutiny"
CONFIG="${CONFIG_DIR}/collector.yaml"
SERVICE="scrutiny-collector"
@@ -26,22 +23,6 @@ REPO="AnalogJ/scrutiny"
header_info
function require_tool() {
local cmd="$1" pkg="$2"
command -v "$cmd" &>/dev/null && return 0
# TrueNAS SCALE replaces apt with a stub that refuses to run.
if ! apt-get --version &>/dev/null; then
msg_error "${cmd} is missing and apt cannot install ${pkg} on this host. Install ${pkg}, then run this again."
exit 1
fi
msg_info "Installing ${pkg}"
if ! $STD apt install -y "$pkg"; then
msg_error "apt could not install ${pkg}. Run 'apt install ${pkg}' to see why."
exit 1
fi
msg_ok "Installed ${pkg}"
}
if [[ "$(id -u)" -ne 0 ]]; then
msg_error "Run this as root (sudo) on the machine that has the disks."
exit 1
@@ -49,11 +30,14 @@ fi
if systemd-detect-virt -cq 2>/dev/null; then
msg_warn "This looks like a container: only disks passed through to it can be read."
fi
require_tool whiptail whiptail
if ! command -v apt &>/dev/null; then
msg_error "This tool needs a Debian or Ubuntu based host (apt)."
exit 1
fi
command -v whiptail &>/dev/null || $STD apt install -y whiptail
function deploy_binary() {
# uname, not dpkg: the dpkg stub on TrueNAS SCALE prints a notice that would be read as the architecture.
fetch_and_deploy_gh_release "scrutiny-collector-metrics" "$REPO" "singlefile" "latest" "$BIN_DIR" "scrutiny-collector-metrics-linux-$(PCT_ARCH="$(uname -m)" arch_resolve "amd64" "arm64")"
fetch_and_deploy_gh_release "scrutiny-collector-metrics" "$REPO" "singlefile" "latest" "/usr/local/bin" "scrutiny-collector-metrics-linux-$(arch_resolve "amd64" "arm64")"
# Only catch_errors' on_exit clears this marker, and tools run without it.
rm -f ~/.scrutiny-collector-metrics.pending
}
@@ -76,8 +60,9 @@ function install_collector() {
msg_warn "Scrutiny does not answer at ${url}/api/health yet; the collector will retry every 15 minutes."
fi
require_tool smartctl smartmontools
msg_ok "Using $(smartctl --version 2>/dev/null | awk 'NR==1 {print $1, $2}')"
msg_info "Installing smartmontools"
$STD apt install -y smartmontools
msg_ok "Installed smartmontools"
deploy_binary
@@ -120,9 +105,6 @@ EOF
echo ""
msg_ok "The disks of $(hostname) show up in Scrutiny at ${BL}${url}${CL} after the first run."
msg_ok "Follow it with: ${BL}journalctl -u ${SERVICE} -f${CL}"
if command -v midclt &>/dev/null; then
msg_warn "A TrueNAS update replaces /etc and /var, which removes the collector: run this again after each update."
fi
}
function update_collector() {
@@ -140,7 +122,6 @@ function uninstall_collector() {
systemctl stop ${SERVICE}.service 2>/dev/null || true
rm -f /etc/systemd/system/${SERVICE}.service /etc/systemd/system/${SERVICE}.timer "$BIN" ~/.scrutiny-collector-metrics
rm -rf "$CONFIG_DIR"
[[ "$BIN_DIR" == /usr/local/bin ]] || rmdir "$BIN_DIR" 2>/dev/null || true
systemctl daemon-reload
msg_ok "Removed ${APP} (smartmontools stays installed)"
}
+1 -7
View File
@@ -275,8 +275,7 @@ function dry_run_container() {
function failure_reason() {
local reason
reason=$(grep -m1 '^ERROR:' <<<"$1" | sed 's/^ERROR: //')
# A rejected option ends in the usage line, the option's error is above it.
[[ -n "$reason" ]] || reason=$(grep -v -e '^[[:space:]]*$' -e '\[OPTIONS\]$' <<<"$1" | tail -n1)
[[ -n "$reason" ]] || reason=$(grep -v '^[[:space:]]*$' <<<"$1" | tail -n1)
printf '%s' "$reason"
}
@@ -287,11 +286,6 @@ function backup_container() {
msg_ok "Backup created"
else
log_write "Container $1: vzdump failed:"$'\n'"$output"
# Ctrl+C, or the task was stopped: the backup did not fail, it was cancelled.
if grep -q "interrupted by signal" <<<"$output"; then
msg_error "Backup of container $1 was interrupted (Ctrl+C or the task was stopped)"
exit 130
fi
msg_error "Backup failed for container $1: $(failure_reason "$output")"
exit 235
fi
+8 -39
View File
@@ -48,11 +48,6 @@ while read -r TAG ITEM; do
done < <(pct list | awk 'NR>1')
excluded_containers=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "Containers on $NODE" --checklist "\nSelect containers to skip from updates:\n" 16 $((MSG_MAX_LENGTH + 23)) 6 "${EXCLUDE_MENU[@]}" 3>&1 1>&2 2>&3 | tr -d '"')
# The failing containers' output, for the user and for the telemetry trace.
RUN_LOG="/tmp/update-lxcs-$(date +%Y%m%d_%H%M%S).log"
SILENT_LOGFILE="$RUN_LOG"
UPDATE_OUTPUT=$(mktemp)
function needs_reboot() {
local container=$1
local os=$(pct config "$container" | awk '/^ostype/ {print $2}')
@@ -83,21 +78,9 @@ function update_container() {
alpine) pct exec "$container" -- ash -c "apk -U upgrade" ;;
archlinux) pct exec "$container" -- bash -c "pacman -Syyu --noconfirm" ;;
fedora | rocky | centos | alma) pct exec "$container" -- bash -c "dnf -y update && dnf -y upgrade" ;;
ubuntu | debian | devuan) pct exec "$container" -- bash -c "apt-get update 2>/dev/null | grep 'packages.*upgraded'; apt list --upgradable 2>/dev/null | cat && apt-get -yq dist-upgrade 2>&1; rc=\$?; apt-get -yq autoremove 2>&1; apt-get -yq autoclean 2>&1; rm -rf /usr/lib/python3.*/EXTERNALLY-MANAGED; exit \$rc" ;;
ubuntu | debian | devuan) pct exec "$container" -- bash -c "apt-get update 2>/dev/null | grep 'packages.*upgraded'; apt list --upgradable 2>/dev/null | cat && apt-get -yq dist-upgrade 2>&1; apt-get -yq autoremove 2>&1; apt-get -yq autoclean 2>&1; rm -rf /usr/lib/python3.*/EXTERNALLY-MANAGED || true" ;;
opensuse) pct exec "$container" -- bash -c "zypper ref && zypper --non-interactive dup" ;;
esac 2>&1 | tee "$UPDATE_OUTPUT"
}
# record_failure <ctid> <what> [output file] - adds the output's last error line
function record_failure() {
local name reason=""
name=$(pct config "$1" 2>/dev/null | awk '/^hostname:/ {print $2}' || true)
if [[ -s "${3:-}" ]]; then
reason=$(sed 's/\x1b\[[0-9;]*[a-zA-Z]//g; s/\r//g' "$3" | grep -E '^(E:|ERROR|Error|error)' | tail -n1 || true)
[[ -n "$reason" ]] || reason=$(sed 's/\x1b\[[0-9;]*[a-zA-Z]//g; s/\r//g' "$3" | grep -v '^[[:space:]]*$' | tail -n1 || true)
{ echo "CT $1${name:+ ($name)}: $2"; tail -n 20 "$3"; echo; } >>"$RUN_LOG"
fi
failed_containers+=("$1${name:+ ($name)}: $2${reason:+ - $reason}")
esac
}
containers_needing_reboot=()
@@ -109,10 +92,7 @@ for container in $(pct list | awk '{if(NR>1) print $1}'); do
echo -e "${BL}[Info]${GN} Skipping ${BL}$container${CL}"
sleep 1
else
if ! status=$(pct status "$container" 2>&1); then
record_failure "$container" "pct status failed: $status"
continue
fi
status=$(pct status $container)
if [ "$SKIP_STOPPED" == "yes" ] && [ "$status" == "status: stopped" ]; then
header_info
echo -e "${BL}[Info]${GN} Skipping ${BL}$container${CL}${GN} (not running)${CL}"
@@ -122,22 +102,17 @@ for container in $(pct list | awk '{if(NR>1) print $1}'); do
template=$(pct config $container | grep -q "template:" && echo "true" || echo "false")
if [ "$template" == "false" ] && [ "$status" == "status: stopped" ]; then
echo -e "${BL}[Info]${GN} Starting${BL} $container ${CL} \n"
if ! pct start "$container" >"$UPDATE_OUTPUT" 2>&1; then
cat "$UPDATE_OUTPUT"
record_failure "$container" "did not start" "$UPDATE_OUTPUT"
if ! pct start $container; then
failed_containers+=("$container (start)")
continue
fi
echo -e "${BL}[Info]${GN} Waiting For${BL} $container${CL}${GN} To Start ${CL} \n"
sleep 5
rc=0
update_container "$container" || rc=$?
[ "$rc" -eq 0 ] || record_failure "$container" "update exited with $rc" "$UPDATE_OUTPUT"
update_container $container || failed_containers+=("$container")
echo -e "${BL}[Info]${GN} Shutting down${BL} $container ${CL} \n"
pct shutdown $container &
elif [ "$status" == "status: running" ]; then
rc=0
update_container "$container" || rc=$?
[ "$rc" -eq 0 ] || record_failure "$container" "update exited with $rc" "$UPDATE_OUTPUT"
update_container $container || failed_containers+=("$container")
fi
if [ "$status" == "status: running" ]; then
if pct exec "$container" -- [ -e "/var/run/reboot-required" ]; then
@@ -154,13 +129,11 @@ for container in $(pct list | awk '{if(NR>1) print $1}'); do
fi
done
wait
rm -f "$UPDATE_OUTPUT"
header_info
if [ "${#failed_containers[@]}" -gt 0 ]; then
echo -e "${RD}The update failed in these containers:${CL}"
printf '%s\n' "${failed_containers[@]}"
echo ""
[ -s "$RUN_LOG" ] && echo -e "Their output: $RUN_LOG\n"
else
echo -e "${GN}The process is complete, and the containers have been successfully updated.${CL}\n"
fi
@@ -171,8 +144,4 @@ if [ "${#containers_needing_reboot[@]}" -gt 0 ]; then
done
fi
echo ""
if [ "${#failed_containers[@]}" -gt 0 ]; then
printf -v CS_ERROR_MSG '%s; ' "${failed_containers[@]}"
CS_ERROR_MSG="Update failed in ${#failed_containers[@]} container(s): ${CS_ERROR_MSG%; }"
exit 1
fi
[ "${#failed_containers[@]}" -eq 0 ] || exit 1