diff --git a/admin/win/msi/CMakeLists.txt b/admin/win/msi/CMakeLists.txt index 933037dac1151..90f7af9d0c850 100644 --- a/admin/win/msi/CMakeLists.txt +++ b/admin/win/msi/CMakeLists.txt @@ -29,6 +29,8 @@ install(FILES Nextcloud.wxs ${CMAKE_CURRENT_BINARY_DIR}/RegistryCleanup.vbs RegistryCleanupCustomAction.wxs + UinstallOldClientDlg.wxs + License.rtf gui/banner.bmp gui/dialog.bmp DESTINATION msi/) diff --git a/admin/win/msi/License.rtf b/admin/win/msi/License.rtf new file mode 100644 index 0000000000000..c5550a6c51b09 Binary files /dev/null and b/admin/win/msi/License.rtf differ diff --git a/admin/win/msi/Nextcloud.wxs b/admin/win/msi/Nextcloud.wxs index 5e2bb2930f733..87c488671e51d 100644 --- a/admin/win/msi/Nextcloud.wxs +++ b/admin/win/msi/Nextcloud.wxs @@ -53,6 +53,8 @@ + C:\Windows\System32\ + @@ -60,6 +62,11 @@ + + @@ -70,7 +77,62 @@ + + + + + + + NSIS_UNINSTALLEXE AND NOT Installed @@ -113,18 +175,27 @@ --> - - - 1 - - 1 + 1 + 1 + 1 + + + + + + + Not Installed + 1 - + NOT (LAUNCH=0) + - + + diff --git a/admin/win/msi/OEM.wxi.in b/admin/win/msi/OEM.wxi.in index e35451eef2904..aa88631468df8 100644 --- a/admin/win/msi/OEM.wxi.in +++ b/admin/win/msi/OEM.wxi.in @@ -22,6 +22,7 @@ + @@ -32,9 +33,8 @@ + and uncomment + diff --git a/admin/win/msi/RegistryCleanup.vbs b/admin/win/msi/RegistryCleanup.vbs new file mode 100644 index 0000000000000..50e26c8ca7ed3 --- /dev/null +++ b/admin/win/msi/RegistryCleanup.vbs @@ -0,0 +1,54 @@ +On Error goto 0 + +Const HKEY_LOCAL_MACHINE = &H80000002 + +Const strObjRegistry = "winmgmts:\\.\root\default:StdRegProv" + +Function RegistryDeleteKeyRecursive(regRoot, strKeyPath) + Set objRegistry = GetObject(strObjRegistry) + objRegistry.EnumKey regRoot, strKeyPath, arrSubkeys + If IsArray(arrSubkeys) Then + For Each strSubkey In arrSubkeys + RegistryDeleteKeyRecursive regRoot, strKeyPath & "\" & strSubkey + Next + End If + objRegistry.DeleteKey regRoot, strKeyPath +End Function + +Function RegistryListSubkeys(regRoot, strKeyPath) + Set objRegistry = GetObject(strObjRegistry) + objRegistry.EnumKey regRoot, strKeyPath, arrSubkeys + RegistryListSubkeys = arrSubkeys +End Function + +Function GetUserSID() + Dim objWshNetwork, objUserAccount + + Set objWshNetwork = CreateObject("WScript.Network") + + Set objUserAccount = GetObject("winmgmts://" & objWshNetwork.UserDomain & "/root/cimv2").Get("Win32_UserAccount.Domain='" & objWshNetwork.ComputerName & "',Name='" & objWshNetwork.UserName & "'") + GetUserSID = objUserAccount.SID +End Function + +Function RegistryCleanupSyncRootManager() + strSyncRootManagerKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\SyncRootManager" + + arrSubKeys = RegistryListSubkeys(HKEY_LOCAL_MACHINE, strSyncRootManagerKeyPath) + + If IsArray(arrSubkeys) Then + arrSubkeys=Filter(arrSubkeys, Session.Property("APPNAME")) + End If + If IsArray(arrSubkeys) Then + arrSubkeys=Filter(arrSubkeys, GetUserSID()) + End If + + If IsArray(arrSubkeys) Then + For Each strSubkey In arrSubkeys + RegistryDeleteKeyRecursive HKEY_LOCAL_MACHINE, strSyncRootManagerKeyPath & "\" & strSubkey + Next + End If +End Function + +Function RegistryCleanup() + RegistryCleanupSyncRootManager() +End Function diff --git a/admin/win/msi/UinstallOldClientDlg.wxs b/admin/win/msi/UinstallOldClientDlg.wxs new file mode 100644 index 0000000000000..f1e54e142545b --- /dev/null +++ b/admin/win/msi/UinstallOldClientDlg.wxs @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/admin/win/msi/make-msi.bat.in b/admin/win/msi/make-msi.bat.in index eb14735327fdf..29b426e9aabbd 100644 --- a/admin/win/msi/make-msi.bat.in +++ b/admin/win/msi/make-msi.bat.in @@ -17,10 +17,10 @@ Rem Generate collect.wxs if %ERRORLEVEL% neq 0 exit %ERRORLEVEL% Rem Compile en-US (https://www.firegiant.com/wix/tutorial/transforms/morphing-installers/) -"%WIX%\bin\candle.exe" -dcodepage=1252 -dPlatform=%BuildArch% -arch %BuildArch% -dHarvestAppDir="%HarvestAppDir%" -ext WixUtilExtension NCMsiHelper.wxs WinShellExt.wxs collect.wxs Nextcloud.wxs RegistryCleanupCustomAction.wxs +"%WIX%\bin\candle.exe" -dcodepage=1252 -dPlatform=%BuildArch% -arch %BuildArch% -dHarvestAppDir="%HarvestAppDir%" -ext WixUtilExtension NCMsiHelper.wxs WinShellExt.wxs collect.wxs Nextcloud.wxs RegistryCleanupCustomAction.wxs UinstallOldClientDlg.wxs if %ERRORLEVEL% neq 0 exit %ERRORLEVEL% Rem Link MSI package -"%WIX%\bin\light.exe" -sw1076 -ext WixUIExtension -ext WixUtilExtension -cultures:en-us NCMsiHelper.wixobj WinShellExt.wixobj collect.wixobj Nextcloud.wixobj RegistryCleanupCustomAction.wixobj -out "@MSI_INSTALLER_FILENAME@" +"%WIX%\bin\light.exe" -sw1076 -ext WixUIExtension -ext WixUtilExtension -cultures:de-de NCMsiHelper.wixobj WinShellExt.wixobj collect.wixobj Nextcloud.wixobj UinstallOldClientDlg.wixobj RegistryCleanupCustomAction.wixobj -out "@MSI_INSTALLER_FILENAME@" exit %ERRORLEVEL%