kernel-tag.zsh: Add script to determine if a commit is tagged

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
This commit is contained in:
Anna Schumaker 2022-02-16 14:00:46 -05:00
parent 9b07caada6
commit b02e2ee03d
1 changed files with 23 additions and 0 deletions

23
kernel-tag.zsh Executable file
View File

@ -0,0 +1,23 @@
#!/bin/zsh
# Note: Set CONFIG_LOCALVERSION with
# REV=$(git rev-parse --short HEAD)$(git diff --quiet || echo "-dirty")
# scripts/config --set-str CONFIG_LOCALVERSION "-g$REV"
SOURCE=/home/anna/Programs/linux-nfs.git/
if [ "$#" -ne 1 ]; then
echo "Usage: $0 {remote host}"
fi
vm.zsh boot $1
uname=$(ssh $1 uname -r)
config=$(ssh $1 zcat /proc/config.gz | grep -E "# Linux(.*?)Kernel Configuration$" | awk '{print $3}')
last=$(echo $uname | awk -F- '{print $NF}')
# Check for a distro kernel
if [ "$uname" = "$config-1" ]; then
echo "v$config"
elif [ "${last[0,1]}" = "g" ]; then
cd $SOURCE && git describe --exact-match "${last:1}" 2>/dev/null || exit 0
fi