Requires last msitools from Git. Release should follow soon. --- Makefile.am | 7 +- configure.ac | 2 +- usbclerk.nsis.in | 192 ------------------------------------------------------- usbclerk.wxs.in | 66 +++++++++++++++++++ 4 files changed, 69 insertions(+), 198 deletions(-) delete mode 100644 usbclerk.nsis.in create mode 100644 usbclerk.wxs.in diff --git a/Makefile.am b/Makefile.am index 7e5e994..3b73957 100644 --- a/Makefile.am +++ b/Makefile.am @@ -10,8 +10,5 @@ usbclerk_SOURCES = usbclerk.cpp vdlog.cpp usbclerk.h vdlog.h usbclerktest_LDFLAGS = usbclerktest_SOURCES = usbclerktest.cpp -EXTRA_DIST = usbclerk.nsis - -usbclerk-setup.exe: usbclerk.nsis - makensis $^ - +EXTRA_DIST = usbclerk.wxs.in +CONFIG_STATUS_DEPENDENCIES = usbclerk.wxs.in diff --git a/configure.ac b/configure.ac index c6c9329..cb40a36 100644 --- a/configure.ac +++ b/configure.ac @@ -19,7 +19,7 @@ m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) AC_OUTPUT([ Makefile -usbclerk.nsis +usbclerk.wxs ]) AC_MSG_NOTICE([ diff --git a/usbclerk.nsis.in b/usbclerk.nsis.in deleted file mode 100644 index 22ca7b3..0000000 --- a/usbclerk.nsis.in +++ /dev/null @@ -1,192 +0,0 @@ -#!Nsis Installer Command Script -# -# This is an NSIS Installer Command Script generated automatically -# by the Fedora nsiswrapper program. For more information see: -# -# http://nsis.sourceforge.net -# -# To build an installer from the script you would normally do: -# -# makensis usbclerk-installer.nsis -# -# which will generate the output file 'usbclerk-installer.exe' which is a Windows -# installer containing your program. - -# Modern UI example script -!include MUI.nsh -!include x64.nsh - -!define MyName usbclerk -!define MySetup ${MyName}-setup - -!define VERSION @VERSION@ - -!define SpiceRegKey "Software\Spice" -!define UsbClerkRegKey "Software\Spice\${MyName}" -!define RemoveRegKey "Software\Microsoft\Windows\CurrentVersion\Uninstall\${MyName}" - -Name ${MyName} -OutFile ${MySetup}.exe - -InstallDir "$WINDIR\Installer\${MyName}" -InstallDirRegKey HKLM ${UsbClerkRegKey} InstallDir - - -RequestExecutionLevel admin -ShowInstDetails hide -ShowUninstDetails hide - -SetCompressor lzma - -XPStyle on - -#!define MUI_ABORTWARNING -#!define MUI_FINISHPAGE_NOAUTOCLOSE -#!define MUI_UNFINISHPAGE_NOAUTOCLOSE - -!insertmacro MUI_PAGE_WELCOME -!insertmacro MUI_PAGE_LICENSE LICENSE -# !insertmacro MUI_PAGE_DIRECTORY -!insertmacro MUI_PAGE_INSTFILES - -!insertmacro MUI_LANGUAGE "English" - -#DirText "Please select the installation folder." - -#-------------------------------- -#Version Information - VIProductVersion ${VERSION} - VIAddVersionKey "ProductName" "${MySetup}" - VIAddVersionKey "CompanyName" "Red Hat" - VIAddVersionKey "LegalCopyright" "Red Hat Inc 2012" - VIAddVersionKey "FileDescription" "An installer for usbclerk service" - VIAddVersionKey "FileVersion" ${VERSION} -#-------------------------------- - -# abort if not admin -!macro verify_admin id - DetailPrint "Checking admin privileges" - - # ClearErrors - # UserInfo::GetName - # IfErrors usbclerk_install_fail_get_user - UserInfo::GetAccountType - Pop $0 - StrCmp $0 "Admin" ${id}_user_is_admin ${id}_user_is_not_admin -${id}_user_is_not_admin: - DetailPrint "User does not have admin privileges ... aborting" - messageBox MB_OK "User does not have admin privileges ... aborting" - Abort -${id}_user_is_admin: - DetailPrint "User has admin privileges" -!macroend - -# work on 64 bit OS too. -!macro work_on_64 - ${If} ${RunningX64} - ${DisableX64FSRedirection} - SetRegView 64 - ${EndIf} -!macroend - -Function .onInit - !insertmacro verify_admin "onInit" - !insertmacro work_on_64 -FunctionEnd - -Function un.onInit - !insertmacro verify_admin "un.onInit" - !insertmacro work_on_64 -FunctionEnd - -!macro compare_versions f - IfFileExists ${f} +1 compare_versions_done - - ${GetFileVersion} ${f} $0 - - ${VersionCompare} $0 ${VERSION} $1 - - StrCmp $1 2 compare_versions_done # a newer version is now being installed - - # we are here ==> a newer version is installed so bail out - DetailPrint "About to install ${MyName} of version ${VERSION}" - DetailPrint "${MyName} of version $0 is already installed" - DetailPrint "A Newer (or equal) version is already installed -- aborting" - Abort - -compare_versions_done: - DetailPrint "Go on with ${MyName} installation" -!macroend - -!macro stop_and_remove_service - ReadRegStr $1 HKLM ${UsbClerkRegKey} InstDir - ReadEnvStr $0 COMSPEC - nsExec::ExecToLog '$0 /C net stop usbclerk' - nsExec::ExecToLog '$0 /C "$1\usbclerk.exe" uninstall' - Delete "$1\Uninstall_usbclerk.exe" - Delete "$1\usbclerk.exe" - Delete "$1\license.rtf" - Delete "$1\GPL" - Delete "$1\LICENSE" -!macroend - - -# -# FixMe check version -Function uninstall_if_needed - ReadRegStr $0 HKLM ${UsbClerkRegKey} Uninstall - StrCmp $0 "" uninstall_is_not_needed uninstall_is_needed -uninstall_is_needed: - DetailPrint "Removing already installed ${MyName} service" - !insertmacro stop_and_remove_service - DetailPrint "Done, installation of new ${MyName} continues" -uninstall_is_not_needed: -FunctionEnd - - - -Section "Install" - SectionIn RO - - # !insertmacro verify_admin install - - # uncomment this when usbclerk.exe gets a real version - # ReadRegStr $0 HKLM ${UsbClerkRegKey} InstDir - # !insertmacro compare_versions $0\usbclerk.exe - - Call uninstall_if_needed - - SetOutPath "$INSTDIR" - - File usbclerk.exe - File license.rtf - File GPL - File LICENSE - ReadEnvStr $0 COMSPEC - nsExec::ExecToLog '$0 /C "$INSTDIR\usbclerk.exe" install' - nsExec::ExecToLog '$0 /C net start usbclerk' - WriteUninstaller Uninstall_usbclerk.exe - WriteRegStr HKLM ${UsbClerkRegKey} "Uninstall" "$INSTDIR\Uninstall_usbclerk.exe" - WriteRegStr HKLM ${UsbClerkRegKey} "InstDir" "$INSTDIR" - - # add uninstall info - WriteRegStr HKLM "${RemoveRegKey}" "DisplayName" \ - "UsbClerk -- A service for installing WinUSB drivers" - WriteRegStr HKLM "${RemoveRegKey}" "UninstallString" \ - "$\"$INSTDIR\Uninstall_usbclerk.exe$\"" -SectionEnd - -Section "Uninstall" - # !insertmacro verify_admin uninstall - !insertmacro stop_and_remove_service - RMDir "$INSTDIR" - DeleteRegKey HKLM "${UsbClerkRegKey}\Uninstall" - DeleteRegKey HKLM "${UsbClerkRegKey}\InstDir" - DeleteRegKey /ifempty HKLM "${UsbClerkRegKey}" - DeleteRegKey /ifempty HKLM "${SpiceRegKey}" - - # delete uninstall info - DeleteRegKey HKLM "${RemoveRegKey}\DisplayName" - DeleteRegKey HKLM "${RemoveRegKey}\UninstallString" - DeleteRegKey /ifempty HKLM "${RemoveRegKey}" -SectionEnd diff --git a/usbclerk.wxs.in b/usbclerk.wxs.in new file mode 100644 index 0000000..7b838d8 --- /dev/null +++ b/usbclerk.wxs.in @@ -0,0 +1,66 @@ +<?xml version="1.0" encoding="utf-8"?> + +<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> + + <?define Version = "@VERSION@"?> + <?define UpgradeCode = "4a2c31e6-b10b-4c56-be28-c1ac35f5c52e"?> + <Product Id="*" Name="USB Clerk" Manufacturer="Red Hat, Inc." + Version="$(var.Version)" UpgradeCode="$(var.UpgradeCode)" + Language="1033"> + + <Package InstallerVersion="200" Compressed="yes" Comments="comments"/> + <Media Id="1" Cabinet="cabinet.cab" EmbedCab="yes"/> + + <Property Id="ARPHELPLINK" Value="http://www.spice-space.org"/> + <Property Id="ARPNOMODIFY" Value="1"/> + <Property Id="ARPNOREPAIR" Value="1"/> + <Upgrade Id="$(var.UpgradeCode)"> + <UpgradeVersion Minimum="$(var.Version)" OnlyDetect="yes" Property="NEWERVERSIONDETECTED"/> + <UpgradeVersion Minimum="0.0.0" Maximum="$(var.Version)" IncludeMinimum="yes" IncludeMaximum="no" Property="OLDERVERSIONBEINGUPGRADED"/> + </Upgrade> + <Condition Message="USB Clerk is already installed.">NOT NEWERVERSIONDETECTED</Condition> + <InstallExecuteSequence> + <RemoveExistingProducts After="InstallValidate"/> + </InstallExecuteSequence> + + <!-- try to uninstall NSIS --> + <Property Id='NSISINSTALL'> + <RegistrySearch Id='NSISSearch' Root='HKLM' Key='Software\Spice\usbclerk' Type="raw" Name='Uninstall'/> + </Property> + <CustomAction Id="NSISUninstall" Property="NSISINSTALL" ExeCommand="/S" Execute="deferred" Impersonate="no" Return="ignore"/> + <InstallExecuteSequence> + <AppSearch Sequence='1'/> + <Custom Action="NSISUninstall" After="InstallInitialize">NSISINSTALL AND NOT Installed</Custom> + </InstallExecuteSequence> + + <Directory Id="TARGETDIR" Name="SourceDir"> + <Directory Id="ProgramFilesFolder"> + <Directory Id="INSTALLDIR" Name="USBClerk"> + <Component Id="CUSBClerk" Guid="e99861f7-524c-4107-860d-27f866072e53"> + <File Id='usbclerkexe' Name='usbclerk.exe' DiskId='1' Source='usbclerk.exe' KeyPath='yes'/> + <ServiceInstall Id="USBClerkServiceInstall" + Name="USBClerk" + DisplayName="USB Clerk service" + Description="A Spice service for USB redirection" + Type="ownProcess" + Start="auto" + Account="[SERVICEACCOUNT]" + Password="[SERVICEPASSWORD]" + ErrorControl="normal"/> + <ServiceControl Id="StartService" + Name="USBClerk" + Start="install" + Stop="both" + Remove="uninstall" + Wait="yes"/> + </Component> + </Directory> + </Directory> + </Directory> + + <Feature Id="Complete" Level="1"> + <ComponentRef Id="CUSBClerk"/> + </Feature> + + </Product> +</Wix> -- 1.8.1.1.439.g50a6b54 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/spice-devel