Johannes Schauer Marin Rodrigues <[email protected]> writes: > how about an option like this: > > --failure-hook='chroot "$1" bash'
I don't care about the exact command, as long as it's documented. This suggestion sounds reasonable. > Since all hooks have the MMDEBSTRAP_HOOK variable set, whatever is run in the > hook would have access to the type of hook that failed. > > The information that would be missing would be *which* hook of a certain type > was the one failing. I do not see a good way to communicate this information. Ideally, mmdebstrap will tell you which command failed, so the user can cut/paste the failing command to reproduce the failure. This maybe is the most important thing to communicate? I might be missing the subtleties of what you're thinking. > Another question: what should be done if the failure-hook failed? Hmmm. The obvious thing to say would be "It doesn't matter; we failed, so mmdebstrap should just exit regardless". But maybe the hook can fix whatever the failure was, and if the hook callback succeeds, mmdebstrap can try again? In my usage of these in sbuild I'm always debugging failures, so just exiting regardless is the right thing. But maybe something smarter would be good too. > Do you know of another software besides sbuild that has a similar interface? > I'd like to get some more ideas first before I add another interface that > mmdebstrap would have to support forever. I can only thing of sbuild off the top of my head. But mmdebstrap already has a hook system, so extending that in the way you suggested above sounds like a self-consistent way to do it. > I would rather not add the percent escapes from sbuild as that would > mean that any percent sign in the hooks has to be escaped as well. > This would break existing users of hooks. Yeah. Let's conform to the existing mmdebstrap conventions > I'd also like to add that you can already emulate this behaviour by > running a hook like this: > > --customize-hook='chroot "$1" i-might-fail || chroot "$1" bash' I would want to add the '|| chroot "$1" bash' to everything mmdebstrap does: downloading packages, installing them, doing customization hooks, etc, etc. The above just applies to customization hooks, right? The actual failure I'd like to fix today is a failing "apt update" trying to talk to my apt-cacher-ng server (for some reason the server returns 502 only when mmdebstrap tries to talk to it). I don't believe there's a nice way to debug this with mmdebstrap today, right? I tried to use --SOMETHING-hook (don't remember what SOMETHING was), but it wasn't clear what the exact failing command was, so I moved on to something else. Printing the exact failing command for easy reproducibility would be important. Maybe there's already a verbosity level that does this? Thanks much!

