summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristophe Fergeau <cfergeau@redhat.com>2015-04-27 19:20:29 +0200
committerChristophe Fergeau <cfergeau@redhat.com>2015-04-28 12:45:26 +0200
commit06c0d08d05f9fd8f67fde72b4289c226714d1f29 (patch)
tree9fc59363c4e58c90c912f64777e5b10a0ff12c96
parent18dbe4679a3d99655881482061dcfec081561bc0 (diff)
nsis: Add InstallVdagentService helper
It uses this SimpleSC plugin to install VDAgent rather than manual command invocation
-rw-r--r--spice-guest-tools.nsis56
1 files changed, 47 insertions, 9 deletions
diff --git a/spice-guest-tools.nsis b/spice-guest-tools.nsis
index 26f0f9f..57c1bd1 100644
--- a/spice-guest-tools.nsis
+++ b/spice-guest-tools.nsis
@@ -118,15 +118,7 @@ Section "spice-guest-tools"
Push "PCI\VEN_1AF4&DEV_1000&SUBSYS_00011AF4&REV_00"
Call InstallDriver
-
- ${if} ${RunningX64}
- SetOutPath "$INSTDIR\64"
- ${else}
- SetOutPath "$INSTDIR\32"
- ${endif}
- nsExec::ExecToLog 'vdservice install'
- nsExec::ExecToLog 'net start vdservice'
-
+ Call InstallVdAgentService
SectionEnd
Section "Start Menu Shortcuts"
@@ -263,3 +255,49 @@ FunctionEnd
!insertmacro StopServices ""
!insertmacro StopServices "un."
+
+Function InstallService
+ pop $R0 #service name
+ pop $R1 #service path
+ pop $R2 #service pretty name
+
+ SimpleSC::ExistsService $R0
+ Pop $0
+ ${if} $0 == 0
+ DetailPrint "$R2 service already installed"
+ goto InstallService
+ ${endif}
+
+ DetailPrint "Installing $R2 service"
+ SimpleSC::InstallService $R0 $R2 16 2 $R1 "" "" ""
+ Pop $0
+ ${if} $0 != 0
+ DetailPrint "Failed to install $R2 service: $0"
+ Return
+ ${endif}
+ DetailPrint "$R2 service installed"
+
+InstallService:
+ DetailPrint "Starting $R2 service"
+ SimpleSC::StartService $R0 "" 30
+ Pop $0
+ ${if} $0 != 0
+ DetailPrint "Failed to start $R2 service: $0"
+ Return
+ ${endif}
+ DetailPrint "$R2 service started"
+FunctionEnd
+
+Function InstallVdAgentService
+ ${if} ${RunningX64}
+ StrCpy $0 "$INSTDIR\64\vdservice.exe"
+ ${else}
+ StrCpy $0 "$INSTDIR\32\vdservice.exe"
+ ${endif}
+
+ push "SPICE VDAgent"
+ push $0
+ push "vdservice"
+ Call InstallService
+
+FunctionEnd