diff --git a/gnvim b/gnvim new file mode 100755 index 0000000..424199e --- /dev/null +++ b/gnvim @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +# Just a quick ugly script to keep nvim-qt's window size. +# This also redirects error messages because of a bug in nvim-qt. + +nvim-qt --geometry 1000x500 "$@" 2> /dev/null diff --git a/spawn b/spawn new file mode 100755 index 0000000..31abec3 --- /dev/null +++ b/spawn @@ -0,0 +1,2 @@ +#!/bin/sh +nohup kitty "$@" > /dev/null & diff --git a/vm-mount b/vm-mount index aae2efe..b3798ff 100755 --- a/vm-mount +++ b/vm-mount @@ -31,6 +31,7 @@ if [ "$1" = "-u" ]; then else vm_name="$1" mountpoint="${MOUNTPOINT_PARENT}/${vm_name}.vm" + awk_script="/${vm_name}/ && split(\$5, a, \"/\"){ print a[1] }" if [ -z "${vm_name}" ]; then echo "Virtual machine name not provided." @@ -44,18 +45,17 @@ else echo "Waiting for ${vm_name} to connect to the network..." vm_ip_address="" - # TODO: Consider using a sleep here? + # TODO: Exit if this failes or times out. + # TODO: This needs a proper timeout. while [ "${vm_ip_address}" = "" ]; do - virsh_line="" - virsh_line="$(virsh net-dhcp-leases "${NETWORK_NAME}" | grep "${vm_name}") > /dev/null" - if [ "${virsh_line}" != "" ]; then - vm_ip_address="$(echo "${virsh_line}" | sed "s/\\( \\)*/\\1/g" | cut -d " " -f6 | cut -d "/" -f1)" - fi + vm_ip_address="$(virsh net-dhcp-leases "${NETWORK_NAME}" | awk "${awk_script}")" done + # TODO: Exit if this fails. # TODO: Make sure this directory isn't made if the vm fails to start or connect. mkdir -p "${mountpoint}" + # TODO: Exit if this failes or times out. # TODO: This needs a proper timeout. echo "Attempting to mount over ssh." until sshfs "${vm_ip_address}:${REMOTE_DIRECTORY}" "${mountpoint}"; do