Commit Graph
1860 Commits
Author SHA1 Message Date
Luca Di Maio 37c39a2992 fix: clean up partial containers when interrupted (#2090)
Wire signal.NotifyContext in main so SIGINT/SIGTERM cancel the context
instead of killing the process.

ephemeral and assemble now defer rm on a detached cleanup ctx, so the
in-flight container is removed even when the user hits Ctrl+C.

Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-14 13:04:28 +02:00
Luca Di Maio d3dac8af1c fix(enter): always attach stdio to final exec (#2089)
`Interactive: !NoTTY` routed stdio to discarded buffers whenever
--no-tty was set, breaking ptyxis. --no-tty only governs whether
`--tty` is appended to the exec args, not stdio plumbing.

Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-14 13:04:28 +02:00
balanza d3219c019f fix(cli): use correct app claim 2026-06-14 13:04:28 +02:00
balanza 37949df10e chore(ci): use make build for releasing the artifact 2026-06-14 13:04:28 +02:00
balanza 3d68de95de fix(cli): read correct version
Previously, the CLI hardcoded "1.0.0" as the version string in two places (the root command and the generate-entry subcommand).

Introduce pkg/version, a minimal package that exposes a single variable Version, defaulting to "dev". The root command now references such a value; generate-entry does not need it al all

The Makefile computes the version at build time by running:

git describe --tags --always
This produces the exact tag name when HEAD is tagged, or --g when it is not, giving a precise description of the build relative to the nearest ancestor tag. If git is unavailable, the value falls back to "dev".

The resulting string is injected into the binary via:

-ldflags "-X github.com/89luca89/distrobox/pkg/version.Version=<value>" so that distrobox --version and distrobox generate-entry --version both report the exact version of the build.
2026-06-14 13:04:28 +02:00
balanza 3058b51aaa fix(cli): sort commands alphabetically 2026-06-14 13:04:28 +02:00
balanza 9c3b2b9170 fix(root): validate rootful execution with the actual sudo program 2026-06-14 13:04:28 +02:00
balanza 58b654f98d fix(assemble): handle root for each entry
`assemble` command cannot be executed as root. Instead, each item can
either be processed by a rootful or rootless container manager.
2026-06-14 13:04:28 +02:00
balanza 7789effb77 refactor(cli): rename and move root validation 2026-06-14 13:04:28 +02:00
balanza fb8516f84f refactor(cli): compose commands with decorators
Some flags are shared to many commands but not to all (example: `--root`). By composing decorators, each command can be configured so that is assigned only to the flags that matters.
2026-06-14 13:04:28 +02:00
Luca Di Maio 21c8590288 fix(lint): fix lint warnings
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-14 13:04:28 +02:00
Luca Di Maio 4330b7f901 fix(lint): remove mnd linter
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-14 13:04:28 +02:00
Luca Di Maio af76d23461 fix(enter): preserve argv boundaries in custom command
CustomCommand was joined into a string and re-split on whitespace,
collapsing quoted args — `sh -c "echo a || echo b"` lost its script
body, and any value passed by upgrade/assemble with embedded spaces
or quotes got mangled. Pass argv through as []string end-to-end.

Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-14 13:04:28 +02:00
Luca Di Maio 868036b229 chore(containermanager): group shared functions in the main containermanager interface
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-14 13:04:28 +02:00
balanza ed57d2bdd9 fix(create): print default container name 2026-06-14 13:04:28 +02:00
LinuxJourney a589b11b50 feat(list): make listing alphabetical (#2077)
* feat: make listing alphabetical

* docs: added a comment about the rationale of the sorting
2026-06-14 13:04:28 +02:00
Alessio Biancalana 514c7fffda fix(containermanager): add MultiWriter to podman (#2073)
* feat(providers): show pull progress when downloading container images

* fix(containermanager): add MultiWriter to podman
2026-06-14 13:04:28 +02:00
Yiming Sun 1981ca41e7 fix(enter): propagate errors when entering containers (#2070)
* fix(providers): propagate container start errors before enter

* fix(providers): return errors from enter command execution

* fix(providers): improve setup and inspect error reporting

* test(providers): cover enter error propagation paths
2026-06-14 13:04:28 +02:00
Emanuele De Cupis b581ace4c7 fix: passing root correctly to create and generate-entry command (#2068)
* fix(create): handle root correctly

The `root` flag is handled in the root cli command. if we re-declare the
flag here we shadow it, resulting in a contaner manager initializated as
non-root.

Before this commit, these two commands produce respectively one root and
one non-root execution
```
distrobox --root create # root
distrobox create --root # non-root
```

* fix(generate-entry): handle root correctly

The `root` flag is handled in the root cli command. if we re-declare the
flag here we shadow it, resulting in a contaner manager initializated as
non-root.

Before this commit, these two commands produce respectively one root and
one non-root execution
```
distrobox --root generate-entry # root
distrobox generate-entry --root # non-root
```
2026-06-14 13:04:28 +02:00
Fabrizio Sestito debec7e5a2 ci: add commitlint
Signed-off-by: Fabrizio Sestito <fabrizio.sestito@suse.com>
2026-06-14 13:04:28 +02:00
Yiming Sun 73c48517ef fix(enter): unshare_groups su args and tty handling (#2063)
* enter(next): fix unshare_groups su args and tty handling

* test(docker): fix noTTY semantics in buildCommandArgs cases

* cli(enter): fix no-tty help text
2026-06-14 13:04:28 +02:00
Fabrizio Sestito 637725affe refactor: tests with testify (#2057)
Signed-off-by: Fabrizio Sestito <fabrizio.sestito@suse.com>
2026-06-14 13:04:28 +02:00
Fabrizio Sestito ffeba2b78b fix(providers): Name now returns podman or podman-launcher
Signed-off-by: Fabrizio Sestito <fabrizio.sestito@suse.com>
2026-06-14 13:04:28 +02:00
Fabrizio Sestito 603f41e58a fix(cli): add podman-laucher to invalid container manager message
Signed-off-by: Fabrizio Sestito <fabrizio.sestito@suse.com>
2026-06-14 13:04:28 +02:00
Fabrizio Sestito 270384f994 test(providers): add podman command selection test
Signed-off-by: Fabrizio Sestito <fabrizio.sestito@suse.com>
2026-06-14 13:04:28 +02:00
Fabrizio Sestito 730ca303a1 fix(providers): execute correct binary for podman-launcher provider
Signed-off-by: Fabrizio Sestito <fabrizio.sestito@suse.com>
2026-06-14 13:04:28 +02:00
Simon Westlin Green 26e5d907b5 fix: remove breaking spaces exported desktop files (#2051) 2026-06-14 13:04:28 +02:00
Fabrizio Sestito cc05d828c7 feat(cli): wire-up autodetect
Signed-off-by: Fabrizio Sestito <fabrizio.sestito@suse.com>
2026-06-14 13:04:28 +02:00
Fabrizio Sestito 6f9b0685cb test(containermanager): add autodetect constructor tests
Signed-off-by: Fabrizio Sestito <fabrizio.sestito@suse.com>
2026-06-14 13:04:28 +02:00
Fabrizio Sestito 168d92f834 feat(containermanager): add autodetect provider constructor
Signed-off-by: Fabrizio Sestito <fabrizio.sestito@suse.com>
2026-06-14 13:04:28 +02:00
balanza 83f270db38 refactor(config): remove unused file 2026-06-14 13:04:28 +02:00
balanza b63fc88a89 refactor(config): move XDG_DATA_HOME read into userenv 2026-06-14 13:04:28 +02:00
balanza db4b1b2a67 refactor(config): read executable path from std library without wrapper 2026-06-14 13:04:28 +02:00
balanza f311f760df refactor(config): remove unused dependency 2026-06-14 13:04:28 +02:00
balanza ec99b5d884 fix(config): read container image and name from config 2026-06-14 13:04:28 +02:00
balanza d9e4ffc57d refactor(config): trickle down config values to commands 2026-06-14 13:04:28 +02:00
balanza 48075ebc51 refactor(config): root cli command to read config from new package 2026-06-14 13:04:28 +02:00
balanza e626b63bf2 refactor(config): read config into struct
The current implementation uses dotenv to load the configuration into
the environment, and then delegate the cli layer to handle the
configuration coming from the DBX_ variables.
With this new implementation, defaults, config files and environment
variables are handled in a single point and treated as values.
2026-06-14 13:04:28 +02:00
balanza 4b22fa130d refactor(config): expose default config values 2026-06-14 13:04:28 +02:00
balanza 03a87ada77 refactor(config): public ConfigValue struct type 2026-06-14 13:04:28 +02:00
Mirko Brombin c31f0e9c71 fix: various bug fixes and code improvements (#2047)
* fix(containermanager): fix typos in ContanerID and ContanerManagerType

* fix(rm): pass ContainerHome to RmOptions when removing container

* fix(containermanager): handle empty names slice in podman container list

* fix(create): initialize prompter in NewCreateCommand to prevent nil dereference

* fix(userenv): trim trailing newline from uid and gid command output

* refactor(containermanager): move shared types and constants to providers common file

* fix(containermanager): skip /dev/shm volume mount if EvalSymlinks fails

* fix(containermanager): rename ContainerManagerType to ManagerType to avoid stutter

* restore: ManagerType -> ContainerManagerType

* test(containermanager): add empty names fallback test for parsePodmanContainerList

* fix(containermanager): suppress revive stutter lint for ContainerManagerType

* fix(containermanager): use empty string fallback when podman container has no name

* fix(commands): pass real prompter to create command in assemble and ephemeral

* Revert "refactor(containermanager): move shared types and constants to providers common file"

This reverts commit 59faeb71f8.
2026-06-14 13:04:28 +02:00
Alessio Biancalana 9d4955a23e docs: strip references to install scripts, add references to Makefile (#2029)
Signed-off-by: Alessio Biancalana <alessio@dottorblaster.it>
2026-06-14 13:04:28 +02:00
Alessio Biancalana 5f2827231a chore: strip install and uninstall scripts (#2027)
Since `install` and `uninstall` don't work on the new setup, we're just
stripping them for the moment.

Signed-off-by: Alessio Biancalana <alessio@dottorblaster.it>
2026-06-14 13:04:28 +02:00
Alessio Biancalana 631e3155c5 ci: enable CI worklows when PRs are opened against the next branch (#2028)
Signed-off-by: Alessio Biancalana <alessio@dottorblaster.it>
2026-06-14 13:04:28 +02:00
balanza d1a9d97ec0 fix(containermanager): use correct enter command path on exported bins 2026-06-14 13:04:28 +02:00
balanza 120c614137 fix(containermanager): conditionally use size attribute on podman 2026-06-14 13:04:28 +02:00
balanza 64f32d53b0 fix(test): expect SELinux volumes only of they exist 2026-06-14 13:04:28 +02:00
balanza fc1eec4177 fix(containermanager): handle podman empty list 2026-06-14 13:04:28 +02:00
balanza 4a15717400 refactor(containermanager): use string argument instead of pointer 2026-06-14 13:04:28 +02:00
balanza e01f942ae1 fix(containermanager): prevent nil pointer exception 2026-06-14 13:04:28 +02:00