VirtualBox

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

Last change on this file since 94377 was 93115, checked in by vboxsync, 3 years ago

scm --update-copyright-year

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