@@ -50,17 +50,23 @@ function update_script() {
5050 msg_ok " Cleaning up"
5151 fi
5252
53- if ! command -v pnpm & > /dev/null; then
54- msg_error " pnpm not found. Installing..."
55- npm install -g pnpm & > /dev/null
53+ cd /opt/jellyseerr
54+ output=$( git pull --no-rebase)
55+
56+ pnpm_current=$( pnpm --version 2> /dev/null)
57+ pnpm_desired=$( grep -Po ' "pnpm":\s*"\K[^"]+' /opt/jellyseerr/package.json)
58+
59+ if [ -z " $pnpm_current " ]; then
60+ msg_error " pnpm not found. Installing version $pnpm_desired ..."
61+ npm install -g pnpm@" $pnpm_desired " & > /dev/null
62+ elif ! node -e " const semver = require('semver'); process.exit(semver.satisfies('$pnpm_current ', '$pnpm_desired ') ? 0 : 1)" ; then
63+ msg_error " Updating pnpm from version $pnpm_current to $pnpm_desired ..."
64+ npm install -g pnpm@" $pnpm_desired " & > /dev/null
5665 else
57- msg_ok " pnpm is already installed."
66+ msg_ok " pnpm is already installed and satisfies version $pnpm_desired ."
5867 fi
5968
6069 msg_info " Updating $APP "
61- cd /opt/jellyseerr
62- output=$( git pull --no-rebase)
63-
6470 if echo " $output " | grep -q " Already up to date." ; then
6571 msg_ok " $APP is already up to date."
6672 exit
@@ -102,4 +108,4 @@ description
102108msg_ok " Completed Successfully!\n"
103109echo -e " ${CREATING}${GN}${APP} setup has been successfully initialized!${CL} "
104110echo -e " ${INFO}${YW} Access it using the following URL:${CL} "
105- echo -e " ${TAB}${GATEWAY}${BGN} http://${IP} :5055${CL} "
111+ echo -e " ${TAB}${GATEWAY}${BGN} http://${IP} :5055${CL} "
0 commit comments