[virt-tools-list] [PATCH virt-viewer 1/5] win32: clean-up the NSIS installer, allow user install

Marc-André Lureau marcandre.lureau at gmail.com
Fri Mar 30 01:37:41 UTC 2012


---
 data/virt-viewer.nsis.in |   61 ++++++++++++++++++++++++++++-----------------
 1 files changed, 38 insertions(+), 23 deletions(-)

diff --git a/data/virt-viewer.nsis.in b/data/virt-viewer.nsis.in
index a96d958..2ba4526 100644
--- a/data/virt-viewer.nsis.in
+++ b/data/virt-viewer.nsis.in
@@ -7,28 +7,42 @@
 # which will generate the output file 'virt-viewer- at VERSION@.exe' which is a Windows
 # installer containing your program.
 
-Name "virt-viewer"
+Name "VirtViewer @VERSION@"
 OutFile "virt-viewer- at VERSION@.exe"
-InstallDir "c:\virt-viewer"
-InstallDirRegKey HKLM SOFTWARE\virt-viewer "Install_Dir"
+InstallDir "$LOCALAPPDATA\virt-viewer"
+InstallDirRegKey HKCU "Software\virt-viewer" ""
 
+RequestExecutionLevel user
+SetCompressor bzip2
 ShowInstDetails hide
 ShowUninstDetails hide
-
-SetCompressor bzip2
-
 XPStyle on
 
-# Page components
 Page directory
 Page instfiles
 
-ComponentText "Select which optional components you want to install."
-
-DirText "Please select the installation folder."
-
-Section "virt-viewer"
+!define REG_UNINSTALL "Software\Microsoft\Windows\CurrentVersion\Uninstall\virt-viewer"
+
+Function RegisterApplication
+    ;Register uninstaller into Add/Remove panel (for local user only)
+    WriteRegStr HKCU "${REG_UNINSTALL}" "DisplayName" "VirtViewer @VERSION@"
+    WriteRegStr HKCU "${REG_UNINSTALL}" "DisplayIcon" "$\"$INSTDIR\bin\virt-viewer.exe$\""
+    WriteRegStr HKCU "${REG_UNINSTALL}" "Publisher" "virt-manager.org"
+    WriteRegStr HKCU "${REG_UNINSTALL}" "DisplayVersion" "@VERSION@"
+    WriteRegDWord HKCU "${REG_UNINSTALL}" "EstimatedSize" 32000 ;KB
+    WriteRegStr HKCU "${REG_UNINSTALL}" "HelpLink" "http://www.virt-manager.org"
+    WriteRegStr HKCU "${REG_UNINSTALL}" "URLInfoAbout" "http://www.virt-manager.org"
+    WriteRegStr HKCU "${REG_UNINSTALL}" "InstallLocation" "$\"$INSTDIR$\""
+    WriteRegStr HKCU "${REG_UNINSTALL}" "InstallSource" "$\"$EXEDIR$\""
+    WriteRegDWord HKCU "${REG_UNINSTALL}" "NoModify" 1
+    WriteRegDWord HKCU "${REG_UNINSTALL}" "NoRepair" 1
+    WriteRegStr HKCU "${REG_UNINSTALL}" "UninstallString" "$\"$INSTDIR\Uninstall.exe$\""
+    WriteRegStr HKCU "${REG_UNINSTALL}" "Comments" "Uninstalls VirtViewer."
+FunctionEnd
+
+Section "VirtViewer"
   SectionIn RO
+  WriteRegStr HKCU "Software\virt-viewer" "" $INSTDIR
 
   SetOutPath "$INSTDIR\bin"
   File "@prefix@/bin/gst-discoverer-0.10.exe"
@@ -153,27 +167,27 @@ Section "virt-viewer"
   nsExec::ExecToLog '$0 /C bin\pango-querymodules.exe > etc\pango\pango.modules'
   nsExec::ExecToLog 'echo gtk-theme-name = "MS-Windows" > etc\gtk-2.0\gtkrc'
 
+  # make virt-viewer the default spice-x client
   WriteRegStr HKCU "Software\spice-space.org\spicex" "client" "$INSTDIR\bin\remote-viewer.exe --spice-controller"
 
 SectionEnd
 
 Section "Start Menu Shortcuts"
-  CreateDirectory "$SMPROGRAMS\virt-viewer"
-  CreateShortCut "$SMPROGRAMS\virt-viewer\Uninstall virt-viewer.lnk" "$INSTDIR\Uninstall virt-viewer.exe" "" "$INSTDIR\Uninstall virt-viewer.exe" 0
-#  CreateShortCut "$SMPROGRAMS\virt-viewer\virt-viewer.exe.lnk" "$INSTDIR\bin\virt-viewer.exe" "" "$INSTDIR\bin\virt-viewer.exe" 0
-SectionEnd
-
-Section "Desktop Icons"
-#  CreateShortCut "$DESKTOP\virt-viewer.exe.lnk" "$INSTDIR\bin\virt-viewer.exe" "" "$INSTDIR\bin\virt-viewer.exe" 0
+  CreateDirectory "$SMPROGRAMS\VirtViewer"
+  CreateShortCut "$SMPROGRAMS\VirtViewer\Remote Viewer.lnk" "$INSTDIR\bin\remote-viewer.exe" "" "$INSTDIR\bin\remote-viewer.exe" 0
+  CreateShortCut "$SMPROGRAMS\VirtViewer\Uninstall.lnk" "$INSTDIR\Uninstall.exe" "" "$INSTDIR\Uninstall.exe" 0
 SectionEnd
 
 Section "Uninstall"
-#  Delete /rebootok "$DESKTOP\virt-viewer.exe.lnk"
-#  Delete /rebootok "$SMPROGRAMS\virt-viewer\virt-viewer.exe.lnk"
-  Delete /rebootok "$SMPROGRAMS\virt-viewer\Uninstall virt-viewer.lnk"
+  Delete /rebootok "$SMPROGRAMS\VirtViewer\Uninstall.lnk"
+  Delete /rebootok "$SMPROGRAMS\VirtViewer\Remote Viewer.lnk"
   RMDir "$SMPROGRAMS\virt-viewer"
 
   DeleteRegKey HKCU "Software\spice-space.org\spicex\client"
+  DeleteRegKey /ifempty HKCU "Software\spice-space.org\spicex"
+  DeleteRegKey /ifempty HKCU "Software\spice-space.org"
+  DeleteRegKey HKCU "Software\virt-viewer"
+  DeleteRegKey HKCU "${REG_UNINSTALL}"
 
   RMDir /r "$INSTDIR\lib\pango"
 
@@ -267,5 +281,6 @@ Section "Uninstall"
 SectionEnd
 
 Section -post
-  WriteUninstaller "$INSTDIR\Uninstall virt-viewer.exe"
+  WriteUninstaller "$INSTDIR\Uninstall.exe"
+  Call RegisterApplication
 SectionEnd
-- 
1.7.7.6




More information about the virt-tools-list mailing list