@@ -4,8 +4,9 @@
|
||||
#
|
||||
# CoreDesktop is a rolling release, so its version is the date of the commit
|
||||
# the local checkout is on, plus the short hash to tell same-day commits apart,
|
||||
# e.g. 2026.10.22 (c5f0651). The kernel is shown separately because it comes
|
||||
# from Arch, not CoreDesktop.
|
||||
# e.g. 2026.10.22 (c5f0651). The kernel and video driver are shown separately
|
||||
# because they come from Arch, not CoreDesktop, along with any newer release of
|
||||
# either that update would install.
|
||||
#
|
||||
# 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.
|
||||
@@ -50,11 +51,67 @@ if latest="$(newer_version)"; then
|
||||
version="$version, $latest is available (run update)"
|
||||
fi
|
||||
|
||||
# A version without its epoch and pkgrel, e.g. 1:26.2.6-1 is 26.2.6. Arch's
|
||||
# kernel puts its suffix in the version too (7.2.14.arch1), so drop that.
|
||||
upstream() {
|
||||
local v="${1#*:}"
|
||||
v="${v%-*}"
|
||||
echo "${v%.arch*}"
|
||||
}
|
||||
|
||||
# Packages with a newer version in the repos, as "name old -> new" lines.
|
||||
# checkupdates syncs a copy of the package database, so it needs no root and
|
||||
# doesn't leave a partial upgrade behind. Empty if it couldn't check.
|
||||
pending=""
|
||||
if command -v checkupdates &> /dev/null; then
|
||||
pending="$(timeout 30 checkupdates 2> /dev/null)"
|
||||
fi
|
||||
|
||||
# Print the newer upstream version of package $1 if the repos have one. A
|
||||
# rebuild of the same version (only the pkgrel changed) doesn't count.
|
||||
newer_package() {
|
||||
local name old _ new
|
||||
while read -r name old _ new; do
|
||||
[ "$name" = "$1" ] || continue
|
||||
[ "$(upstream "$old")" != "$(upstream "$new")" ] && upstream "$new"
|
||||
return
|
||||
done <<< "$pending"
|
||||
return 1
|
||||
}
|
||||
|
||||
kernel="$(uname -r)"
|
||||
# The package the running kernel came from (linux, linux-lts, ...)
|
||||
kernel_pkg="$(cat "/usr/lib/modules/$kernel/pkgbase" 2> /dev/null)"
|
||||
case "$kernel" in
|
||||
*-lts) kernel_pkg="${kernel_pkg:-linux-lts}" ;;
|
||||
*-zen) kernel_pkg="${kernel_pkg:-linux-zen}" ;;
|
||||
*-hardened) kernel_pkg="${kernel_pkg:-linux-hardened}" ;;
|
||||
*) kernel_pkg="${kernel_pkg:-linux}" ;;
|
||||
esac
|
||||
|
||||
# If the running kernel's modules are gone, a newer kernel was installed
|
||||
if [ ! -d "/usr/lib/modules/$kernel" ]; then
|
||||
kernel="$kernel (newer kernel installed, reboot to use it)"
|
||||
fi
|
||||
if latest="$(newer_package "$kernel_pkg")"; then
|
||||
kernel="$kernel, $latest is available (run update)"
|
||||
fi
|
||||
|
||||
# NVIDIA's driver if nvidia.sh installed it, otherwise Mesa, which drives
|
||||
# Intel and AMD graphics (vulkan-intel and vulkan-radeon are built with it)
|
||||
driver=""
|
||||
for pkg in nvidia-utils nvidia-580xx-utils mesa; do
|
||||
if installed="$(pacman -Q "$pkg" 2> /dev/null)"; then
|
||||
case "$pkg" in
|
||||
nvidia*) driver="NVIDIA $(upstream "${installed#* }")" ;;
|
||||
*) driver="Mesa $(upstream "${installed#* }")" ;;
|
||||
esac
|
||||
if latest="$(newer_package "$pkg")"; then
|
||||
driver="$driver, $latest is available (run update)"
|
||||
fi
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
# 10-pacman.sh rewrites this log on every update
|
||||
if [ -f "$PACMAN_UPDATE_LOG" ]; then
|
||||
@@ -65,4 +122,5 @@ fi
|
||||
|
||||
echo "CoreDesktop $version"
|
||||
echo "Kernel $kernel"
|
||||
[ -n "$driver" ] && echo "Video driver $driver"
|
||||
echo "Last update $last_update"
|
||||
|
||||
Reference in New Issue
Block a user