diff options
author | EuAndreh <eu@euandre.org> | 2023-03-23 10:11:03 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2023-03-23 10:18:28 -0300 |
commit | b486e481503be0593724e2212591dbd03e984815 (patch) | |
tree | 70c6e5aea4dbf21fa03ddbfd59a2545f86ac95ab /bin | |
parent | Makefile: Add "upload" target to send VM images (diff) | |
download | dotfiles-b486e481503be0593724e2212591dbd03e984815.tar.gz dotfiles-b486e481503be0593724e2212591dbd03e984815.tar.xz |
bin/vm: Allow it to get QCoW2 images from remote
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/vm | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -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 |