add the version script
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Purpose : Show which version of CoreDesktop this machine is running
|
||||
#
|
||||
# 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.
|
||||
|
||||
COREDESKTOP="$HOME/.local/share/coredesktop"
|
||||
|
||||
source "$COREDESKTOP/utils.sh"
|
||||
|
||||
if ! git -C "$COREDESKTOP" rev-parse --git-dir &> /dev/null; then
|
||||
echo "CoreDesktop isn't installed in $COREDESKTOP."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
version="$(git -C "$COREDESKTOP" log -1 --format='%cd (%h)' --date=format:%Y.%m.%d)"
|
||||
|
||||
# Local edits to the checkout mean this isn't exactly the version above
|
||||
if [ -n "$(git -C "$COREDESKTOP" status --porcelain --untracked-files=no)" ]; then
|
||||
version="$version, modified"
|
||||
fi
|
||||
|
||||
kernel="$(uname -r)"
|
||||
# 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
|
||||
|
||||
# 10-pacman.sh rewrites this log on every update
|
||||
if [ -f "$PACMAN_UPDATE_LOG" ]; then
|
||||
last_update="$(date -r "$PACMAN_UPDATE_LOG" '+%Y-%m-%d %H:%M')"
|
||||
else
|
||||
last_update="never"
|
||||
fi
|
||||
|
||||
echo "CoreDesktop $version"
|
||||
echo "Kernel $kernel"
|
||||
echo "Last update $last_update"
|
||||
Reference in New Issue
Block a user