Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enable capability to install per user + doc #107

Merged
merged 1 commit into from
May 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 46 additions & 12 deletions wix/Main.hotspot.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<Property Id="ARPHELPLINK" Value="!(loc.ProductHelpLink)" />
<Property Id="ARPURLINFOABOUT" Value="!(loc.ProductUrlInfoAbout)" />
<Property Id="ARPURLUPDATEINFO" Value="!(loc.ProductUrlUpdateInfo)" />
<Property Id="ALLUSERS" Value="1" />
<Property Id="ALLUSERS" Value="2" /> <!-- Allow per User or per Machine setup -->
<Property Id="ARPPRODUCTICON" Value="logo.ico" />
<Property Id="ORACLE_VERSION_KEY" Value="$(var.OracleVersionKey)" />
<Property Id="ORACLE_JAVASOFT_BASE_KEY" Value="$(var.OracleJavasoftBaseKey)" />
Expand Down Expand Up @@ -62,27 +62,57 @@
RemoveFolderEx requires that we "remember" the path for uninstall.
This workaround is only required for the uninstall.
-->
<Property Id="INSTALLDIR">
<RegistrySearch Id="INSTALLDIR_REGSEARCH" Root="HKLM" Key="SOFTWARE\$(var.ProductManufacturer)\$(var.ProductCategory)\$(var.ProductVersion)\$(var.JVM)\MSI" Name="Path" Type="raw" />
<Property Id="INSTALLDIR_PER_MACHINE">
<RegistrySearch Id="INSTALLDIR_REGSEARCH_HKLM" Root="HKLM" Key="SOFTWARE\$(var.ProductManufacturer)\$(var.ProductCategory)\$(var.ProductVersion)\$(var.JVM)\MSI" Name="Path" Type="raw" />
</Property>
<Property Id="INSTALLDIR_PER_USER">
<RegistrySearch Id="INSTALLDIR_REGSEARCH_HKCU" Root="HKCU" Key="SOFTWARE\$(var.ProductManufacturer)\$(var.ProductCategory)\$(var.ProductVersion)\$(var.JVM)\MSI" Name="Path" Type="raw" />
</Property>

<CustomAction Id="PerMachineInstall" Property="TARGETDIR" Value="[INSTALLDIR_PER_MACHINE]" Execute="immediate"/>
<CustomAction Id="PerUserInstall" Property="TARGETDIR" Value="[INSTALLDIR_PER_USER]" Execute="immediate"/>

<InstallExecuteSequence>
<Custom Action="PerMachineInstall" Before="CostFinalize">ALLUSERS=1 OR (ALLUSERS=2 AND Privileged)</Custom>
<Custom Action="PerUserInstall" Before="CostFinalize">ALLUSERS="" OR (ALLUSERS=2 AND (NOT Privileged))</Custom>
</InstallExecuteSequence>

<!-- Add the shortcuts to your installer package -->
<DirectoryRef Id="INSTALLDIR">
<Component Id="CleanupMainInstallDir" Guid="*">
<RegistryValue Root="HKLM" Key="SOFTWARE\$(var.ProductManufacturer)\$(var.ProductCategory)\$(var.ProductVersion)\$(var.JVM)\MSI" Name="Path" Type="string" Value="[INSTALLDIR]" KeyPath="yes" />
<RegistryValue Root="HKLM" Key="SOFTWARE\$(var.ProductManufacturer)\$(var.ProductCategory)\$(var.ProductVersion)\$(var.JVM)\MSI" Name="Main" Type="integer" Value="1" />
<RegistryValue Root="HKMU" Key="SOFTWARE\$(var.ProductManufacturer)\$(var.ProductCategory)\$(var.ProductVersion)\$(var.JVM)\MSI" Name="Path" Type="string" Value="[INSTALLDIR]" KeyPath="yes" />
<RegistryValue Root="HKMU" Key="SOFTWARE\$(var.ProductManufacturer)\$(var.ProductCategory)\$(var.ProductVersion)\$(var.JVM)\MSI" Name="Main" Type="integer" Value="1" />
<!-- We need to use INSTALLDIR variable here or RemoveFolderEx will not remove on "install". -->
<util:RemoveFolderEx On="uninstall" Property="INSTALLDIR" />
<RemoveFolder Id="PRODUCTMANUFACTURER_REMOVE" Directory="PRODUCTMANUFACTURER" On="uninstall" />
</Component>
<Component Id="AddToEnvironmentPath" Guid="*">
<RegistryValue Root="HKLM" Key="SOFTWARE\$(var.ProductManufacturer)\$(var.ProductCategory)\$(var.ProductVersion)\$(var.JVM)\MSI" Name="EnvironmentPath" Type="integer" Value="1" KeyPath="yes" />
<Environment Id="PATH" Name="PATH" Value="[INSTALLDIR]bin" Permanent="no" Part="first" Action="set" System="yes" />
<RegistryValue Root="HKMU" Key="SOFTWARE\$(var.ProductManufacturer)\$(var.ProductCategory)\$(var.ProductVersion)\$(var.JVM)\MSI" Name="EnvironmentPath" Type="integer" Value="1" KeyPath="yes" />
</Component>
<Component Id="AddToEnvironmentPathSystem" Guid="*">
<Condition>ALLUSERS=1 OR (ALLUSERS=2 AND Privileged)</Condition>
<RegistryValue Root="HKMU" Key="SOFTWARE\$(var.ProductManufacturer)\$(var.ProductCategory)\$(var.ProductVersion)\$(var.JVM)\MSI" Name="EnvironmentPathSetForSystem" Type="integer" Value="1" KeyPath="yes" /> <!-- Only to get a Keypath and can use Guid="*" for having different guid for each installer -->
<Environment Id="PATH_SYSTEM" Name="PATH" Value="[INSTALLDIR]bin" Permanent="no" Part="first" Action="set" System="yes" />
</Component>
<Component Id="AddToEnvironmentPathUser" Guid="*">
<Condition>ALLUSERS="" OR (ALLUSERS=2 AND (NOT Privileged))</Condition>
<RegistryValue Root="HKMU" Key="SOFTWARE\$(var.ProductManufacturer)\$(var.ProductCategory)\$(var.ProductVersion)\$(var.JVM)\MSI" Name="EnvironmentPathSetForUser" Type="integer" Value="1" KeyPath="yes" /> <!-- Only to get a Keypath and can use Guid="*" for having different guid for each installer -->
<Environment Id="PATH_USER" Name="PATH" Value="[INSTALLDIR]bin" Permanent="no" Part="first" Action="set" System="no" />
</Component>
<Component Id="SetJavaHomeVariable" Guid="*">
<RegistryValue Root="HKLM" Key="SOFTWARE\$(var.ProductManufacturer)\$(var.ProductCategory)\$(var.ProductVersion)\$(var.JVM)\MSI" Name="JavaHome" Type="integer" Value="1" KeyPath="yes" />
<Environment Id="JAVA_HOME" Name="JAVA_HOME" Value="[INSTALLDIR]" Permanent="no" Action="set" System="yes" />
<RegistryValue Root="HKMU" Key="SOFTWARE\$(var.ProductManufacturer)\$(var.ProductCategory)\$(var.ProductVersion)\$(var.JVM)\MSI" Name="JavaHome" Type="integer" Value="1" KeyPath="yes" />
</Component>
<Component Id="SetJavaHomeVariableSystem" Guid="*">
<Condition>ALLUSERS=1 OR (ALLUSERS=2 AND Privileged)</Condition>
<RegistryValue Root="HKMU" Key="SOFTWARE\$(var.ProductManufacturer)\$(var.ProductCategory)\$(var.ProductVersion)\$(var.JVM)\MSI" Name="JavaHomeSetForSystem" Type="integer" Value="1" KeyPath="yes" /> <!-- Only to get a Keypath and can use Guid="*" for having different guid for each installer -->
<Environment Id="JAVA_HOME_SYSTEM" Name="JAVA_HOME" Value="[INSTALLDIR]" Permanent="no" Action="set" System="yes" />
</Component>
<Component Id="SetJavaHomeVariableUser" Guid="*">
<Condition>ALLUSERS="" OR (ALLUSERS=2 AND (NOT Privileged))</Condition>
<RegistryValue Root="HKMU" Key="SOFTWARE\$(var.ProductManufacturer)\$(var.ProductCategory)\$(var.ProductVersion)\$(var.JVM)\MSI" Name="JavaHomeSetForUser" Type="integer" Value="1" KeyPath="yes" /> <!-- Only to get a Keypath and can use Guid="*" for having different guid for each installer -->
<Environment Id="JAVA_HOME_USER" Name="JAVA_HOME" Value="[INSTALLDIR]" Permanent="no" Action="set" System="no" />
</Component>

<!-- Add jar launch by double click -->
<Component Id="SetJarFileRunWith" Guid="*">
<!--
Expand All @@ -93,10 +123,10 @@
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jar\OpenWithProgids
is automatically created by Windows when running jar file for the first time
-->
<RegistryValue Root="HKLM" Key="SOFTWARE\Classes\.jar" Type="string" Value="AdoptOpenJDK.jarfile" KeyPath="yes" />
<RegistryValue Root="HKLM" Key="SOFTWARE\Classes\.jar" Type="string" Name="Content Type" Value="application/jar" KeyPath="no" />
<RegistryValue Root="HKMU" Key="SOFTWARE\Classes\.jar" Type="string" Value="AdoptOpenJDK.jarfile" KeyPath="yes" />
<RegistryValue Root="HKMU" Key="SOFTWARE\Classes\.jar" Type="string" Name="Content Type" Value="application/jar" KeyPath="no" />

<RegistryValue Root="HKLM" Key="SOFTWARE\Classes\AdoptOpenJDK.jarfile\shell\open\command" Type="string" Value="&quot;[INSTALLDIR]bin\javaw.exe&quot; -jar &quot;%1&quot; %*" KeyPath="no" />
<RegistryValue Root="HKMU" Key="SOFTWARE\Classes\AdoptOpenJDK.jarfile\shell\open\command" Type="string" Value="&quot;[INSTALLDIR]bin\javaw.exe&quot; -jar &quot;%1&quot; %*" KeyPath="no" />
</Component>
<Component Id="SetOracleJavaSoftKeys" Guid="*">
<RegistryValue Root="HKLM" Key="SOFTWARE\JavaSoft\[ORACLE_JAVASOFT_BASE_KEY]" Name="CurrentVersion" Type="string" Value="[ORACLE_VERSION_KEY]" KeyPath="yes" />
Expand Down Expand Up @@ -133,12 +163,16 @@
<ComponentGroupRef Id="AppFiles" />
<Feature Id="FeatureEnvironment" Level="1" Title="!(loc.FeatureEnvironmentTitle)" Description="!(loc.FeatureEnvironmentDescription)" Absent="allow" AllowAdvertise="no" InstallDefault="followParent">
<ComponentRef Id="AddToEnvironmentPath" />
<ComponentRef Id="AddToEnvironmentPathSystem" />
<ComponentRef Id="AddToEnvironmentPathUser" />
</Feature>
<Feature Id="FeatureJarFileRunWith" Level="1" Title="!(loc.FeatureJarFileRunWithTitle)" Description="!(loc.FeatureJarFileRunWithDescription)" Absent="allow" AllowAdvertise="no" InstallDefault="followParent">
<ComponentRef Id="SetJarFileRunWith" />
</Feature>
<Feature Id="FeatureJavaHome" Level="2" Title="!(loc.FeatureJavaHomeTitle)" Description="!(loc.FeatureJavaHomeDescription)" Absent="allow" AllowAdvertise="no" InstallDefault="followParent">
<ComponentRef Id="SetJavaHomeVariable" />
<ComponentRef Id="SetJavaHomeVariableSystem" />
<ComponentRef Id="SetJavaHomeVariableUser" />
</Feature>

<Feature Id="FeatureOracleJavaSoft" Level="2" Title="!(loc.FeatureOracleJavaSoftName)" Description="!(loc.FeatureOracleJavaSoftDescription)" Absent="allow" AllowAdvertise="no" InstallDefault="followParent" >
Expand Down
58 changes: 46 additions & 12 deletions wix/Main.openj9.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<Property Id="ARPHELPLINK" Value="!(loc.ProductHelpLink)" />
<Property Id="ARPURLINFOABOUT" Value="!(loc.ProductUrlInfoAbout)" />
<Property Id="ARPURLUPDATEINFO" Value="!(loc.ProductUrlUpdateInfo)" />
<Property Id="ALLUSERS" Value="1" />
<Property Id="ALLUSERS" Value="2" /> <!-- Allow per User or per Machine setup -->
<Property Id="ARPPRODUCTICON" Value="logo.ico" />
<Property Id="ORACLE_VERSION_KEY" Value="$(var.OracleVersionKey)" />
<Property Id="ORACLE_JAVASOFT_BASE_KEY" Value="$(var.OracleJavasoftBaseKey)" />
Expand Down Expand Up @@ -62,27 +62,57 @@
RemoveFolderEx requires that we "remember" the path for uninstall.
This workaround is only required for the uninstall.
-->
<Property Id="INSTALLDIR">
<RegistrySearch Id="INSTALLDIR_REGSEARCH" Root="HKLM" Key="SOFTWARE\$(var.ProductManufacturer)\$(var.ProductCategory)\$(var.ProductVersion)\$(var.JVM)\MSI" Name="Path" Type="raw" />
<Property Id="INSTALLDIR_PER_MACHINE">
<RegistrySearch Id="INSTALLDIR_REGSEARCH_HKLM" Root="HKLM" Key="SOFTWARE\$(var.ProductManufacturer)\$(var.ProductCategory)\$(var.ProductVersion)\$(var.JVM)\MSI" Name="Path" Type="raw" />
</Property>
<Property Id="INSTALLDIR_PER_USER">
<RegistrySearch Id="INSTALLDIR_REGSEARCH_HKCU" Root="HKCU" Key="SOFTWARE\$(var.ProductManufacturer)\$(var.ProductCategory)\$(var.ProductVersion)\$(var.JVM)\MSI" Name="Path" Type="raw" />
</Property>

<CustomAction Id="PerMachineInstall" Property="TARGETDIR" Value="[INSTALLDIR_PER_MACHINE]" Execute="immediate"/>
<CustomAction Id="PerUserInstall" Property="TARGETDIR" Value="[INSTALLDIR_PER_USER]" Execute="immediate"/>

<InstallExecuteSequence>
<Custom Action="PerMachineInstall" Before="CostFinalize">ALLUSERS=1 OR (ALLUSERS=2 AND Privileged)</Custom>
<Custom Action="PerUserInstall" Before="CostFinalize">ALLUSERS="" OR (ALLUSERS=2 AND (NOT Privileged))</Custom>
</InstallExecuteSequence>

<!-- Add the shortcuts to your installer package -->
<DirectoryRef Id="INSTALLDIR">
<Component Id="CleanupMainInstallDir" Guid="*">
<RegistryValue Root="HKLM" Key="SOFTWARE\$(var.ProductManufacturer)\$(var.ProductCategory)\$(var.ProductVersion)\$(var.JVM)\MSI" Name="Path" Type="string" Value="[INSTALLDIR]" KeyPath="yes" />
<RegistryValue Root="HKLM" Key="SOFTWARE\$(var.ProductManufacturer)\$(var.ProductCategory)\$(var.ProductVersion)\$(var.JVM)\MSI" Name="Main" Type="integer" Value="1" />
<RegistryValue Root="HKMU" Key="SOFTWARE\$(var.ProductManufacturer)\$(var.ProductCategory)\$(var.ProductVersion)\$(var.JVM)\MSI" Name="Path" Type="string" Value="[INSTALLDIR]" KeyPath="yes" />
<RegistryValue Root="HKMU" Key="SOFTWARE\$(var.ProductManufacturer)\$(var.ProductCategory)\$(var.ProductVersion)\$(var.JVM)\MSI" Name="Main" Type="integer" Value="1" />
<!-- We need to use INSTALLDIR variable here or RemoveFolderEx will not remove on "install". -->
<util:RemoveFolderEx On="uninstall" Property="INSTALLDIR" />
<RemoveFolder Id="PRODUCTMANUFACTURER_REMOVE" Directory="PRODUCTMANUFACTURER" On="uninstall" />
</Component>
<Component Id="AddToEnvironmentPath" Guid="*">
<RegistryValue Root="HKLM" Key="SOFTWARE\$(var.ProductManufacturer)\$(var.ProductCategory)\$(var.ProductVersion)\$(var.JVM)\MSI" Name="EnvironmentPath" Type="integer" Value="1" KeyPath="yes" />
<Environment Id="PATH" Name="PATH" Value="[INSTALLDIR]bin" Permanent="no" Part="first" Action="set" System="yes" />
<RegistryValue Root="HKMU" Key="SOFTWARE\$(var.ProductManufacturer)\$(var.ProductCategory)\$(var.ProductVersion)\$(var.JVM)\MSI" Name="EnvironmentPath" Type="integer" Value="1" KeyPath="yes" />
</Component>
<Component Id="AddToEnvironmentPathSystem" Guid="*">
<Condition>ALLUSERS=1 OR (ALLUSERS=2 AND Privileged)</Condition>
<RegistryValue Root="HKMU" Key="SOFTWARE\$(var.ProductManufacturer)\$(var.ProductCategory)\$(var.ProductVersion)\$(var.JVM)\MSI" Name="EnvironmentPathSetForSystem" Type="integer" Value="1" KeyPath="yes" /> <!-- Only to get a Keypath and can use Guid="*" for having different guid for each installer -->
<Environment Id="PATH_SYSTEM" Name="PATH" Value="[INSTALLDIR]bin" Permanent="no" Part="first" Action="set" System="yes" />
</Component>
<Component Id="AddToEnvironmentPathUser" Guid="*">
<Condition>ALLUSERS="" OR (ALLUSERS=2 AND (NOT Privileged))</Condition>
<RegistryValue Root="HKMU" Key="SOFTWARE\$(var.ProductManufacturer)\$(var.ProductCategory)\$(var.ProductVersion)\$(var.JVM)\MSI" Name="EnvironmentPathSetForUser" Type="integer" Value="1" KeyPath="yes" /> <!-- Only to get a Keypath and can use Guid="*" for having different guid for each installer -->
<Environment Id="PATH_USER" Name="PATH" Value="[INSTALLDIR]bin" Permanent="no" Part="first" Action="set" System="no" />
</Component>
<Component Id="SetJavaHomeVariable" Guid="*">
<RegistryValue Root="HKLM" Key="SOFTWARE\$(var.ProductManufacturer)\$(var.ProductCategory)\$(var.ProductVersion)\$(var.JVM)\MSI" Name="JavaHome" Type="integer" Value="1" KeyPath="yes" />
<Environment Id="JAVA_HOME" Name="JAVA_HOME" Value="[INSTALLDIR]" Permanent="no" Action="set" System="yes" />
<RegistryValue Root="HKMU" Key="SOFTWARE\$(var.ProductManufacturer)\$(var.ProductCategory)\$(var.ProductVersion)\$(var.JVM)\MSI" Name="JavaHome" Type="integer" Value="1" KeyPath="yes" />
</Component>
<Component Id="SetJavaHomeVariableSystem" Guid="*">
<Condition>ALLUSERS=1 OR (ALLUSERS=2 AND Privileged)</Condition>
<RegistryValue Root="HKMU" Key="SOFTWARE\$(var.ProductManufacturer)\$(var.ProductCategory)\$(var.ProductVersion)\$(var.JVM)\MSI" Name="JavaHomeSetForSystem" Type="integer" Value="1" KeyPath="yes" /> <!-- Only to get a Keypath and can use Guid="*" for having different guid for each installer -->
<Environment Id="JAVA_HOME_SYSTEM" Name="JAVA_HOME" Value="[INSTALLDIR]" Permanent="no" Action="set" System="yes" />
</Component>
<Component Id="SetJavaHomeVariableUser" Guid="*">
<Condition>ALLUSERS="" OR (ALLUSERS=2 AND (NOT Privileged))</Condition>
<RegistryValue Root="HKMU" Key="SOFTWARE\$(var.ProductManufacturer)\$(var.ProductCategory)\$(var.ProductVersion)\$(var.JVM)\MSI" Name="JavaHomeSetForUser" Type="integer" Value="1" KeyPath="yes" /> <!-- Only to get a Keypath and can use Guid="*" for having different guid for each installer -->
<Environment Id="JAVA_HOME_USER" Name="JAVA_HOME" Value="[INSTALLDIR]" Permanent="no" Action="set" System="no" />
</Component>

<!-- Add jar launch by double click -->
<Component Id="SetJarFileRunWith" Guid="*">
<!--
Expand All @@ -93,10 +123,10 @@
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jar\OpenWithProgids
is automatically created by Windows when running jar file for the first time
-->
<RegistryValue Root="HKLM" Key="SOFTWARE\Classes\.jar" Type="string" Value="AdoptOpenJDK.jarfile" KeyPath="yes" />
<RegistryValue Root="HKLM" Key="SOFTWARE\Classes\.jar" Type="string" Name="Content Type" Value="application/jar" KeyPath="no" />
<RegistryValue Root="HKMU" Key="SOFTWARE\Classes\.jar" Type="string" Value="AdoptOpenJDK.jarfile" KeyPath="yes" />
<RegistryValue Root="HKMU" Key="SOFTWARE\Classes\.jar" Type="string" Name="Content Type" Value="application/jar" KeyPath="no" />

<RegistryValue Root="HKLM" Key="SOFTWARE\Classes\AdoptOpenJDK.jarfile\shell\open\command" Type="string" Value="&quot;[INSTALLDIR]bin\javaw.exe&quot; -jar &quot;%1&quot; %*" KeyPath="no" />
<RegistryValue Root="HKMU" Key="SOFTWARE\Classes\AdoptOpenJDK.jarfile\shell\open\command" Type="string" Value="&quot;[INSTALLDIR]bin\javaw.exe&quot; -jar &quot;%1&quot; %*" KeyPath="no" />
</Component>
<Component Id="SetOracleJavaSoftKeys" Guid="*">
<RegistryValue Root="HKLM" Key="SOFTWARE\JavaSoft\[ORACLE_JAVASOFT_BASE_KEY]" Name="CurrentVersion" Type="string" Value="[ORACLE_VERSION_KEY]" KeyPath="yes" />
Expand Down Expand Up @@ -133,12 +163,16 @@
<ComponentGroupRef Id="AppFiles" />
<Feature Id="FeatureEnvironment" Level="1" Title="!(loc.FeatureEnvironmentTitle)" Description="!(loc.FeatureEnvironmentDescription)" Absent="allow" AllowAdvertise="no" InstallDefault="followParent">
<ComponentRef Id="AddToEnvironmentPath" />
<ComponentRef Id="AddToEnvironmentPathSystem" />
<ComponentRef Id="AddToEnvironmentPathUser" />
</Feature>
<Feature Id="FeatureJarFileRunWith" Level="1" Title="!(loc.FeatureJarFileRunWithTitle)" Description="!(loc.FeatureJarFileRunWithDescription)" Absent="allow" AllowAdvertise="no" InstallDefault="followParent">
<ComponentRef Id="SetJarFileRunWith" />
</Feature>
<Feature Id="FeatureJavaHome" Level="2" Title="!(loc.FeatureJavaHomeTitle)" Description="!(loc.FeatureJavaHomeDescription)" Absent="allow" AllowAdvertise="no" InstallDefault="followParent">
<ComponentRef Id="SetJavaHomeVariable" />
<ComponentRef Id="SetJavaHomeVariableSystem" />
<ComponentRef Id="SetJavaHomeVariableUser" />
</Feature>

<Feature Id="FeatureOracleJavaSoft" Level="2" Title="!(loc.FeatureOracleJavaSoftName)" Description="!(loc.FeatureOracleJavaSoftDescription)" Absent="allow" AllowAdvertise="no" InstallDefault="followParent" >
Expand Down
Loading