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

Roman Kagan rkagan at virtuozzo.com
Thu May 12 14:24:43 UTC 2016


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)

>  rhsrvany.exe -s firstboot uninstall
>  " firstboot_dir_win in
>  
> -- 
> 2.6.6
> 
> _______________________________________________
> Libguestfs mailing list
> Libguestfs at redhat.com
> https://www.redhat.com/mailman/listinfo/libguestfs




More information about the Libguestfs mailing list