summaryrefslogtreecommitdiff
path: root/src/VBox/Additions/WINNT/Installer/VBoxGuestAdditionsExternal.nsh
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@baserock.org>2014-03-26 19:21:20 +0000
committer <>2014-05-08 15:03:54 +0000
commitfb123f93f9f5ce42c8e5785d2f8e0edaf951740e (patch)
treec2103d76aec5f1f10892cd1d3a38e24f665ae5db /src/VBox/Additions/WINNT/Installer/VBoxGuestAdditionsExternal.nsh
parent58ed4748338f9466599adfc8a9171280ed99e23f (diff)
downloadVirtualBox-master.tar.gz
Imported from /home/lorry/working-area/delta_VirtualBox/VirtualBox-4.3.10.tar.bz2.HEADVirtualBox-4.3.10master
Diffstat (limited to 'src/VBox/Additions/WINNT/Installer/VBoxGuestAdditionsExternal.nsh')
-rw-r--r--src/VBox/Additions/WINNT/Installer/VBoxGuestAdditionsExternal.nsh75
1 files changed, 75 insertions, 0 deletions
diff --git a/src/VBox/Additions/WINNT/Installer/VBoxGuestAdditionsExternal.nsh b/src/VBox/Additions/WINNT/Installer/VBoxGuestAdditionsExternal.nsh
new file mode 100644
index 00000000..11a94451
--- /dev/null
+++ b/src/VBox/Additions/WINNT/Installer/VBoxGuestAdditionsExternal.nsh
@@ -0,0 +1,75 @@
+; $Id: VBoxGuestAdditionsExternal.nsh $
+;; @file
+; VBoxGuestAdditionExternal.nsh - Utility function for invoking external
+; applications.
+;
+
+;
+; Copyright (C) 2013 Oracle Corporation
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License (GPL) as published by the Free Software
+; Foundation, in version 2 as it comes in the "COPYING" file of the
+; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+
+;
+; Macro for executing external applications. Uses the nsExec plugin
+; in different styles, depending on whether this installer runs in silent mode
+; or not. If the external program reports an exit code other than 0 the installer
+; will be aborted.
+;
+; @param Command line (full qualified and quoted).
+; @param If set to "true" the installer aborts if the external program reports
+; an exit code other than 0, "false" just prints a warning and continues
+; execution.
+;
+!macro _cmdExecute cmdline optional
+
+ Push $0
+ Push $1
+
+ !define _macroLoc ${__LINE__}
+
+ ${LogVerbose} "Executing: ${cmdline}"
+ IfSilent silent_${_macroLoc} +1
+ nsExec::ExecToLog "${cmdline}"
+ Pop $0 ; Return value (exit code)
+ goto done_${_macroLoc}
+
+silent_${_macroLoc}:
+
+ nsExec::ExecToStack "${cmdline}"
+ Pop $0 ; Return value (exit code)
+ Pop $1 ; Stdout/stderr output (up to ${NSIS_MAX_STRLEN})
+ ${LogVerbose} "$1"
+ goto done_${_macroLoc}
+
+done_${_macroLoc}:
+
+ ${LogVerbose} "Execution returned exit code: $0"
+ IntCmp $0 0 +1 error_${_macroLoc} error_${_macroLoc} ; Check ret value (0=OK, 1=Error)
+ goto return_${_macroLoc}
+
+error_${_macroLoc}:
+
+ ${If} ${optional} == "false"
+ ${LogVerbose} "Error excuting $\"${cmdline}$\" (exit code: $0) -- aborting installation"
+ Abort "Error excuting $\"${cmdline}$\" (exit code: $0) -- aborting installation"
+ ${Else}
+ ${LogVerbose} "Warning: Executing $\"${cmdline}$\" returned with exit code $0"
+ ${EndIf}
+ goto return_${_macroLoc}
+
+return_${_macroLoc}:
+
+ Pop $1
+ Pop $0
+
+ !undef _macroLoc
+
+!macroend
+!define CmdExecute "!insertmacro _cmdExecute"