[Libguestfs] [PATCH v3 1/3] customize: fix windows firstboot script

Cédric Bosdonnat cbosdonnat at suse.com
Mon May 23 13:31:44 UTC 2016


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 | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/customize/firstboot.ml b/customize/firstboot.ml
index d9c012f..1f4a940 100644
--- a/customize/firstboot.ml
+++ b/customize/firstboot.ml
@@ -238,7 +238,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
@@ -250,12 +250,12 @@ if not exist \"%%scripts_done%%\" (
 
 for %%%%f in (\"%%scripts%%\"\\*.bat) do (
   echo running \"%%%%f\"
-  call \"%%%%f\"
+  move \"%%%%f\" \"%%scripts_done%%\"
+  pushd \"%%scripts_done%%\"
+  call \"%%%%~nf\"
   set elvl=!errorlevel!
   echo .... exit code !elvl!
-  if !elvl! equ 0 (
-    move \"%%%%f\" \"%%scripts_done%%\"
-  )
+  popd
 )
 
 echo uninstalling firstboot service
-- 
2.6.6




More information about the Libguestfs mailing list