Script to check if you are on the latest point release

Script checking if running kernel is point-release of git source,
cat checkit
Code:
#!/bin/sh

URL="https://raw.githubusercontent.com/freebsd/freebsd-src/refs/heads/releng/15.1/sys/conf/newvers.sh"

# 1. Fetch data from GitHub and evaluate assignments safely
REMOTE_DATA=$(wget -qO- "$URL")
eval "$(echo "$REMOTE_DATA" | grep -E '^(TYPE|REVISION|BRANCH)=')"

# 2. Get local version
LOCAL_VER=$(freebsd-version -k)

# 3. Format remote version exactly like local
REMOTE_VER="${REVISION}-${BRANCH}"

# 4. Print outputs
echo "Local Kernel:   $LOCAL_VER"
echo "GitHub Version: $TYPE $REMOTE_VER"

# 5. Pure shell string manipulation (Zero seds)
# Extracts everything after the last "-p"
LOCAL_PATCH="${LOCAL_VER##*-p}"
REMOTE_PATCH="${REMOTE_VER##*-p}"

# If no "-p" existed, the variable won't change; reset to 0
[ "$LOCAL_PATCH" = "$LOCAL_VER" ] && LOCAL_PATCH=0
[ "$REMOTE_PATCH" = "$REMOTE_VER" ] && REMOTE_PATCH=0

# 6. Final comparison
if [ "$REMOTE_PATCH" -gt "$LOCAL_PATCH" ]; then
    echo "Status:         NEWER AVAILABLE"
else
    echo "Status:         Up to date"
fi
 
Kernel isn't always updated. So REVISION from newvers.sh might not match with your installed/running kernel.

Code:
# 2. Get local version
LOCAL_VER=$(freebsd-version -k)
Should be:
Code:
# 2. Get local version
LOCAL_VER=$(freebsd-version -u)
Because the userland patch version is ALWAYS updated.
 
Back
Top