summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorMarc Vertes <mvertes@free.fr>2021-08-15 11:26:14 +0200
committerMarc Vertes <mvertes@free.fr>2021-08-15 11:26:14 +0200
commite70107cb6a2f1fe17b848c43774b4e946749ea23 (patch)
treed84b28afb53de105b641d749eeff737306a95740 /bin
parent0ad6087640b7c6f9bee6e954f0736d9c183f6a5c (diff)
update
Diffstat (limited to 'bin')
-rwxr-xr-xbin/update_kernel_host8
-rwxr-xr-xbin/vm10
-rwxr-xr-xbin/wol4
3 files changed, 16 insertions, 6 deletions
diff --git a/bin/update_kernel_host b/bin/update_kernel_host
new file mode 100755
index 0000000..6180921
--- /dev/null
+++ b/bin/update_kernel_host
@@ -0,0 +1,8 @@
+#!/bin/sh -ex
+
+# After 'apk upgrade', update kernel and initrd on VM host
+
+sudo cp /boot/initramfs-virt /tmp
+sudo chmod a+r /tmp/initramfs-virt
+gunzip < /boot/vmlinuz-virt > /tmp/vmlinux
+scp /tmp/initramfs-virt /tmp/vmlinux marc@m1:.vm/vm1/
diff --git a/bin/vm b/bin/vm
index 732ba49..97e3521 100755
--- a/bin/vm
+++ b/bin/vm
@@ -212,11 +212,12 @@ ls() {
}
start() {
- usage 'start [-af] name' 'Start a VM' && return
- while getopts :af opt; do
+ usage 'start [-afs] name' 'Start a VM' && return
+ while getopts :afs opt; do
case $opt in
(a) a=1 ;;
(f) f=1 ;;
+ (s) s=1 ;;
(*) Opth=1 start "$1"; exit;;
esac
done
@@ -227,8 +228,9 @@ start() {
cd "$dir/$1" || die "start $1 failed"
[ -f vftool.pid ] && die "Error: process $(cat vftool.pid) is active or $PWD/vftool.pid should be removed"
start_vm & sleep 2
- [ "$f" ] && finalize
- [ "$a" ] && vm console "$1"
+ ! [ "$f" ] || finalize
+ ! [ "$a" ] || vm console "$1"
+ ! [ "$s" ] || exec ssh "$1"
}
start_vm() (
diff --git a/bin/wol b/bin/wol
index 39bce0d..7975df9 100755
--- a/bin/wol
+++ b/bin/wol
@@ -1,6 +1,6 @@
-#!/bin/sh -x
+#!/bin/sh
ip_plex=192.168.1.90 mac_plex=b0:83:fe:61:a7:aa
eval "mac=\$mac_$1 ip=\$ip_$1"
wakeonlan "$mac"
-ping -o "$ip"
+while ! nc -zw 2 "$ip" 22; do printf .; sleep 2; done
ssh "root@$ip"