Last active
January 20, 2024 18:44
-
-
Save erikvanoosten/3991fff2ea17c1e40d062f234009ce00 to your computer and use it in GitHub Desktop.
Update Immich
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -euo pipefail | |
IFS=$'\n\t' | |
CURRENT_VERSION=$(grep IMMICH_VERSION= .env | awk -F= '{print $2}') | |
echo "Getting latest version of Immich..." | |
LATEST_VERSION=$(curl -s --include https://github.com/immich-app/immich/releases/latest | grep 'location:' | awk -F/ '{print $NF}') | |
# Remove DOS line end | |
LATEST_VERSION=${LATEST_VERSION//[$'\t\r\n ']} | |
if [[ "$CURRENT_VERSION" = "$LATEST_VERSION" ]]; then | |
echo "Up to date" | |
exit | |
fi | |
echo "Update from ${CURRENT_VERSION} to ${LATEST_VERSION}?" | |
select us in "Update" "Skip"; do | |
case $us in | |
Update ) break;; | |
Skip ) echo Skipping; exit;; | |
esac | |
done | |
# See https://stackoverflow.com/a/73427527 | |
export COMPOSE_PROJECT_NAME=immich | |
echo "Updating Immich..." | |
sed -i "s/IMMICH_VERSION=$CURRENT_VERSION/IMMICH_VERSION=$LATEST_VERSION/" .env | |
docker-compose pull && docker-compose up -d | |
echo "Done updating Immich" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment