akvirtualcamera/ports/deploy/installscript.nsi
Gonzalo Exequiel Pedone b0f83b8462
Final changes before the release.
Removed code to elevate privileges in Windows, now you must explicitly
run the manager as administrator.
Allow setting a device ID in the config file.
Changed wording from 'Device Path' to 'Device ID' (and similar ones),
this breaks previous devices configurations.
Return standard error codes in the manager.
Added plugin install path hint in Windows registry.
2021-06-21 18:25:48 -03:00

99 lines
2.8 KiB
Text

# akvirtualcamera, virtual camera for Mac and Windows.
# Copyright (C) 2021 Gonzalo Exequiel Pedone
#
# akvirtualcamera is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# akvirtualcamera is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with akvirtualcamera. If not, see <http://www.gnu.org/licenses/>.
#
# Web-Site: http://webcamoid.github.io/
!include LogicLib.nsh
!include x64.nsh
Var arch
Var narchs
Var assistantPath
Var managerPath
Function InstallPlugin
Push "x86"
StrCpy $narchs 1
${If} ${RunningX64}
Push "x64"
StrCpy $narchs 2
${EndIf}
${For} $R1 1 $narchs
Pop $arch
# Load assistant daemon.
StrCpy $assistantPath "$INSTDIR\$arch\AkVCamAssistant.exe"
${If} ${FileExists} "$assistantPath"
ExecShellWait "" "$assistantPath" "--install" SW_HIDE
${EndIf}
ExecShellWait "" "sc" "start AkVCamAssistant" SW_HIDE
${Next}
${If} ${RunningX64}
SetRegView 64
${EndIf}
WriteRegStr HKLM "SOFTWARE\Webcamoid\VirtualCamera" "installPath" "$INSTDIR"
SetRegView default
FunctionEnd
Function un.InstallPlugin
Push "x86"
StrCpy $narchs 1
${If} ${RunningX64}
Push "x64"
StrCpy $narchs 2
${EndIf}
${For} $R1 1 $narchs
Pop $arch
# If the assistant is not running, start it so it won't hang the manager.
StrCpy $assistantPath "$INSTDIR\$arch\AkVCamAssistant.exe"
ExecShellWait "" "sc" "start AkVCamAssistant" SW_HIDE
# Remove virtual cameras
StrCpy $managerPath "$INSTDIR\$arch\AkVCamManager.exe"
${If} ${FileExists} "$managerPath"
ExecShellWait "" "$managerPath" "remove-devices" SW_HIDE
ExecShellWait "" "$managerPath" "update" SW_HIDE
${EndIf}
# Uninstall assistant daemon.
ExecShellWait "" "sc" "stop AkVCamAssistant" SW_HIDE
${If} ${FileExists} "$assistantPath"
ExecShellWait "" "$assistantPath" "--uninstall" SW_HIDE
${EndIf}
# If the assistant is still alive, kill it, no mercy.
ExecShellWait "" "taskkill" "/F /IM AkVCamAssistant.exe" SW_HIDE
${Next}
FunctionEnd
!macro INSTALL_SCRIPT_AFTER_INSTALL
Call InstallPlugin
!macroend
!macro INSTALL_SCRIPT_UNINSTALL
Call un.InstallPlugin
!macroend