From dfc763c66fe3d4c873c7172c2b8e32604d63dc33 Mon Sep 17 00:00:00 2001
From: Adar Nimrod <nimrod@shore.co.il>
Date: Sat, 24 Jul 2021 08:33:22 +0300
Subject: [PATCH] Improvements for update-wb.

- Better detection of the current image in use, will update if the image
  was already downloaded.
- Kill all tmux instances, otherwise it keeps running and but
  malfunctions.
---
 Documents/bin/update-wb | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Documents/bin/update-wb b/Documents/bin/update-wb
index 448701f..947a035 100755
--- a/Documents/bin/update-wb
+++ b/Documents/bin/update-wb
@@ -7,7 +7,7 @@ CONTAINER='workbench'
 is_latest() {
     podman image exists "$IMAGE" || return 1
     toolbox run --container "$CONTAINER" true 2>/dev/null || return 1
-    current="$(podman image inspect "$IMAGE" --format '{{.Digest}}')"
+    current="$(podman container inspect "$CONTAINER" --format '{{ .Image }}')"
     podman image pull --quiet "$IMAGE" > /dev/null
     new="$(podman image inspect "$IMAGE" --format '{{.Digest}}')"
     [ "$new" = "$current" ] || return 1
@@ -16,6 +16,7 @@ is_latest() {
 update() {
     toolbox rm --force "$CONTAINER" 2>/dev/null || true
     yes | podman image prune --filter 'label=com.github.containers.toolbox=true'
+    killall tmux || true
     toolbox create --image "$IMAGE"
 }
 
-- 
GitLab