VirtualBox

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

Last change on this file since 96686 was 96686, checked in by vboxsync, 2 years ago

Add/Nt/Installer: Added some comments, cleanups and a slickedit NSIS config. bugref:10261

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.4 KB
Line 
1; $Id: VBoxGuestAdditionsExternal.nsh 96686 2022-09-10 23:36:01Z 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.
30;
31; Uses the nsExec plugin in different styles, depending on whether this
32; installer runs in silent mode or not. If the external program reports an exit
33; code other than 0 the installer will be aborted.
34;
35; @param Command line (full qualified and quoted).
36; @param If set to "false" the installer aborts if the external program reports
37; an exit code other than 0, "true" just prints a warning and continues
38; execution.
39;
40!macro _cmdExecute cmdline optional
41 ; Save $0 & $1
42 Push $0
43 Push $1
44
45 ;
46 ; Execute the command, putting the exit code in $0 when done.
47 ;
48 ${LogVerbose} "Executing: ${cmdline}"
49 ${If} ${Silent}
50 nsExec::ExecToStack "${cmdline}"
51 Pop $0 ; Return value (exit code)
52 Pop $1 ; Stdout/stderr output (up to ${NSIS_MAX_STRLEN})
53 ${LogVerbose} "$1"
54 ${Else}
55 nsExec::ExecToLog "${cmdline}"
56 Pop $0 ; Return value (exit code)
57 ${EndIf}
58
59 ${LogVerbose} "Execution returned exit code: $0"
60
61 ;
62 ; Check if it failed and take action according to the 2nd argument.
63 ;
64 ${If} $0 <> 0
65 ${If} ${optional} == "false"
66 ${LogVerbose} "Error excuting $\"${cmdline}$\" (exit code: $0) -- aborting installation"
67 Abort "Error excuting $\"${cmdline}$\" (exit code: $0) -- aborting installation"
68 ${Else}
69 ${LogVerbose} "Warning: Executing $\"${cmdline}$\" returned with exit code $0"
70 ${EndIf}
71 ${EndIf}
72
73 ; Restore $0 and $1.
74 Pop $1
75 Pop $0
76!macroend
77!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