scripts/kernel-tag.zsh

24 lines
673 B
Bash
Executable File

#!/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