VirtualBox

source: vbox/trunk/src/VBox/Additions/WINNT/Installer/VBoxGuestAdditionsExternal.nsh@ 44459

最後變更 在這個檔案從44459是 44459,由 vboxsync 提交於 12 年 前

Windows Guest Additions installer: Invoke external calls via own function to also log stdout/stderr output into installer log files.

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Author Date Id Revision
檔案大小: 2.1 KB
 
1; $Id: VBoxGuestAdditionsExternal.nsh 44459 2013-01-30 11:23:57Z vboxsync $
2;; @file
3; VBoxGuestAdditionExternal.nsh - Utility function for invoking external
4; applications.
5;
6
7;
8; Copyright (C) 2013 Oracle Corporation
9;
10; This file is part of VirtualBox Open Source Edition (OSE), as
11; available from http://www.alldomusa.eu.org. This file is free software;
12; you can redistribute it and/or modify it under the terms of the GNU
13; General Public License (GPL) as published by the Free Software
14; Foundation, in version 2 as it comes in the "COPYING" file of the
15; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
16; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
17;
18
19;
20; Macro for executing external applications. Uses the nsExec plugin
21; in different styles, depending on whether this installer runs in silent mode
22; or not. If the external program reports an exit code other than 0 the installer
23; will be aborted.
24;
25; @param Command line (full qualified and quoted).
26; @param If set to "true" the installer aborts if the external program reports
27; an exit code other than 0, "false" just prints a warning and continues
28; execution.
29;
30!macro _cmdExecute cmdline optional
31
32 Push $0
33 Push $1
34
35 !define _macroLoc ${__LINE__}
36
37 ${LogVerbose} "Executing: ${cmdline}"
38 IfSilent 0 +6
39 nsExec::ExecToStack "${cmdline}"
40 Pop $0 ; Return value (exit code)
41 Pop $1 ; Stdout/stderr output (up to ${NSIS_MAX_STRLEN})
42 ${LogVerbose} "$1"
43 goto done_${_macroLoc}
44
45 nsExec::ExecToLog "${cmdline}"
46 Pop $0 ; Return value (exit code)
47 goto done_${_macroLoc}
48
49done_${_macroLoc}:
50
51 ${LogVerbose} "Execution returned: $0"
52 IntCmp $0 0 +1 error_${_macroLoc} error_${_macroLoc} ; Check ret value (0=OK, 1=Error)
53 goto return_${_macroLoc}
54
55error_${_macroLoc}:
56
57 ${If} ${optional} == "false"
58 ${LogVerbose} "Error excuting $\"${cmdline}$\" (Return value: $0) -- aborting installation"
59 Abort
60 ${Else}
61 ${LogVerbose} "Warning: Executing $\"${cmdline}$\" returned with exit code $0"
62 ${EndIf}
63 goto return_${_macroLoc}
64
65return_${_macroLoc}:
66
67 Pop $1
68 Pop $0
69
70 !undef _macroLoc
71
72!macroend
73!define CmdExecute "!insertmacro _cmdExecute"
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette