Create a deploykernel.zsh script

For building the current kernel and deploying it onto a VM

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
This commit is contained in:
Anna Schumaker 2021-11-30 13:11:55 -05:00
parent e615a2d36b
commit 04927311ef
2 changed files with 27 additions and 0 deletions

View File

@ -0,0 +1,8 @@
#compdef deploykernel.zsh
function _deploykernel.zsh() {
_arguments \
':destination: _alternative
"hosts:hosts: _ssh_hosts"
"domains:domains:($(virsh list --all --name))"'
}

19
deploykernel.zsh Executable file
View File

@ -0,0 +1,19 @@
#!/bin/zsh -e
autoload colors
colors
if [ "$#" -ne 1 ]; then
echo "Usage: $0 {remote host}"
exit 1
fi
makepkg -f
deploypkg.zsh $(makepkg --packagelist) $1
pkgname=$(grep ^pkgname PKGBUILD | awk -F= '{print $2}')
title=$(ssh.zsh $1 grub-list.zsh -e | grep $pkgname$)
ssh.zsh $1 "sudo grub-reboot \"$title\""
echo
vm.zsh reboot $1
echo $fg_bold[cyan]$(ssh.zsh $1 uname -rsn)$reset_color