From b486e481503be0593724e2212591dbd03e984815 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 23 Mar 2023 10:11:03 -0300 Subject: bin/vm: Allow it to get QCoW2 images from remote --- bin/vm | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'bin/vm') diff --git a/bin/vm b/bin/vm index f931f68..74a9d49 100755 --- a/bin/vm +++ b/bin/vm @@ -29,6 +29,8 @@ help() { - up - down - status + - ls-remote + - download OS the name or prefix of the OS to be acted upon QEMU_OPTIONS command line options to be given verbatim to QEMU @@ -79,6 +81,14 @@ help() { $ qemu-img create -f qcow2 $XDG_STATE_HOME/vm/qemu/debian-amd64-headless.qcow2 32G $ vm -vG up debian -- -cdrom ~/Downloads/ISO/debian-11.5.0-amd64-netinst.iso + + + List images available on the remote, and download one of them: + + $ vm ls-remote + debian-i386-headless + fedora-aarch64-headless + $ vm download fedora-aarch64-headless EOF } @@ -144,6 +154,7 @@ shift $((OPTIND - 1)) +REMOTE='https://euandre.org/s/vm' QCOW_DIR="${XDG_STATE_HOME:-$HOME/.local/state}"/vm/qemu RUNDIR="${XDG_RUNTIME_DIR:-${TMPDIR:-/tmp}}/vm" LOGS="${XDG_LOG_HOME:-$HOME/.local/var/log}"/vm/vm.log @@ -335,6 +346,13 @@ case "$ACTION" in write_ssh_config ;; + ls-remote) + wget -qO- "$REMOTE"/vms.txt + ;; + download) + eval "$(assert-arg -- "$OS" 'OS')" + wget -cO "$QCOW_DIR/$OS" "$REMOTE"/qemu/"$OS" + ;; *) printf 'Unrecognized action: "%s".\n\n' "$ACTION" >&2 usage >&2 -- cgit v1.2.3