* Add --hostname argument and DBX_CONTAINER_HOSTNAME env var
* Update usage/distrobox-create.md and useful_tips.md
* Refining error message when hostname is too long
The init-hook provided for creating a distrobox with the
the same hostname as its host has two typos:
- Command substitution wrapping `uname -n` suppressing stdout redirect
- trailing "`"
Using this init-hook as suggested causes build errors.
This fix corrects the suggested script by echoing the command
substitution and removing the trailing "`".
See issue #1164 for details.
* init: add nvidia integration
This is a preliminary work to implement host's nVidia driver's
integration, in the guest.
The procedure is simple enough, it will try and find all nVidia related
files in the host, and bind mount them in the guest.
---------
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
Co-authored-by:: Luca Di Maio <luca.dimaio1@gmail.com>
Co-authored-by: Dario Faggioli <dfaggioli@suse.com>
Co-authored-by: Michael Lingelbach <m.j.lbach@gmail.com>
Up until now, we were unable to distinguish between normal users
(running the scripts via sudo) and root user (running the script in a
login shell). This introduces a check for the SUDO_USER and DOAS_USER
variables (created in unmodified environments, by sudo and doas,
respectively), among other mechanisms, to allow the root user to manage
rootful containers.
Fixes#575
Signed-off-by: Luciano Santos <luc14n0@opensuse.org>
* enter/export: handle quotes in arguments in a better way
This enables the use of spaced arguments, quotes and special chars
handling in both enter and export
Fix#439
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
Host:
- distrobox for Debian is in testing
- update Ubuntu versions
Guest:
- Rocky 9 is available
- update useful_tips.md examples for pre-init-hooks
Signed-off-by: Michel Alexandre Salim <michel@michel-slm.name>
This utility is automatically called by create and rm, so newer
distroboxes created with this version onward will automatically be added
to you applications list.
This tool can also be called separately to create/recreate/remove an
entry.
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
This will make it easier to have containers with different login shell
than the host, and will make it easier to fallback to working shells if
init fails to install the host's custom shell.
Fix#377
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
Tested and worked fine. I had to install `dnf-plugins-core` which is
installed out of the box on AlmaLinux 8, but that's not a distrobox
issue.
```shell
distrobox on main
❯ ./distrobox create -i docker.io/library/almalinux:9 -n alma9 --pre-init-hooks "dnf -y install dnf-plugins-core && dnf config-manager --enable crb && dnf -y install epel-release"
39a00b6fdacdbd22217fba9ff9c08a2468c8a57747f0df6e501ff057231899eb
Distrobox 'alma9' successfully created.
To enter, run:
distrobox-enter alma9
distrobox on main
❯ ./distrobox enter alma9
Container alma9 is not running.
Starting container alma9
run this command to follow along:
podman logs -f alma9
Starting container... [ OK ]
Executing pre-init hooks... [ OK ]
Installing basic packages... [ OK ]
Setting up read-only mounts... [ OK ]
Setting up read-write mounts... [ OK ]
Setting up host's sockets integration... [ OK ]
Integrating host's themes, icons, fonts... [ OK ]
Setting up package manager exceptions... [ OK ]
Setting up sudo... [ OK ]
Setting up groups... [ OK ]
Setting up users... [ OK ]
Executing init hooks... [ OK ]
Container Setup Complete!
Welcome to fish, the friendly interactive shell
Type help for instructions on how to use fish
distrobox on main
⬢ [almalinux:9] ❯
```
Signed-off-by: Michel Alexandre Salim <michel@michel-slm.name>
* Implement pre-initialization hooks
This implements support for running commands prior to most of the
container initialization. e.g. for RHEL and derivatives you might need
to pre-enable the PowerTools/CRB and EPEL repositories.
Resolves: #220
```
distrobox on main [!⇡]
✦ ❯ ./distrobox create -i registry.fedoraproject.org/fedora-toolbox:36 f36-packaging
a3cc54e5a820b6bd95286ec142cb3eeab7f72b42cebf6fa0d3c0072035b3bca4
Distrobox 'f36-packaging' successfully created.
To enter, run:
distrobox-enter f36-packaging
distrobox on main [!⇡]
✦ ❯ ./distrobox enter f36-packaging
Container f36-packaging is not runnung.
Starting container f36-packaging
run this command to follow along:
podman logs -f f36-packaging
Starting container... [ OK ]
Installing basic packages... [ OK ]
Setting up read-only mounts... [ OK ]
Setting up read-write mounts... [ OK ]
Setting up host's sockets integration... [ OK ]
Integrating host's themes, icons, fonts... [ OK ]
Setting up package manager exceptions... [ OK ]
Setting up sudo... [ OK ]
Setting up groups... [ OK ]
Setting up users... [ OK ]
Executing init hooks... [ OK ]
Container Setup Complete!
Welcome to fish, the friendly interactive shell
Type help for instructions on how to use fish
distrobox on main [!⇡]
⬢ [fedora-toolbox:36] ❯
```
Enable PowerTools (recommended to use EPEL) and EPEL Next, so
`distrobox` can install the Fish shell.
```
distrobox on main [!⇡]
✦ ❯ ./distrobox create -i quay.io/centos/centos:stream8 c8s --pre-init-hooks "dnf config-manager --enable powertools && dnf -y install epel-next-release"
9b17e8cfbf8e7a26abdc7a78b2325e1ee4a9577662b0fe94fbde4260269e1ce3
Distrobox 'c8s' successfully created.
To enter, run:
distrobox-enter c8s
distrobox on main [!⇡]
✦ ❯ ./distrobox enter c8s
Container c8s is not runnung.
Starting container c8s
run this command to follow along:
podman logs -f c8s
Starting container... [ OK ]
Executing pre-init hooks... [ OK ]
Installing basic packages... [ OK ]
Setting up read-only mounts... [ OK ]
Setting up read-write mounts... [ OK ]
Setting up host's sockets integration... [ OK ]
Integrating host's themes, icons, fonts... [ OK ]
Setting up package manager exceptions... [ OK ]
Setting up sudo... [ OK ]
Setting up groups... [ OK ]
Setting up users... [ OK ]
Executing init hooks... [ OK ]
Container Setup Complete!
Welcome to fish, the friendly interactive shell
Type help for instructions on how to use fish
distrobox on main
⬢ [centos:stream8] ❯
```
Signed-off-by: Michel Alexandre Salim <michel@michel-slm.name>
* Fix typo: s/runnung/running
Signed-off-by: Michel Alexandre Salim <michel@michel-slm.name>
* simplify pre-init-hooks detection, add useful tips
Signed-off-by: Michel Alexandre Salim <michel@michel-slm.name>
* More changes to address review feedback
- distrobox-init: indent new if block
- distrobox-create: restore quote around pre-init-hooks arguments
- docs/usage: document new create and init options
- docs/useful_tips: explain the rationale behind --pre-init-hooks
Signed-off-by: Michel Alexandre Salim <michel@michel-slm.name>
This commit will add the `--root/-r` flag to create,enter,list,rm,stop
commands. This will enable the use of podman/docker in root mode. This
is the preferred way over `sudo distrobox`.
Update man pages and docs accordingly.
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>