Skip to content

Instantly share code, notes, and snippets.

@erikvanoosten
Last active January 20, 2024 18:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save erikvanoosten/3991fff2ea17c1e40d062f234009ce00 to your computer and use it in GitHub Desktop.
Save erikvanoosten/3991fff2ea17c1e40d062f234009ce00 to your computer and use it in GitHub Desktop.
Update Immich
#!/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