Show sibling projects' versions, and let version update them
shellcheck / shellcheck (push) Failing after 19s
shellcheck / shellcheck (push) Failing after 19s
A sibling's version is its latest git tag (v1.4.0, or v1.4.0+3 for commits after it), or, without tags, its commit's date and short hash, like CoreDesktop's own. The version shown as available is that of the newest commit on the default branch, which is what update installs. sibling list shows each sibling's version. sibling check fetches every sibling at once and shows which have a newer version, and sibling update [name...] updates the named siblings or all of them. 71-siblings.sh now runs sibling update, so update and version share one way of updating. version lists the installed siblings with any newer version and, when run in a terminal, asks for each one whether to update it now. version --check and the update notification still only look at CoreDesktop. The sibling skill docs describe how to release a version by tagging it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -8,6 +8,9 @@
|
||||
# because they come from Arch, not CoreDesktop, along with any newer release of
|
||||
# either that update would install.
|
||||
#
|
||||
# Sibling projects (see sibling) are listed with their versions too. If any has
|
||||
# a newer version, version asks, for each one, whether to update it now.
|
||||
#
|
||||
# version --check prints the newer version and exits 0 if one is available,
|
||||
# exits 1 if this machine is up to date, or 2 if it couldn't check.
|
||||
|
||||
@@ -125,6 +128,29 @@ echo "Kernel $kernel"
|
||||
[ -n "$driver" ] && echo "Video driver $driver"
|
||||
echo "Last update $last_update"
|
||||
|
||||
# Sibling projects, as "name<TAB>installed<TAB>available" lines (see sibling)
|
||||
siblings="$(bash "$COREDESKTOP/sibling" check --porcelain 2> /dev/null)"
|
||||
newer_siblings=()
|
||||
if [ -n "$siblings" ]; then
|
||||
echo
|
||||
echo "Sibling projects"
|
||||
width=0
|
||||
while IFS=$'\t' read -r name _; do
|
||||
(( ${#name} > width )) && width=${#name}
|
||||
done <<< "$siblings"
|
||||
while IFS=$'\t' read -r name installed available; do
|
||||
case "$available" in
|
||||
"") ;;
|
||||
"?") installed="$installed, couldn't check for a newer version" ;;
|
||||
*)
|
||||
installed="$installed, $available is available"
|
||||
newer_siblings+=("$name"$'\t'"$available")
|
||||
;;
|
||||
esac
|
||||
printf ' %-*s %s\n' "$width" "$name" "$installed"
|
||||
done <<< "$siblings"
|
||||
fi
|
||||
|
||||
# Packages newer than the mirror's last sync aren't shown above, or installed
|
||||
if age="$(mirror_age_hours)" && (( age >= MIRROR_STALE_HOURS )); then
|
||||
if (( age >= 48 )); then ago="$(( age / 24 )) days"; else ago="$age hours"; fi
|
||||
@@ -132,3 +158,19 @@ if age="$(mirror_age_hours)" && (( age >= MIRROR_STALE_HOURS )); then
|
||||
echo -e "\e[33mYour package mirror ($(first_mirror)) last synced with Arch $ago ago, so"
|
||||
echo -e "newer packages may be missing. Run update to switch to up-to-date mirrors.\e[0m"
|
||||
fi
|
||||
|
||||
# Offer each newer sibling, but only to someone at the terminal to answer
|
||||
if (( ${#newer_siblings[@]} > 0 )) && [ -t 0 ] && [ -t 1 ]; then
|
||||
echo
|
||||
chosen=()
|
||||
for sibling in "${newer_siblings[@]}"; do
|
||||
IFS=$'\t' read -r name available <<< "$sibling"
|
||||
read -rp "Update $name to $available? [y/N] " response
|
||||
[[ "$response" =~ ^[yY]([eE][sS])?$ ]] && chosen+=("$name")
|
||||
done
|
||||
if (( ${#chosen[@]} > 0 )); then
|
||||
echo
|
||||
bash "$COREDESKTOP/sibling" update "${chosen[@]}"
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user