diff --git a/README.md b/README.md index 68c94d2..f52daaf 100644 --- a/README.md +++ b/README.md @@ -170,6 +170,22 @@ refresh This will download the latest repo and run through the original installation script adding any "new" applications or services. You should run "update" after running "refresh". +### Which version am I running? + +CoreDesktop is a rolling release, so its version is the date of the latest CoreDesktop change on your machine, followed by that change's id. To see it, run in the terminal: + +``` +version +``` + +``` +CoreDesktop 2026.10.22 (c5f0651) +Kernel 7.2.11-arch1-1 +Last update 2026-10-22 13:43 +``` + +The kernel comes from Arch, so it's shown separately. If a newer kernel is waiting for a reboot, "version" says so. + ### Sibling projects A sibling project is another git repository that builds on CoreDesktop. To install one, run in the terminal: diff --git a/install.sh b/install.sh index 9b4e87c..48b1352 100755 --- a/install.sh +++ b/install.sh @@ -53,11 +53,12 @@ cd ~/.local/share/coredesktop # Source utility functions (provides install_packages and other helpers) source utils.sh -# Install the refresh, update and sibling management scripts to the user's bin +# Install the refresh, update, sibling and version scripts to the user's bin mkdir -p ~/.local/bin install_script ~/.local/share/coredesktop/refresh ~/.local/bin/refresh install_script ~/.local/share/coredesktop/update ~/.local/bin/update install_script ~/.local/share/coredesktop/sibling ~/.local/bin/sibling +install_script ~/.local/share/coredesktop/version ~/.local/bin/version # Source the package list (defines SYSTEM_UTILS, DEV_TOOLS, DESKTOP, etc. arrays) if [ ! -f "packages.conf" ]; then diff --git a/update b/update index c530b34..a38f147 100755 --- a/update +++ b/update @@ -42,6 +42,7 @@ mkdir -p "$COREDESKTOP/updates.d" install_script "$COREDESKTOP/update" ~/.local/bin/update install_script "$COREDESKTOP/refresh" ~/.local/bin/refresh install_script "$COREDESKTOP/sibling" ~/.local/bin/sibling +install_script "$COREDESKTOP/version" ~/.local/bin/version if [[ -z "$UPDATE_REEXECED" ]]; then export UPDATE_REEXECED=1 diff --git a/version b/version new file mode 100755 index 0000000..d338ad4 --- /dev/null +++ b/version @@ -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"