Compare commits

..

1 Commits

Author SHA1 Message Date
MickLesk
ec10fdbb0e sabnzbd: stop an optional extra from aborting the update
par2cmdline-turbo is optional - the install asks <y/N> for it - but its
update ran first, unguarded, under catch_errors. When the release lookup
failed the ERR trap took the whole run down and SABnzbd itself was never
updated:

  No matching release found for animetosho/par2cmdline-turbo
  in line 2085: exit code 250

The asset it asks for exists and the release query resolves v1.5.0
against live data, so that lookup failed transiently. Whatever the
reason, an optional component must not be able to block the main
update.

Move it behind the installation check so a missing /opt/sabnzbd is
reported first, and warn instead of aborting when the lookup fails. The
installed par2 binary simply stays as it is.
2026-09-18 08:09:40 +02:00
3 changed files with 65 additions and 17 deletions

View File

@@ -10,8 +10,8 @@ source "$_cs_boot" 2>/dev/null || source <(curl -fsSL "${COMMUNITY_SCRIPTS_CORE_
APP="OxiCloud"
var_tags="${var_tags:-files;documents}"
var_cpu="${var_cpu:-2}"
var_ram="${var_ram:-2048}"
var_cpu="${var_cpu:-4}"
var_ram="${var_ram:-6144}"
var_disk="${var_disk:-20}"
var_os="${var_os:-debian}"
var_version="${var_version:-13}"
@@ -33,19 +33,42 @@ function update_script() {
exit
fi
ensure_dependencies ffmpeg
NODE_VERSION="26" setup_nodejs
if check_for_gh_release "OxiCloud" "DioCrafts/OxiCloud"; then
msg_info "Stopping OxiCloud"
systemctl stop oxicloud
msg_ok "Stopped OxiCloud"
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "OxiCloud" "DioCrafts/OxiCloud" "prebuild" "latest" "/opt/oxicloud" "oxicloud-*-$(arch_resolve x86_64 aarch64)-unknown-linux-musl.tar.gz"
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "OxiCloud" "DioCrafts/OxiCloud" "tarball" "latest" "/opt/oxicloud"
TOOLCHAIN="$(grep -oP 'FROM\s+rust:\K[0-9]+\.[0-9]+(\.[0-9]+)?' /opt/oxicloud/Dockerfile | head -1)"
RUST_TOOLCHAIN="${TOOLCHAIN:-stable}" setup_rust
msg_info "Updating OxiCloud"
install -m 755 /opt/oxicloud/oxicloud /usr/local/bin/oxicloud
rm -f /usr/local/bin/migrate-nfc-filenames /usr/bin/oxicloud
sed -i 's|^OXICLOUD_STATIC_PATH=|#OXICLOUD_STATIC_PATH=|' /etc/oxicloud/.env
msg_info "Building Frontend SPA"
cd /opt/oxicloud/frontend
$STD npm ci
$STD npm run build
msg_ok "Built Frontend SPA"
msg_info "Updating OxiCloud (Patience)"
set -a
source /etc/oxicloud/.env
set +a
cd /opt/oxicloud
export DATABASE_URL
export RUSTFLAGS="-C target-cpu=native"
RAM_MB=$(awk '/MemTotal/ {print int($2/1024)}' /proc/meminfo)
CARGO_JOBS=$((RAM_MB / 2560))
[[ $CARGO_JOBS -lt 1 ]] && CARGO_JOBS=1
[[ $CARGO_JOBS -gt $(nproc) ]] && CARGO_JOBS=$(nproc)
$STD cargo build --release -j "$CARGO_JOBS" --bin oxicloud --bin migrate-nfc-filenames
mv target/release/oxicloud /usr/local/bin/oxicloud
mv target/release/migrate-nfc-filenames /usr/local/bin/migrate-nfc-filenames
chmod +x /usr/local/bin/oxicloud /usr/local/bin/migrate-nfc-filenames
rm -f /usr/bin/oxicloud
rm -rf /opt/oxicloud/static
mv /opt/oxicloud/static-dist /opt/oxicloud/static
rm -rf /opt/oxicloud/target /opt/oxicloud/frontend/node_modules
msg_ok "Updated OxiCloud"
msg_info "Starting OxiCloud"

View File

@@ -27,14 +27,16 @@ function update_script() {
check_container_storage
check_container_resources
if par2 --version | grep -q "par2cmdline-turbo"; then
fetch_and_deploy_gh_release "par2cmdline-turbo" "animetosho/par2cmdline-turbo" "prebuild" "latest" "/usr/bin/" "*-linux-$(arch_resolve).zip"
fi
if [[ ! -d /opt/sabnzbd ]]; then
msg_error "No ${APP} Installation Found!"
exit
fi
if par2 --version 2>/dev/null | grep -q "par2cmdline-turbo"; then
if ! fetch_and_deploy_gh_release "par2cmdline-turbo" "animetosho/par2cmdline-turbo" "prebuild" "latest" "/usr/bin/" "*-linux-$(arch_resolve).zip"; then
msg_warn "Could not update par2cmdline-turbo, keeping the installed version"
fi
fi
if check_for_gh_release "sabnzbd-org" "sabnzbd/sabnzbd"; then
PYTHON_VERSION="3.13" setup_uv
systemctl stop sabnzbd

View File

@@ -14,20 +14,43 @@ network_check
update_os
msg_info "Installing Dependencies"
$STD apt install -y ffmpeg
$STD apt install -y build-essential
msg_ok "Installed Dependencies"
NODE_VERSION="26" setup_nodejs
PG_VERSION="17" setup_postgresql
PG_DB_NAME="oxicloud" PG_DB_USER="oxicloud" setup_postgresql_db
fetch_and_deploy_gh_release "OxiCloud" "DioCrafts/OxiCloud" "prebuild" "latest" "/opt/oxicloud" "oxicloud-*-$(arch_resolve x86_64 aarch64)-unknown-linux-musl.tar.gz"
install -m 755 /opt/oxicloud/oxicloud /usr/local/bin/oxicloud
fetch_and_deploy_gh_release "OxiCloud" "DioCrafts/OxiCloud" "tarball" "latest" "/opt/oxicloud"
TOOLCHAIN="$(grep -oP 'FROM\s+rust:\K[0-9]+\.[0-9]+(\.[0-9]+)?' /opt/oxicloud/Dockerfile | head -1)"
RUST_TOOLCHAIN="${TOOLCHAIN:-stable}" setup_rust
msg_info "Building Frontend SPA"
cd /opt/oxicloud/frontend
$STD npm ci
$STD npm run build
msg_ok "Built Frontend SPA"
msg_info "Building OxiCloud (Patience)"
cd /opt/oxicloud
export DATABASE_URL="postgres://${PG_DB_USER}:${PG_DB_PASS}@localhost/${PG_DB_NAME}"
export RUSTFLAGS="-C target-cpu=native"
RAM_MB=$(awk '/MemTotal/ {print int($2/1024)}' /proc/meminfo)
CARGO_JOBS=$((RAM_MB / 2560))
[[ $CARGO_JOBS -lt 1 ]] && CARGO_JOBS=1
[[ $CARGO_JOBS -gt $(nproc) ]] && CARGO_JOBS=$(nproc)
$STD cargo build --release -j "$CARGO_JOBS" --bin oxicloud --bin migrate-nfc-filenames
mv target/release/oxicloud /usr/local/bin/oxicloud
mv target/release/migrate-nfc-filenames /usr/local/bin/migrate-nfc-filenames
rm -rf /opt/oxicloud/static
mv /opt/oxicloud/static-dist /opt/oxicloud/static
rm -rf /opt/oxicloud/target /opt/oxicloud/frontend/node_modules
msg_ok "Built OxiCloud"
msg_info "Configuring OxiCloud"
mkdir -p {/mnt/oxicloud,/etc/oxicloud}
DATABASE_URL="postgres://${PG_DB_USER}:${PG_DB_PASS}@localhost/${PG_DB_NAME}"
sed -e 's|OXICLOUD_STORAGE_PATH=.*|OXICLOUD_STORAGE_PATH=/mnt/oxicloud|' \
-e 's|OXICLOUD_SERVER_HOST=.*|OXICLOUD_SERVER_HOST=0.0.0.0|' \
-e 's|^OXICLOUD_STATIC_PATH=|#OXICLOUD_STATIC_PATH=|' \
-e 's|OXICLOUD_STATIC_PATH=.*|OXICLOUD_STATIC_PATH=/opt/oxicloud/static|' \
-e "s|^#OXICLOUD_BASE_URL=.*|OXICLOUD_BASE_URL=http://${LOCAL_IP}:8086|" \
-e "s|OXICLOUD_DB_CONNECTION_STRING=.*|OXICLOUD_DB_CONNECTION_STRING=${DATABASE_URL}|" \
-e "s|^DATABASE_URL=.*|DATABASE_URL=${DATABASE_URL}|" \