diff options
author | EuAndreh <eu@euandre.org> | 2023-03-23 17:13:42 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2023-03-23 17:13:42 -0300 |
commit | 5e5affea3429523fbcd03736fac860449dea2df7 (patch) | |
tree | 057d051eac42c068ed5f4a32bd2a0b95f956b664 /bin/vm | |
parent | Makefile: Exclude mint from upload (diff) | |
download | dotfiles-5e5affea3429523fbcd03736fac860449dea2df7.tar.gz dotfiles-5e5affea3429523fbcd03736fac860449dea2df7.tar.xz |
bin/vm: Report if VM is running as a snapshot in "status" action
Diffstat (limited to 'bin/vm')
-rwxr-xr-x | bin/vm | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -255,7 +255,15 @@ case "$ACTION" in else STATUS=down fi - printf '%s\t%s\t%s\n' "$NAME" "$STATUS" "$PORTS" + + SNAPSHOT="$(cat "$RUNDIR/$NAME.snapshot")" + if [ "$SNAPSHOT" = true ] && [ "$STATUS" = 'up' ]; then + SNAPSHOT='snapshot' + else + SNAPSHOT='' + fi + + printf '%s\t%s\t%s\t%s\n' "$NAME" "$STATUS" "$PORTS" "$SNAPSHOT" done ;; up) @@ -270,6 +278,7 @@ case "$ACTION" in PID_F="$RUNDIR/$OS.pid" SSH_PORT_F="$RUNDIR/$OS.ssh" PORTMAPS_F="$RUNDIR/$OS.ports" + SNAPSHOT_F="$RUNDIR/$OS.snapshot" if [ -e "$PID_F" ]; then printf 'The VM for "%s" is already running with PID %s.\n' \ @@ -309,6 +318,7 @@ case "$ACTION" in printf '%s' "$PID" > "$PID_F" printf '%s' "$SSH_PORT" > "$SSH_PORT_F" printf '%s' "$PORTMAPS" > "$PORTMAPS_F" + printf '%s' "$SNAPSHOT" > "$SNAPSHOT_F" write_ssh_config ;; |