Skip to content
Snippets Groups Projects
Commit d3777dbb authored by nimrod's avatar nimrod
Browse files

Workbench improvements.

- Use a specific Tmux socket for the session in the container, seperate
  it from other sessions. Easier to kill in update-wb.
- Name the session as well and display it properly.
- Better session creation or attachment.
- Better image pruning when updating.
- Don't allow running update-wb from inside the container, killing Tmux
  stops the script and it doesn't work.
parent 023ca7d1
No related branches found
No related tags found
No related merge requests found
...@@ -265,11 +265,11 @@ toux () { ...@@ -265,11 +265,11 @@ toux () {
} }
wb () { wb () {
toolbox run --container workbench -- /bin/sh -ic 'if tmux ls >/dev/null 2>&1; then tmux a; else tmux; fi;' toolbox run --container workbench -- tmux -L workbench new-session -As workbench
} }
wbr () { wbr () {
ssh -t ns4.shore.co.il toolbox run --container workbench -- /bin/sh -ic "'if tmux ls >/dev/null 2>&1; then tmux a; else tmux; fi;'" ssh -t ns4.shore.co.il toolbox run --container workbench -- tmux -L workbench new-session -As workbench
} }
__prompt () { __prompt () {
......
bind-key b send-prefix bind-key b send-prefix
set -g set-titles on set -g set-titles on
set -g set-titles-string '#T' set -g set-titles-string '#T'
set -g status-left-length 12
# Copied from https://github.com/seebi/tmux-colors-solarized/blob/master/tmuxcolors-dark.conf # Copied from https://github.com/seebi/tmux-colors-solarized/blob/master/tmuxcolors-dark.conf
#### COLOUR (Solarized dark) #### COLOUR (Solarized dark)
......
...@@ -14,15 +14,20 @@ is_latest() { ...@@ -14,15 +14,20 @@ is_latest() {
} }
update() { update() {
if [ -S "/tmp/tmux-$(id -u)/workbench" ]
then
toolbox run --container workbench -- tmux -L workbench kill-server
fi
toolbox rm --force "$CONTAINER" 2>/dev/null || true toolbox rm --force "$CONTAINER" 2>/dev/null || true
yes | podman image prune --filter 'label=com.github.containers.toolbox=true' podman image prune --filter 'label=com.github.containers.toolbox=true' --force
killall tmux || true
toolbox create --image "$IMAGE" toolbox create --image "$IMAGE"
} }
if [ "$(hostname)" = 'toolbox' ] if [ "$(hostname)" = 'toolbox' ]
then then
/usr/libexec/flatpak-xdg-utils/flatpak-spawn --host "$0" "$@" printf '\e[1;91m%s\e[0m\n' \
'Cannot update the workbench container from inside the workbench container.' >&2
exit 1
elif [ "${1:-}" = "-d" ] || [ "${1:-}" = "--dry-run" ] || [ -n "${DRY_RUN:-}" ] elif [ "${1:-}" = "-d" ] || [ "${1:-}" = "--dry-run" ] || [ -n "${DRY_RUN:-}" ]
then then
podman image pull "$IMAGE" > /dev/null podman image pull "$IMAGE" > /dev/null
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment