[Libguestfs] [p2v PATCH 1/4] Makefile.am: factor out "make-physical-machine.sh"

Richard W.M. Jones rjones at redhat.com
Tue Aug 30 13:07:37 UTC 2022


On Fri, Aug 26, 2022 at 07:39:31AM -0500, Eric Blake wrote:
> On Fri, Aug 26, 2022 at 01:39:05PM +0200, Laszlo Ersek wrote:
> > Extract and somewhat generalize the recipe for the $(PHYSICAL_MACHINE)
> > target to a separate shell script. In preparation for the multiple steps
> > we're going to introduce later, redirect virt-builder to a temp file at
> > first (placed in the same directory as the finally expected disk image),
> > and rename that file upon success.
> > 
> > Signed-off-by: Laszlo Ersek <lersek at redhat.com>
> > ---
> 
> > +++ b/make-physical-machine.sh
> > @@ -0,0 +1,37 @@
> > +#!/bin/bash -
> 
> See the response in the other thread about not needing the - here.
> Are we sure that /bin/bash is on all systems where this script will be
> run, or is it better as '#!/bin/env bash'?

Realisticly virt-p2v only makes sense on Linux, both when used to
prepare the P2V ISO, as well as the environment in which the ISO
boots.

eg: Using virt-p2v on (say) FreeBSD to prepare a Linux ISO?  The
FreeBSD folk would prefer that the built ISO contained FreeBSD, but
that would require a small mountain of work.

> > +
> > +set -e -u -C
> 
> My personal opinion is that 'set -e' is a crutch that should be
> avoided because of its unintended interaction with functions; but I'm
> not adamant enough about it to tell people to rip it out of scripts.
> For short scripts, like this one, it's easy enough to check that we
> aren't tripping over any of -e's surprises.

I'm confused too: what's the problem with set -e?  Compared to _not_
having set -e which allows scripts to continue running after errors.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
nbdkit - Flexible, fast NBD server with plugins
https://gitlab.com/nbdkit/nbdkit


More information about the Libguestfs mailing list