Make updating checking resilient against network being unavailable

This commit is contained in:
David Heinemeier Hansson 2025-08-05 17:13:37 +02:00
parent 9292c29640
commit a7798a57bc

View File

@ -1,8 +1,15 @@
#!/bin/bash
omarchy_path="$HOME/.local/share/omarchy"
latest_tag=$(git -C $omarchy_path ls-remote --tags origin | grep -v "{}" | awk '{print $2}' | sed 's#refs/tags/##' | sort -V | tail -n 1)
current_tag=$(git -C $omarchy_path describe --tags $(git -C $omarchy_path rev-list --tags --max-count=1))
# Ensure remote is reachable
if ! git -C "$omarchy_path" ls-remote &>/dev/null; then
echo "Error: Unable to reach remote repository."
exit 1
fi
latest_tag=$(git -C "$omarchy_path" ls-remote --tags origin | grep -v "{}" | awk '{print $2}' | sed 's#refs/tags/##' | sort -V | tail -n 1)
current_tag=$(git -C "$omarchy_path" describe --tags $(git -C "$omarchy_path" rev-list --tags --max-count=1))
if [[ "$current_tag" != "$latest_tag" ]]; then
echo "Omarchy update available ($latest_tag)"