[Pkg-libvirt-commits] [libguestfs] 31/72: firstboot: enhance firstboot driver script for Windows

Hilko Bengen bengen at moszumanska.debian.org
Sun Apr 5 15:19:49 UTC 2015


This is an automated email from the git hooks/post-receive script.

bengen pushed a commit to branch master
in repository libguestfs.

commit 1999e5f3ad51c3da6a4b6d8cc025a0bd8efb2566
Author: Roman Kagan <rkagan at parallels.com>
Date:   Fri Feb 27 15:20:16 2015 +0300

    firstboot: enhance firstboot driver script for Windows
    
    This patch is an attempt to enhance the firstboot driver script for
    Windows, and make it somewhat closer in functionality to what is done
    for Linux guests.
    
    Specifically, for every firstboot script it now will log its exit
    status, and, if the script reported success, move it to -done directory.
    
    Signed-off-by: Roman Kagan <rkagan at parallels.com>
    (cherry picked from commit 7aa9d6367478402556e5185a7b2f241c38de9c39)
---
 customize/firstboot.ml | 35 +++++++++++++++++++++++++++++------
 1 file changed, 29 insertions(+), 6 deletions(-)

diff --git a/customize/firstboot.ml b/customize/firstboot.ml
index 520a212..93c05d8 100644
--- a/customize/firstboot.ml
+++ b/customize/firstboot.ml
@@ -210,16 +210,39 @@ module Windows = struct
      * scripts in the directory.  Note we need to use CRLF line endings
      * in this script.
      *)
-    let firstboot_script = "\
+    let firstboot_script = sprintf "\
 @echo off
 
-echo starting firstboot service >>log.txt
+setlocal EnableDelayedExpansion
+set firstboot=%s
+set log=%%firstboot%%\\log.txt
 
-for /f %%f in ('dir /b scripts') do call \"scripts\\%%f\" >>log.txt
+set scripts=%%firstboot%%\\scripts
+set scripts_done=%%firstboot%%\\scripts-done
 
-echo uninstalling firstboot service >>log.txt
-rhsrvany.exe -s firstboot uninstall >>log.txt
-" in
+call :main > \"%%log%%\" 2>&1
+exit /b
+
+:main
+echo starting firstboot service
+
+if not exist \"%%scripts_done%%\" (
+  mkdir \"%%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%%\"
+  )
+)
+
+echo uninstalling firstboot service
+rhsrvany.exe -s firstboot uninstall
+" firstboot_dir_win in
 
     g#write (firstboot_dir // "firstboot.bat") (unix2dos firstboot_script);
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-libvirt/libguestfs.git



More information about the Pkg-libvirt-commits mailing list