Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Error] Multiple init hooks in a distrobox assemble break the creation #844

Closed
Nitrousoxide opened this issue Jul 8, 2023 · 1 comment
Closed
Labels
bug Something isn't working

Comments

@Nitrousoxide
Copy link

Please, before opening a bug:

Describe the bug
Multiple init hooks will break a distrobox assemble operation.

To Reproduce
Create an assemble file with at least two init hooks.

Here is an example file:

[Boxkit-Assemble]
image=quay.io/toolbx-images/alpine-toolbox:edge
init=false
init_hooks="apk update && apk upgrade"
init_hooks="ln -fs /usr/bin/distrobox-host-exec /usr/local/bin/podman"
nvidia=false
pull=true
root=false
replace=true
start_now=true

Commenting out either of those init hooks and leaving the other in operation will work fine.

Moving the ln command into the first init hook just seperated by &&'s will work as well

[Boxkit-Assemble]
image=quay.io/toolbx-images/alpine-toolbox:edge
init=false
init_hooks="apk update && apk upgrade && ln -fs /usr/bin/distrobox-host-exec /usr/local/bin/podman"
#init_hooks="ln -fs /usr/bin/distrobox-host-exec /usr/local/bin/podman"
nvidia=false
pull=true
root=false
replace=true
start_now=true

Expected behavior
Both inits should be run with && between them or run as separate lines. The ability to use multiple init lines makes the file much more readable.

Logs

+ printf 'distrobox: Executing init hooks...\n'
+ eval : '&&' apk update '&&' apk upgrade ln -fs /usr/bin/distrobox-host-exec /usr/local/bin/podman
+ :
+ apk update
+ apk upgrade ln -fs /usr/bin/distrobox-host-exec /usr/local/bin/podman
ERROR: Package 'ln' not found
ERROR: Package '/usr/bin/distrobox-host-exec' not found
ERROR: Package '/usr/local/bin/podman' not found
+ '[' 3 -ne 0 ]
+ printf 'Error: An error occurred\n'

Desktop (please complete the following information):

  • Are you using podman or docker? Podman
  • Which version or podman or docker? podman version 4.5.1
  • Which version of distrobox? distrobox version: 1.5.0.2
@89luca89
Copy link
Owner

89luca89 commented Aug 3, 2023

Hi @Nitrousoxide

this was missing in the documentation, each hook needs to end with ; in order to execute them one by one

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants