VirtualBox

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

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

scm copyright and license note update

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.5 KB
Line 
1; $Id: VBoxGuestAdditionsExternal.nsh 96407 2022-08-22 17:43:14Z vboxsync $
2;; @file
3; VBoxGuestAdditionExternal.nsh - Utility function for invoking external applications.
4;
5
6;
7; Copyright (C) 2013-2022 Oracle and/or its affiliates.
8;
9; This file is part of VirtualBox base platform packages, as
10; available from https://www.virtualbox.org.
11;
12; This program is free software; you can redistribute it and/or
13; modify it under the terms of the GNU General Public License
14; as published by the Free Software Foundation, in version 3 of the
15; License.
16;
17; This program is distributed in the hope that it will be useful, but
18; WITHOUT ANY WARRANTY; without even the implied warranty of
19; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20; General Public License for more details.
21;
22; You should have received a copy of the GNU General Public License
23; along with this program; if not, see <https://www.gnu.org/licenses>.
24;
25; SPDX-License-Identifier: GPL-3.0-only
26;
27
28;
29; Macro for executing external applications. Uses the nsExec plugin
30; in different styles, depending on whether this installer runs in silent mode
31; or not. If the external program reports an exit code other than 0 the installer
32; will be aborted.
33;
34; @param Command line (full qualified and quoted).
35; @param If set to "false" the installer aborts if the external program reports
36; an exit code other than 0, "true" just prints a warning and continues
37; execution.
38;
39!macro _cmdExecute cmdline optional
40
41 Push $0
42 Push $1
43
44 !define _macroLoc ${__LINE__}
45
46 ${LogVerbose} "Executing: ${cmdline}"
47 IfSilent silent_${_macroLoc} +1
48 nsExec::ExecToLog "${cmdline}"
49 Pop $0 ; Return value (exit code)
50 goto done_${_macroLoc}
51
52silent_${_macroLoc}:
53
54 nsExec::ExecToStack "${cmdline}"
55 Pop $0 ; Return value (exit code)
56 Pop $1 ; Stdout/stderr output (up to ${NSIS_MAX_STRLEN})
57 ${LogVerbose} "$1"
58 goto done_${_macroLoc}
59
60done_${_macroLoc}:
61
62 ${LogVerbose} "Execution returned exit code: $0"
63 IntCmp $0 0 +1 error_${_macroLoc} error_${_macroLoc} ; Check ret value (0=OK, 1=Error)
64 goto return_${_macroLoc}
65
66error_${_macroLoc}:
67
68 ${If} ${optional} == "false"
69 ${LogVerbose} "Error excuting $\"${cmdline}$\" (exit code: $0) -- aborting installation"
70 Abort "Error excuting $\"${cmdline}$\" (exit code: $0) -- aborting installation"
71 ${Else}
72 ${LogVerbose} "Warning: Executing $\"${cmdline}$\" returned with exit code $0"
73 ${EndIf}
74 goto return_${_macroLoc}
75
76return_${_macroLoc}:
77
78 Pop $1
79 Pop $0
80
81 !undef _macroLoc
82
83!macroend
84!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