VirtualBox

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

Last change on this file since 45965 was 44484, checked in by vboxsync, 12 years ago

Windows Guest Additions installer: Relative jump bugfixes, simplified OS detection, logging.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.2 KB
Line 
1; $Id: VBoxGuestAdditionsExternal.nsh 44484 2013-01-31 11:36:25Z 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.virtualbox.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 silent_${_macroLoc} +1
39 nsExec::ExecToLog "${cmdline}"
40 Pop $0 ; Return value (exit code)
41 goto done_${_macroLoc}
42
43silent_${_macroLoc}:
44
45 nsExec::ExecToStack "${cmdline}"
46 Pop $0 ; Return value (exit code)
47 Pop $1 ; Stdout/stderr output (up to ${NSIS_MAX_STRLEN})
48 ${LogVerbose} "$1"
49 goto done_${_macroLoc}
50
51done_${_macroLoc}:
52
53 ${LogVerbose} "Execution returned exit code: $0"
54 IntCmp $0 0 +1 error_${_macroLoc} error_${_macroLoc} ; Check ret value (0=OK, 1=Error)
55 goto return_${_macroLoc}
56
57error_${_macroLoc}:
58
59 ${If} ${optional} == "false"
60 ${LogVerbose} "Error excuting $\"${cmdline}$\" (exit code: $0) -- aborting installation"
61 Abort "Error excuting $\"${cmdline}$\" (exit code: $0) -- aborting installation"
62 ${Else}
63 ${LogVerbose} "Warning: Executing $\"${cmdline}$\" returned with exit code $0"
64 ${EndIf}
65 goto return_${_macroLoc}
66
67return_${_macroLoc}:
68
69 Pop $1
70 Pop $0
71
72 !undef _macroLoc
73
74!macroend
75!define CmdExecute "!insertmacro _cmdExecute"
Note: See TracBrowser for help on using the repository browser.

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