[vlc-commits] nsis: kill VLC before copying/updating any file
Ludovic Fauvet
git at videolan.org
Thu Dec 5 13:03:33 CET 2013
vlc/vlc-2.1 | branch: master | Ludovic Fauvet <etix at videolan.org> | Thu Nov 28 13:45:31 2013 +0100| [4e5135b3f335cc0e2dc8aa1ca238a72a91f36c20] | committer: Ludovic Fauvet
nsis: kill VLC before copying/updating any file
During silent installations (/S) the installer will automatically kill
(without warning) any running instance of VLC before copying files.
Silent updates should now work using the flags /S /update.
Signed-off-by: Ludovic Fauvet <etix at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.1.git/?a=commit;h=4e5135b3f335cc0e2dc8aa1ca238a72a91f36c20
---
extras/package/win32/NSIS/helpers/utils.nsh | 29 +++++++++++++++++++-
.../package/win32/NSIS/languages/declaration.nsh | 5 ++++
extras/package/win32/NSIS/languages/english.nsh | 5 ++++
extras/package/win32/NSIS/vlc.win32.nsi.in | 4 +++
4 files changed, 42 insertions(+), 1 deletion(-)
diff --git a/extras/package/win32/NSIS/helpers/utils.nsh b/extras/package/win32/NSIS/helpers/utils.nsh
index b19b03e..4a6c773 100644
--- a/extras/package/win32/NSIS/helpers/utils.nsh
+++ b/extras/package/win32/NSIS/helpers/utils.nsh
@@ -239,4 +239,31 @@ Function un.RemoveEmptyDirs
"${Index}-End:"
FindClose $0
!undef Index
-FunctionEnd
\ No newline at end of file
+FunctionEnd
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+; Check if VLC is running and kill it if necessary ;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+Function CheckRunningProcesses
+ ${nsProcess::FindProcess} "vlc.exe" $R0
+ StrCmp $R0 0 0 end
+ IfSilent +3
+ BringToFront
+ MessageBox MB_OKCANCEL|MB_ICONQUESTION $MessageBox_VLCRunning IDCANCEL stop
+
+ ${nsProcess::CloseProcess} "vlc.exe" $R0
+ IfSilent end
+ StrCmp $R0 0 end 0 ; Success
+ StrCmp $R0 603 end 0 ; Not running
+ MessageBox MB_OK|MB_ICONEXCLAMATION $MessageBox_VLCUnableToClose
+ goto end
+
+ stop:
+ ${nsProcess::Unload}
+ MessageBox MB_OK|MB_ICONEXCLAMATION $MessageBox_InstallAborted
+ Quit
+
+ end:
+ ${nsProcess::Unload}
+FunctionEnd
diff --git a/extras/package/win32/NSIS/languages/declaration.nsh b/extras/package/win32/NSIS/languages/declaration.nsh
index 9471027..ef5fbc2 100644
--- a/extras/package/win32/NSIS/languages/declaration.nsh
+++ b/extras/package/win32/NSIS/languages/declaration.nsh
@@ -47,6 +47,11 @@ Var Action_OnArrivalDVDAudio
Var License_NextText
+Var Detail_CheckProcesses
+Var MessageBox_VLCRunning
+Var MessageBox_VLCUnableToClose
+Var MessageBox_InstallAborted
+
Var Reinstall_Headline
Var Reinstall_HeadlineInstall
Var Reinstall_HeadlineMaintenance
diff --git a/extras/package/win32/NSIS/languages/english.nsh b/extras/package/win32/NSIS/languages/english.nsh
index 6b399ad..f42b1dd 100644
--- a/extras/package/win32/NSIS/languages/english.nsh
+++ b/extras/package/win32/NSIS/languages/english.nsh
@@ -59,6 +59,11 @@ StrCpy $Action_OnArrivalDVDAudio "Play audio DVD"
StrCpy $License_NextText "You are now aware of your rights. Click Next to continue."
+StrCpy $Detail_CheckProcesses "Checking processes..."
+StrCpy $MessageBox_VLCRunning "VLC appears to be running and will now be closed."
+StrCpy $MessageBox_VLCUnableToClose "This installer was unable to close VLC, please do it manually."
+StrCpy $MessageBox_InstallAborted "Installation aborted!"
+
StrCpy $Reinstall_Headline "Already Installed"
StrCpy $Reinstall_HeadlineInstall "Choose how you want to install VLC."
StrCpy $Reinstall_HeadlineMaintenance "Choose the maintenance option to perform."
diff --git a/extras/package/win32/NSIS/vlc.win32.nsi.in b/extras/package/win32/NSIS/vlc.win32.nsi.in
index a5f232b..33f162e 100644
--- a/extras/package/win32/NSIS/vlc.win32.nsi.in
+++ b/extras/package/win32/NSIS/vlc.win32.nsi.in
@@ -60,6 +60,7 @@ RequestExecutionLevel user
!addincludedir NSIS
!addplugindir NSIS
!include UAC.nsh
+!include nsProcess.nsh
!include WinVer.nsh
!include FileFunc.nsh
!include MUI2.nsh
@@ -167,6 +168,9 @@ ${MementoSection} $Name_Section01 SEC01
SetShellVarContext all
SetOutPath "$INSTDIR"
+ DetailPrint $Detail_CheckProcesses
+ Call CheckRunningProcesses
+
!insertmacro OpenUninstallLog
; VLC.exe, libvlc.dll
More information about the vlc-commits
mailing list