diff --git a/ct/jellyseerr.sh b/ct/jellyseerr.sh index 96ea2ec817a..66eb632bf6f 100644 --- a/ct/jellyseerr.sh +++ b/ct/jellyseerr.sh @@ -50,17 +50,23 @@ function update_script() { msg_ok "Cleaning up" fi - if ! command -v pnpm &> /dev/null; then - msg_error "pnpm not found. Installing..." - npm install -g pnpm &>/dev/null + cd /opt/jellyseerr + output=$(git pull --no-rebase) + + pnpm_current=$(pnpm --version 2>/dev/null) + pnpm_desired=$(grep -Po '"pnpm":\s*"\K[^"]+' /opt/jellyseerr/package.json) + + if [ -z "$pnpm_current" ]; then + msg_error "pnpm not found. Installing version $pnpm_desired..." + npm install -g pnpm@"$pnpm_desired" &>/dev/null + elif ! node -e "const semver = require('semver'); process.exit(semver.satisfies('$pnpm_current', '$pnpm_desired') ? 0 : 1)" ; then + msg_error "Updating pnpm from version $pnpm_current to $pnpm_desired..." + npm install -g pnpm@"$pnpm_desired" &>/dev/null else - msg_ok "pnpm is already installed." + msg_ok "pnpm is already installed and satisfies version $pnpm_desired." fi msg_info "Updating $APP" - cd /opt/jellyseerr - output=$(git pull --no-rebase) - if echo "$output" | grep -q "Already up to date."; then msg_ok "$APP is already up to date." exit @@ -102,4 +108,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 "${TAB}${GATEWAY}${BGN}http://${IP}:5055${CL}" \ No newline at end of file +echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:5055${CL}" diff --git a/install/jellyseerr-install.sh b/install/jellyseerr-install.sh index 916f1afc1e7..e42d32ce796 100644 --- a/install/jellyseerr-install.sh +++ b/install/jellyseerr-install.sh @@ -32,14 +32,16 @@ $STD apt-get update $STD apt-get install -y nodejs msg_ok "Installed Node.js" -msg_info "Installing pnpm" -$STD npm install -g pnpm -msg_ok "Installed pnpm" - -msg_info "Installing Jellyseerr (Patience)" git clone -q https://github.com/Fallenbagel/jellyseerr.git /opt/jellyseerr cd /opt/jellyseerr $STD git checkout main + +pnpm_desired=$(grep -Po '"pnpm":\s*"\K[^"]+' /opt/jellyseerr/package.json) +msg_info "Installing pnpm version $pnpm_desired..." +$STD npm install -g pnpm@$pnpm_desired +msg_ok "Installed pnpm" + +msg_info "Installing Jellyseerr (Patience)" export CYPRESS_INSTALL_BINARY=0 $STD pnpm install --frozen-lockfile export NODE_OPTIONS="--max-old-space-size=3072"