Shell distrobox-create:204 prints `default: $(uname -n)`. Compute it
via os.Hostname() at command-build time so --help mirrors the shell.
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
Value: cfg.DefaultContainerImage made cmd.String("image") never empty,
which killed the `containerImage == ""` branch in makeContainerImage
and spuriously triggered the `name == default` fallback for `--name foo`
alone. The Usage string already shows the default.
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
strings.Contains(container.Status, "Up") missed podman's lowercase
"running" status, leaving the force prompt unreachable under podman.
IsRunning() matches both docker ("Up …") and podman ("running").
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
`distrobox create --image alpine my-box` silently ignored the
positional; only --name was read. Override ContainerName from
cmd.Args().First() to match the shell (distrobox-create:453-461).
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
dryRun was misrouted into RmOptions.NoTTY, so `assemble rm --dry-run`
and `assemble create --replace --dry-run` actually deleted containers.
Match the shell which skips rm entirely (distrobox-assemble:316-319).
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
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>
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>
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>
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).
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.
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.
`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.
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).
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.
- 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>
`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>
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>