openSUSE / microos-toolbox

Script to run a toolbox container on openSUSE MicroOS
Apache License 2.0
54 stars 15 forks source link

Introduce -n/--nostop switch so mutiple sessions can be run #39

Closed sysrich closed 2 years ago

sysrich commented 2 years ago

Background

I'm using MicroOS Desktop as my daily driver and so am running toolbox pretty much as my main 'work shell' for all my day to day ops, with a custom image based on the official toolbox image with just a few extras I need (osc, zsh, etc)

My daily workflow has been as follows

Start at least 2 copies of gnome-terminal Run toolbox -u in each gnome-terminal sudo zsh in at least one of those toolboxes

The sudo zsh (inside toolbox -u) shell ends up being my osc environment for staging/Factory release management, using different OBS auth than my regular toolbox -u shell

The problem is, if I exit ANY of my toolbox -u sessions, they all die, because the container gets stopped on exit as part of the cleanup trap.

This is really annoying, and so, I wanted a fix

TL;DR / The Fix This PR introduces a -n / --nostop switch for toolbox which prevents the container from getting cleaned up on exit.

The tmp_user_setup script cleanup still happens, but the container remains running

This means toolbox -u -n can be called repeatedly, at the same time, and all of those sessions will remain valid and work even as they are closed down.

Personally, I'd like this behaviour as the default, but figured I'd start with this change and see how it's accepted.

This has been tested..it's the code I'm actually running myself for my daily work with toolbox.

dfaggioli commented 2 years ago

FWIW, I like this change quite a bit, and I think it's a big improvement in the toolbox experience (and I'm also using toolbox as my main environment since, well, more than a year).

I also would be in favor of making it the default behavior, at least for user (i.e., the -u ones) toolboxes, but it's indeed best to do things in steps.