deploykernel.zsh: Take a list of machines to install on

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
This commit is contained in:
Anna Schumaker 2021-12-02 15:00:14 -05:00
parent 54d5c4784c
commit 5634d522f9
2 changed files with 17 additions and 8 deletions

View File

@ -2,7 +2,7 @@
function _deploykernel.zsh() {
_arguments \
':destination: _alternative
'*:destination: _alternative
"hosts:hosts: _ssh_hosts"
"domains:domains:($(virsh list --all --name))"'
}

View File

@ -2,18 +2,27 @@
autoload colors
colors
if [ "$#" -ne 1 ]; then
echo "Usage: $0 {remote host}"
if [ "$#" -lt 1 ]; then
echo "Usage: $0 {remote host, ...}"
exit 1
fi
makepkg -f
deploypkg.zsh $(makepkg --packagelist) $1
deploypkg.zsh $(makepkg --packagelist) $*
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\""
for vm in $*; do
title=$(ssh.zsh $vm grub-list.zsh -e | grep $pkgname$)
ssh.zsh $vm "sudo grub-reboot \"$title\""
done
echo
vm.zsh reboot $1
echo $fg_bold[cyan]$(ssh.zsh $1 uname -rsn)$reset_color
vm.zsh reboot $*
echo
tags=($(python /home/anna/bin/colors/vm.py $*))
for ((i=1; i<=$#; i++)); do
echo "${tags[i]} $fg_bold[default]$(ssh.zsh ${@[i]} uname -rsn)$reset_color"
done