[Libguestfs] [PATCH 03/11] customize: fix windows firstboot script

Roman Kagan rkagan at virtuozzo.com
Fri May 13 07:36:10 UTC 2016


On Fri, May 13, 2016 at 09:17:40AM +0200, Cedric Bosdonnat wrote:
> On Thu, 2016-05-12 at 17:24 +0300, Roman Kagan wrote:
> > On Thu, May 12, 2016 at 03:29:11PM +0200, Cédric Bosdonnat wrote:
> > > @@ -244,15 +244,14 @@ if not exist \"%%scripts_done%%\" (
> > >  
> > >  for %%%%f in (\"%%scripts%%\"\\*.bat) do (
> > >    echo running \"%%%%f\"
> > > -  call \"%%%%f\"
> > > -  set elvl=!errorlevel!
> > > -  echo .... exit code !elvl!
> > > -  if !elvl! equ 0 (
> > > -    move \"%%%%f\" \"%%scripts_done%%\"
> > > -  )
> > > +  move \"%%%%f\" \"%%scripts_done%%\"
> > > +  pushd \"%%scripts_done%%\"
> > > +  call \"%%%%~nf\"
> > > +  popd
> > >  )
> > >  
> > >  echo uninstalling firstboot service
> > > +rmdir /S /Q \"%%scripts_done%%\"
> > 
> > How will you debug failures then?
> > (And yes, linux firstboot is broken in this regard, too)
> 
> Good question! But I think this should be fixed in both linux and
> windows cases in another commit. This one is only catching up what we
> have in the linux case.
> 
> For the debugging purpose, couldn't we delete the successfully run
> scripts one by one after they have run?

IMO deleting anything is a bad idea, in particular, because a succefully
completed script may cause the following ones to fail.

The whole point of scripts_done is to preserve all the steps but move
them out of the way.

I think the only controversial item is whether to move them to
scripts_done on success only or regardless of the status: there are pros
and cons either way.

Roman.




More information about the Libguestfs mailing list