Update active dev checkout with system
This commit is contained in:
@@ -1,9 +1,25 @@
|
||||
#!/bin/bash
|
||||
|
||||
# omarchy:summary=Check whether Omarchy package updates are available.
|
||||
# omarchy:summary=Check whether Omarchy updates are available.
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
updates=()
|
||||
|
||||
if [[ $OMARCHY_PATH != "/usr/share/omarchy" ]]; then
|
||||
upstream=$(git -C "$OMARCHY_PATH" rev-parse --abbrev-ref --symbolic-full-name '@{upstream}' 2>/dev/null || true)
|
||||
if [[ -n $upstream ]]; then
|
||||
GIT_TERMINAL_PROMPT=0 timeout 10 git -C "$OMARCHY_PATH" fetch --quiet 2>/dev/null || true
|
||||
|
||||
behind=$(git -C "$OMARCHY_PATH" rev-list --count "HEAD..$upstream" 2>/dev/null || echo 0)
|
||||
if (( behind > 0 )); then
|
||||
commit_label=commits
|
||||
(( behind == 1 )) && commit_label=commit
|
||||
updates+=("omarchy-dev-checkout $behind new $commit_label on $upstream")
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
package=""
|
||||
if pacman -Qq omarchy-dev >/dev/null 2>&1; then
|
||||
package=omarchy-dev
|
||||
@@ -16,7 +32,11 @@ if [[ -n $package ]]; then
|
||||
fi
|
||||
|
||||
if [[ -n ${update:-} ]]; then
|
||||
printf '%s\n' "$update"
|
||||
updates+=("$update")
|
||||
fi
|
||||
|
||||
if (( ${#updates[@]} > 0 )); then
|
||||
printf '%s\n' "${updates[@]}"
|
||||
exit 0
|
||||
else
|
||||
echo "Omarchy is up to date"
|
||||
|
||||
Reference in New Issue
Block a user