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

Cedric Bosdonnat cbosdonnat at suse.com
Fri May 13 07:17:40 UTC 2016


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:
> > Sync the windows firstboot script with its linux brother. Also
> > change
> > the main redirection to append to the log rather than overwriting
> > it.
> > With this change, the firstboot script will resist reboots in the
> > executed scripts.
> > ---
> >  customize/firstboot.ml | 13 ++++++-------
> >  1 file changed, 6 insertions(+), 7 deletions(-)
> > 
> > diff --git a/customize/firstboot.ml b/customize/firstboot.ml
> > index aa5b694..83bd808 100644
> > --- a/customize/firstboot.ml
> > +++ b/customize/firstboot.ml
> > @@ -232,7 +232,7 @@ set log=%%firstboot%%\\log.txt
> >  set scripts=%%firstboot%%\\scripts
> >  set scripts_done=%%firstboot%%\\scripts-done
> >  
> > -call :main > \"%%log%%\" 2>&1
> > +call :main >> \"%%log%%\" 2>&1
> >  exit /b
> >  
> >  :main
> > @@ -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?

--
Cedric

> >  rhsrvany.exe -s firstboot uninstall
> >  " firstboot_dir_win in
> >  




More information about the Libguestfs mailing list