various scripts: use ensure_dependencies instead of apt (#11463)

* refactor(ct): replace apt install with ensure_dependencies in update_script functions

* refactor(ct): replace remaining apt install with ensure_dependencies

* refactor(ct): replace remaining apt install with ensure_dependencies

* refactor(ct): remove redundant dpkg checks before ensure_dependencies

* refactor(ct): remove ALL redundant checks before ensure_dependencies

* Update neo4j.sh
This commit is contained in:
CanbiZ (MickLesk)
2026-02-02 13:01:17 +01:00
committed by GitHub
parent ac74b760f0
commit 7fc77fe5be
27 changed files with 33 additions and 99 deletions

View File

@@ -27,10 +27,7 @@ function update_script() {
msg_error "No ${APP} Installation Found!"
exit
fi
if ! command -v memcached >/dev/null 2>&1; then
$STD apt update
$STD apt install -y memcached libmemcached-tools
fi
ensure_dependencies memcached libmemcached-tools
if check_for_gh_release "adventurelog" "seanmorley15/adventurelog"; then
msg_info "Stopping Services"
systemctl stop adventurelog-backend

View File

@@ -31,11 +31,7 @@ function update_script() {
NODE_VERSION="22" NODE_MODULE="@postlight/parser@latest,single-file-cli@latest" setup_nodejs
PYTHON_VERSION="3.13" setup_uv
if ! dpkg -l | grep -q "^ii chromium "; then
msg_info "Installing System Dependencies"
$STD apt-get install -y chromium
msg_ok "Installed System Dependencies"
fi
ensure_dependencies chromium
msg_info "Stopping Service"
systemctl stop archivebox

View File

@@ -29,12 +29,7 @@ function update_script() {
exit
fi
if ! dpkg -s libjpeg-dev >/dev/null 2>&1; then
msg_info "Installing Dependencies"
$STD apt-get update
$STD apt-get install -y libjpeg-dev
msg_ok "Updated Dependencies"
fi
ensure_dependencies libjpeg-dev
NODE_VERSION="24" setup_nodejs

View File

@@ -34,12 +34,7 @@ function update_script() {
systemctl stop commafeed
msg_ok "Stopped Service"
if ! [[ $(dpkg -s rsync 2>/dev/null) ]]; then
msg_info "Installing Dependencies"
$STD apt update
$STD apt install -y rsync
msg_ok "Installed Dependencies"
fi
ensure_dependencies rsync
if [ -d /opt/commafeed/data ] && [ "$(ls -A /opt/commafeed/data)" ]; then
msg_info "Backing up existing data"

View File

@@ -44,10 +44,7 @@ function update_script() {
NODE_VERSION="22" setup_nodejs
if check_for_gh_release "cronicle" "jhuckaby/Cronicle"; then
msg_info "Installing Dependencies"
$STD apt install -y \
git \
build-essential \
ca-certificates
ensure_dependencies git build-essential ca-certificates
msg_ok "Installed Dependencies"
NODE_VERSION="22" setup_nodejs

View File

@@ -38,9 +38,7 @@ function update_script() {
systemctl reload nginx
fi
if ! dpkg -s vlc-bin vlc-plugin-base &>/dev/null; then
$STD apt update && $STD apt install -y vlc-bin vlc-plugin-base
fi
ensure_dependencies vlc-bin vlc-plugin-base
if check_for_gh_release "Dispatcharr" "Dispatcharr/Dispatcharr"; then
msg_info "Stopping Services"

View File

@@ -43,9 +43,7 @@ function update_script() {
msg_error "Project directory does not exist: $PROJECT_DIR"
exit
fi
if ! command -v git &>/dev/null; then
$STD apt install -y git
fi
ensure_dependencies git
msg_info "Stopping service $SERVICE_NAME"
systemctl stop "$SERVICE_NAME"

View File

@@ -45,7 +45,7 @@ function update_script() {
curl -fsSL "https://packages.graylog2.org/repo/packages/graylog-7.0-repository_latest.deb" -o "graylog-7.0-repository_latest.deb"
$STD dpkg -i graylog-7.0-repository_latest.deb
$STD apt update
$STD apt install -y graylog-server graylog-datanode
ensure_dependencies graylog-server graylog-datanode
rm -f graylog-7.0-repository_latest.deb
msg_ok "Updated Graylog"
elif dpkg --compare-versions "$CURRENT_VERSION" ge "7.0"; then

View File

@@ -30,14 +30,7 @@ function update_script() {
get_lxc_ip
NODE_VERSION="22" NODE_MODULE="pnpm@latest" setup_nodejs
if ! command -v jq &>/dev/null; then
$STD msg_info "Installing jq..."
$STD apt-get update -qq &>/dev/null
$STD apt-get install -y jq &>/dev/null || {
msg_error "Failed to install jq"
exit
}
fi
ensure_dependencies jq
if check_for_gh_release "homepage" "gethomepage/homepage"; then
msg_info "Stopping service"

View File

@@ -67,8 +67,7 @@ EOF
msg_info "Installing Mise"
curl -fSs https://mise.jdx.dev/gpg-key.pub | tee /etc/apt/keyrings/mise-archive-keyring.pub 1>/dev/null
echo "deb [signed-by=/etc/apt/keyrings/mise-archive-keyring.pub arch=amd64] https://mise.jdx.dev/deb stable main" >/etc/apt/sources.list.d/mise.list
$STD apt update
$STD apt install -y mise
ensure_dependencies mise
msg_ok "Installed Mise"
fi
@@ -134,9 +133,8 @@ EOF
$STD sudo -u postgres psql -d immich -c "REINDEX INDEX face_index;"
$STD sudo -u postgres psql -d immich -c "REINDEX INDEX clip_index;"
fi
if ! dpkg -l | grep -q ccache; then
$STD apt install -yqq ccache
fi
ensure_dependencies ccache
INSTALL_DIR="/opt/${APP}"
UPLOAD_DIR="$(sed -n '/^IMMICH_MEDIA_LOCATION/s/[^=]*=//p' /opt/immich/.env)"
@@ -304,10 +302,7 @@ function compile_libjxl() {
function compile_libheif() {
SOURCE=${SOURCE_DIR}/libheif
if ! dpkg -l | grep -q libaom; then
$STD apt install -y libaom-dev
local update="required"
fi
ensure_dependencies libaom-dev
: "${LIBHEIF_REVISION:=$(jq -cr '.revision' "$BASE_DIR"/server/sources/libheif.json)}"
if [[ "${update:-}" ]] || [[ "$LIBHEIF_REVISION" != "$(grep 'libheif' ~/.immich_library_revisions | awk '{print $2}')" ]]; then
msg_info "Recompiling libheif"

View File

@@ -40,9 +40,7 @@ function update_script() {
fi
msg_info "Updating Jellyfin"
if ! dpkg -s libjemalloc2 >/dev/null 2>&1; then
$STD apt install -y libjemalloc2
fi
ensure_dependencies libjemalloc2
if [[ ! -f /usr/lib/libjemalloc.so ]]; then
ln -sf /usr/lib/x86_64-linux-gnu/libjemalloc.so.2 /usr/lib/libjemalloc.so
fi

View File

@@ -38,7 +38,7 @@ function update_script() {
msg_ok "Updated yt-dlp"
msg_info "Prepare update"
$STD apt install -y graphicsmagick ghostscript
ensure_dependencies graphicsmagick ghostscript
if [[ -f /opt/karakeep/.env ]] && [[ ! -f /etc/karakeep/karakeep.env ]]; then
mkdir -p /etc/karakeep
mv /opt/karakeep/.env /etc/karakeep/karakeep.env

View File

@@ -23,9 +23,7 @@ function update_script() {
header_info
check_container_storage
check_container_resources
if ! command -v lsb_release; then
apt install -y lsb-release
fi
ensure_dependencies lsb-release
if [[ ! -d /opt/kimai ]]; then
msg_error "No ${APP} Installation Found!"
exit

View File

@@ -27,9 +27,8 @@ function update_script() {
msg_error "No ${APP} Installation Found!"
exit
fi
if ! dpkg -l | grep -q temurin-21-jre; then
JAVA_VERSION="21" setup_java
fi
msg_info "Updating ${APP}"
$STD apt update
$STD apt -y upgrade

View File

@@ -36,12 +36,7 @@ function update_script() {
NODE_VERSION="24" setup_nodejs
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "scanopy" "scanopy/scanopy" "tarball" "latest" "/opt/scanopy"
if ! dpkg -l | grep -q "pkg-config"; then
$STD apt install -y pkg-config
fi
if ! dpkg -l | grep -q "libssl-dev"; then
$STD apt install -y libssl-dev
fi
ensure_dependencies pkg-config libssl-dev
TOOLCHAIN="$(grep "channel" /opt/scanopy/backend/rust-toolchain.toml | awk -F\" '{print $2}')"
RUST_TOOLCHAIN=$TOOLCHAIN setup_rust

View File

@@ -28,8 +28,8 @@ function update_script() {
msg_error "No ${APP} Installation Found!"
exit
fi
ensure_dependencies python3-lxml
if ! [[ $(dpkg -s python3-lxml-html-clean 2>/dev/null) ]]; then
$STD apt install python3-lxml
curl -fsSL "http://archive.ubuntu.com/ubuntu/pool/universe/l/lxml-html-clean/python3-lxml-html-clean_0.1.1-1_all.deb" -o /opt/python3-lxml-html-clean.deb
$STD dpkg -i /opt/python3-lxml-html-clean.deb
rm -f /opt/python3-lxml-html-clean.deb

View File

@@ -32,11 +32,7 @@ function update_script() {
if [[ ! -f /opt/Ollama_version.txt ]]; then
touch /opt/Ollama_version.txt
fi
if ! command -v zstd &>/dev/null; then
msg_info "Installing zstd"
$STD apt install -y zstd
msg_ok "Installed zstd"
fi
ensure_dependencies zstd
msg_info "Stopping Services"
systemctl stop ollama
msg_ok "Services Stopped"

View File

@@ -92,11 +92,7 @@ EOF
OLLAMA_VERSION=$(ollama -v | awk '{print $NF}')
RELEASE=$(curl -s https://api.github.com/repos/ollama/ollama/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4)}')
if [ "$OLLAMA_VERSION" != "$RELEASE" ]; then
if ! command -v zstd &>/dev/null; then
msg_info "Installing zstd"
$STD apt install -y zstd
msg_ok "Installed zstd"
fi
ensure_dependencies zstd
msg_info "Ollama update available: v$OLLAMA_VERSION -> v$RELEASE"
msg_info "Downloading Ollama v$RELEASE \n"
curl -fS#LO https://github.com/ollama/ollama/releases/download/v${RELEASE}/ollama-linux-amd64.tar.zst

View File

@@ -69,7 +69,7 @@ function update_script() {
if [ "$VERSION_CODENAME" = "bookworm" ]; then
setup_gs
else
$STD apt install -y ghostscript
ensure_dependencies ghostscript
fi
msg_info "Updating Paperless-ngx"
@@ -145,7 +145,7 @@ function update_script() {
setup_gs
else
msg_info "Installing Ghostscript"
$STD apt install -y ghostscript
ensure_dependencies ghostscript
msg_ok "Installed Ghostscript"
fi

View File

@@ -45,7 +45,7 @@ function update_script() {
LIBHEIF_URL=$(curl -fsSL "https://dl.photoprism.app/dist/libheif/" | grep -oP "libheif-bookworm-amd64-v[0-9\.]+\.tar\.gz" | sort -V | tail -n 1)
if [[ "${LIBHEIF_URL}" != "$(cat ~/.photoprism_libheif 2>/dev/null)" ]] || [[ ! -f ~/.photoprism_libheif ]]; then
msg_info "Updating PhotoPrism LibHeif"
$STD apt install -y libvips42
ensure_dependencies libvips42
curl -fsSL "https://dl.photoprism.app/dist/libheif/$LIBHEIF_URL" -o /tmp/libheif.tar.gz
tar -xzf /tmp/libheif.tar.gz -C /usr/local
ldconfig

View File

@@ -41,7 +41,7 @@ function update_script() {
cp -R /opt/rdtc-backup/appsettings.json /opt/rdtc/
if dpkg-query -W dotnet-sdk-8.0 >/dev/null 2>&1; then
$STD apt remove --purge -y dotnet-sdk-8.0
$STD apt install -y aspnetcore-runtime-9.0
ensure_dependencies aspnetcore-runtime-9.0
fi
rm -rf /opt/rdtc-backup

View File

@@ -42,12 +42,7 @@ function update_script() {
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "scanopy" "scanopy/scanopy" "tarball" "latest" "/opt/scanopy"
if ! dpkg -l | grep -q "pkg-config"; then
$STD apt install -y pkg-config
fi
if ! dpkg -l | grep -q "libssl-dev"; then
$STD apt install -y libssl-dev
fi
ensure_dependencies pkg-config libssl-dev
TOOLCHAIN="$(grep "channel" /opt/scanopy/backend/rust-toolchain.toml | awk -F\" '{print $2}')"
RUST_TOOLCHAIN=$TOOLCHAIN setup_rust

View File

@@ -30,8 +30,7 @@ function update_script() {
fi
msg_info "Updating ${APP}"
$STD apt update
$STD apt install -yq twingate-connector
ensure_dependencies twingate-connector
$STD systemctl restart twingate-connector
msg_ok "Updated successfully!"
exit

View File

@@ -32,7 +32,7 @@ function update_script() {
msg_info "Updating ${APP}"
$STD apt update --allow-releaseinfo-change
$STD apt install -y unifi
ensure_dependencies unifi
msg_ok "Updated successfully!"
exit
}

View File

@@ -30,12 +30,9 @@ function update_script() {
NODE_VERSION="22" setup_nodejs
if ! dpkg -s chromium >/dev/null 2>&1; then
msg_info "Installing Chromium"
$STD apt update
$STD apt install -y chromium
ensure_dependencies chromium
if [[ ! -L /opt/uptime-kuma/chromium ]]; then
ln -s /usr/bin/chromium /opt/uptime-kuma/chromium
msg_ok "Installed Chromium"
fi
if check_for_gh_release "uptime-kuma" "louislam/uptime-kuma"; then

View File

@@ -86,7 +86,7 @@ function update_script() {
if [ "$UPD" == "3" ]; then
if NEWTOKEN=$(whiptail --backtitle "Proxmox VE Helper Scripts" --passwordbox "Set the ADMIN_TOKEN" 10 58 3>&1 1>&2 2>&3); then
if [[ -z "$NEWTOKEN" ]]; then exit; fi
if ! command -v argon2 >/dev/null 2>&1; then $STD apt-get install -y argon2; fi
ensure_dependencies argon2
TOKEN=$(echo -n "${NEWTOKEN}" | argon2 "$(openssl rand -base64 32)" -t 2 -m 16 -p 4 -l 64 -e)
sed -i "s|ADMIN_TOKEN=.*|ADMIN_TOKEN='${TOKEN}'|" /opt/vaultwarden/.env
if [[ -f /opt/vaultwarden/data/config.json ]]; then

View File

@@ -27,10 +27,7 @@ function update_script() {
msg_error "No ${APP} Installation Found!"
exit
fi
if ! [[ $(dpkg -s zstd 2>/dev/null) ]]; then
$STD apt update
$STD apt install -y zstd
fi
ensure_dependencies zstd
RELEASE=$(curl -fsSL https://api.github.com/repos/matze/wastebin/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
# Dirty-Fix 03/2025 for missing APP_version.txt on old installations, set to pre-latest release
msg_info "Running Migration"