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

wb: Some more small fixes.

- Fix usage message.
- Better not_in_toolbox function and usage. The function now checks if
  in a Toolbox container and fails accordingly. All of the usage cases
were like that so now calling the function is a little cleaner.
- Fixup for the last commit. If the Toolbox container was just created,
  it's not running and then `podman exec` fails. Running a simple
`toolbox run true` fixes this.
parent ad0bb638
No related branches found
No related tags found
No related merge requests found
......@@ -7,7 +7,7 @@ TMUX_SOCKET='workbench'
DEFAULT_SESSION='workbench'
usage() {
echo "$(basename "$0"): [-h|--help] [-u|--update] [-d|--dry-update] [-l|--list] [-k|--kill] [-s|--kill-server] [-i|--in-workbench] [SESSION_NAME]"
echo "Usage: $(basename "$0") [-h|--help] [-u|--update] [-d|--dry-update] [-l|--list] [-k|--kill] [-s|--kill-server] [-i|--in-workbench] [SESSION_NAME]"
}
fail() {
......@@ -16,7 +16,10 @@ fail() {
}
not_from_toolbox() {
if in_toolbox
then
fail 'This command cannot run from within the workbench container.'
fi
}
command -v toolbox >/dev/null || fail 'Toolbox is not installed.'
......@@ -79,26 +82,21 @@ kill_tmux() {
}
kill_server() {
if in_toolbox
then
not_from_toolbox
fi
kill_tmux
toolbox rm -f "$CONTAINER"
}
update() {
if in_toolbox
then
not_from_toolbox
fi
if ! is_latest
then
kill_server
podman image prune --filter 'label=com.github.containers.toolbox=true' --force >/dev/null
toolbox create --image "$IMAGE"
fi
podman exec -it -w "$HOME" -u "$(whoami)" "$CONTAINER" git pull
toolbox run --container "$CONTAINER" -- true
podman exec -it -w "$HOME" -u "$(whoami)" "$CONTAINER" git Pull
}
dry_update() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment