Last active 3 weeks ago

immich_version_checker.sh Raw
1#!/bin/bash
2
3set -euo pipefail
4
5API_URL="http://localhost:2283/api/server/version-check"
6# API Key med bare les på server.versionCheck
7# Account Settings -> API Keys -> + New API Key -> velg
8API_KEY="696969696969696969696969"
9GITHUB_URL="https://api.github.com/repos/immich-app/immich/releases/latest"
10
11get_local_version() {
12 curl -fsS -H "x-api-key: $API_KEY" "$API_URL" | jq -r '.releaseVersion'
13}
14
15get_latest_version() {
16 curl -fsS "$GITHUB_URL" jq -r '.tag_name'
17}
18
19LOCAL=$(get_local_version)
20LATEST=$(get_latest_version)
21
22printf "Local : %s\n" "$LOCAL"
23printf "Latest: %s\n" "$LATEST"
24
25if [[ "$LOCAL" != "$LATEST" ]]; then
26 echo "New version available!!"
27 exit 1
28else
29 echo "Up to date"
30 exit 0
31fi
32