* 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>