diff --git a/kernel-tag.zsh b/kernel-tag.zsh new file mode 100755 index 0000000..84895af --- /dev/null +++ b/kernel-tag.zsh @@ -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