Commit Graph
1840 Commits
Author SHA1 Message Date
Luca Di Maio 5a3c65bb62 fix(rm): fix(rm): confirm deletions once and default the prompts to yes, match shell behaviour
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-25 09:07:21 +02:00
Luca Di Maio 6388503959 fix(upgrade): match shell prompting
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-25 09:07:21 +02:00
Luca Di Maio 7ccdd55cf6 fix(assemble): an existing box is not an error, it should be simpl skipped
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-25 09:07:21 +02:00
Luca Di Maio 8c5b5658b9 fix(enter): support noworkdir flag
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-25 09:07:21 +02:00
Luca Di Maio 9844159d0f fix(enter): match shell version, prompt user to create missing container if not existing
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-25 09:07:21 +02:00
Luca Di Maio 3b03c847cb fix(create): mount the rootless marker so init doesn't misdetect rootful
Rootless podman/docker create now mounts /dev/null:/run/.distrobox.rootless:ro
(distrobox-create:577), so distrobox-init skips the /etc/shadow heuristic that
false-positives on Docker Desktop/macOS.

Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-25 09:07:21 +02:00
Luca Di Maio 0026ca068c fix(rm): honor --rm-home and gate the custom-home prompt on it
Thread RemoveHome into removeContainer; only prompt to delete the custom
home when --rm-home is set, interactive, and it differs from the host
home matching the shell. Without the flag the home is never touched.

Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-25 09:07:21 +02:00
Luca Di Maio c662a153cb fix(assemble): accept the volume manifest key and split values
Map the reference key `volume` (alongside `volumes`) and whitespace-split
the value so `volume="/a:/b /c:/d"` becomes separate mounts, matching
distrobox-assemble.

Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-25 09:07:20 +02:00
Luca Di Maio 1f2e769fb9 feat(cli): add SUDO/DOAS guard to match shell distrobox
Restore the reference shell's refusal of `sudo distrobox`.

Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-25 09:07:20 +02:00
Luca Di Maio 6328b71aa4 docs: clarify go rewrite use of config file
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-25 09:07:20 +02:00
Luca Di Maio d0a94a9c27 fix(create): default name to my-distrobox when using the default image
Match the shell: an argument-less distrobox create produces my-distrobox instead of fedora-toolbox-latest.
2026-06-25 09:07:20 +02:00
Luca Di Maio a4618cdbb4 fix(compat): honor DBX_* env vars, autodetect, prompt, root parity
Wire per-command DBX_* env sources, default container_manager to autodetect, reject invalid prompt input, and treat uid 0 as rootful.
2026-06-25 09:07:20 +02:00
Alessio Biancalana 3d59d11ab5 fix(enter,ephemeral): support -e/--exec marker for custom command 2026-06-25 09:07:20 +02:00
balanza ab1b3ac660 chore(ci): remove references to branch next 2026-06-14 13:04:28 +02:00
balanza 8e676666b7 feat(create): implement --compatibility to fetch supported image list
Ports show_compatibility from bash distrobox-create. Downloads
docs/compatibility.md from upstream and caches the parsed list
in the user cache dir.
2026-06-14 13:04:28 +02:00
Pedro Rabello Sato 94f1c5e807 fix(export): match running apps with exported .desktop entry (#2118)
The DE (at least Gnome and KDE) tries to match the app_id of
the running application with the corresponding .desktop file in this order:
 - find ${app_id}.desktop
 - if not found, tries to find a .desktop with StartupWMClass=${app_id}
Because when exporting a application we change the name of the .desktop
file, the DE can't match the running app, displaying a generic icon.

To solve this, change StartupWMClass key of the exported .desktop file
to the name of the .desktop inside distrobox (minus the .desktop extension).
2026-06-14 13:04:28 +02:00
Alessio Biancalana 24b31ed834 fix(list): detect containers with overridden manager label (#2116)
When `--additional-flags --label=manager=...` overrides the manager
label at creation time, `distrobox list` would hide the container and
`distrobox rm` would silently no-op (it filters through the same list).
Match the distrobox.* label set alongside `manager` so containers
remain detectable when the manager label is overridden, restoring v1's
loose `*distrobox*` substring behavior.
2026-06-14 13:04:28 +02:00
Emanuele De Cupis 56db400663 fix(rm): propagate verbose flag to generate-entry cleanup (#2109) 2026-06-14 13:04:28 +02:00
Emanuele De Cupis 2e3eed0a6f feat(generate-entry): auto-detect icon from container distro (#2106)
When `--icon auto` is used (the implicit default for `--all`),
match the container's image name (or container name as fallback)
against the upstream DISTRO_ICON_MAP and select the matching distro
logo. Falls back to the generic terminal icon when no distro can be
detected, preserving previous behaviour.
2026-06-14 13:04:28 +02:00
Emanuele De Cupis b6ed98f86e fix(assemble): accept manifest file as positional argument (#2105)
`distrobox assemble create /path/to/file.ini` and
`distrobox assemble rm /path/to/file.ini` now work the same way as the
original Bash `distrobox-assemble` script, in addition to the existing
`--file` flag. When both are supplied, `--file` takes precedence
(explicit over implicit). When neither is given, the default
`./distrobox.ini` is still used.

The resolution logic is extracted into a `resolveManifestPath` helper
with unit tests covering flag precedence, positional fallback and the
default path.
2026-06-14 13:04:28 +02:00
Emanuele De Cupis de36027ed0 fix(ephemeral): avoid name collisions when generating random container name (#2108)
Generate the random ephemeral container name in a loop that re-rolls if
the name already exists according to the container manager, and fail
loudly after a small number of attempts. Dry-run mode bypasses the
existence check to match the rest of the dry-run pipeline.

Also extends MockContainerManager with an optional ExistsFn override so
tests can simulate collisions without changing behavior for existing
tests (the default still returns false).
2026-06-14 13:04:28 +02:00
Emanuele De Cupis 9a1356076b fix(ephemeral): pass custom command to enter (#2104)
Forward the command/arguments collected after `--` on the ephemeral CLI
through `EphemeralOptions.CustomCommand` to the underlying enter
command, matching the bash reference (`distrobox-enter ... ${name}
${container_command}`). Without this, examples like `distrobox
ephemeral --image alpine -- cat /etc/os-release` would silently drop
the trailing command and just open an interactive shell.
2026-06-14 13:04:28 +02:00
balanza 74e1dd6e8d refactor(providers): extract sleep durations into constants 2026-06-14 13:04:28 +02:00
balanza 6bc9183968 fix(create): split additional-flags correctly 2026-06-14 13:04:28 +02:00
balanza 7ada7e3e9e fix(assemble): init flag to force set unshare-process and unshare-groups
See https://github.com/89luca89/distrobox/blob/a558b1799e4a30a39874453e5c2874ef702ab599/distrobox-create#L319
2026-06-14 13:04:28 +02:00
balanza f3b941f22a fix(assemble): unshare-all flag to override specific unshare flags 2026-06-14 13:04:28 +02:00
Jordan 39181a98c0 chore: improve supply-chain protections (#2096)
* chore(ci): update actions and pin them to commit sha

* chore(dependabot): add gomod package ecosystem

* chore(dependabot): add cooldown for package updates
2026-06-14 13:04:28 +02:00
Luca Di Maio 65b55ae981 fix(cli): match upstream when no container name is given (#2093)
- enter: fall back to cfg.DefaultContainerName (was passing "" to the manager)
- rm: fall back to cfg.DefaultContainerName (was a silent no-op)
- upgrade: error with "Please specify the name of the container." (was silently using my-distrobox)

Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-14 13:04:28 +02:00
Luca Di Maio 1a75e1c562 fix(assemble): preserve section names from manifest (#2092)
`makeContainerName` replaced user-provided names with DefaultContainerName
whenever `image=` was empty, and `sectionToItem` kept whitespace from
headers like `[ generic1]`.
Both made `assemble create` emit `--name my-distrobox` (or a leading-space name)
for sections without an explicit image.

Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-14 13:04:28 +02:00
Luca Di Maio 039ea68b66 fix(create): don't pull images in --dry-run mode (#2091)
PullImage ignored opts.DryRun and pulled anyway.
Thread DryRun through PullImage and gate
the usesRunc / supportsKeepIDSize probes.

Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
2026-06-14 13:04:28 +02:00
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