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

customize windows install for this product #28

Merged
merged 4 commits into from
Mar 26, 2018
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
2 changes: 1 addition & 1 deletion components/chef-workstation/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ GEM
os (1.0.0)
paint (2.0.1)
parallel (1.12.1)
parser (2.5.0.4)
parser (2.5.0.5)
ast (~> 2.4.0)
powerpack (0.1.1)
pry (0.11.3)
Expand Down
1 change: 1 addition & 0 deletions components/chef-workstation/lib/chef-workstation/config.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require "mixlib/config"
require "fileutils"
require "pathname"

module ChefWorkstation
Expand Down
17 changes: 11 additions & 6 deletions omnibus/config/projects/chef-workstation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,23 @@
name "chef-workstation"
friendly_name "Chef Workstation"
maintainer "Chef Software, Inc. <maintainers@chef.io>"
homepage "TBD"
homepage "https://chef.sh"

license "Apache-2.0"
license_file "../LICENSE"

# Defaults to C:/chef-workstation on Windows
# and /opt/chef-workstation on all other platforms
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

explain why we're being explicit

install_dir "#{default_root}/#{name}"
# We'll force "c:/opscode/chef-workstation" - otherwise
# extracting version info after creating the package
# fails because it can't find c:/opscode/chef-workstation/version-manifest.txt
# when the install dir is configured to c:/chef-workstation.
if windows?
install_dir "#{default_root}/opscode/#{name}"
else
install_dir "#{default_root}/#{name}"
end


build_version Omnibus::BuildVersion.semver
build_iteration 1
Expand All @@ -33,12 +42,8 @@
override :rubygems, version: "2.6.13"
override :ruby, version: "2.4.2"

# Creates required build directories
dependency "preparation"

# the chef-workstation component will pull in others as needed.
dependency "chef-workstation"

dependency "version-manifest"
dependency "clean-static-libs"

Expand Down
111 changes: 111 additions & 0 deletions omnibus/resources/chef-workstation/msi/source.wxs.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">

<!-- This is how we include wxi files -->
<?include "parameters.wxi" ?>

<!--
Id="*" is to enable upgrading. * means that the product ID will be autogenerated on each build.
Name is made of localized product name and version number.
-->
<Product Id="*" Name="!(loc.ProductName) v$(var.DisplayVersionNumber)" Language="!(loc.LANG)"
Version="$(var.VersionNumber)" Manufacturer="!(loc.ManufacturerName)" UpgradeCode="$(var.UpgradeCode)">
<Package InstallerVersion="200" InstallPrivileges="elevated"
Compressed="yes" InstallScope="perMachine" />

<Media Id="1" Cabinet="ChefWorkstation.cab" EmbedCab="yes" CompressionLevel="high" />
<MajorUpgrade DowngradeErrorMessage="!(loc.DowngradeErrorMessage)" />

<!--
If fastmsi is set, custom actions will be invoked during install to unzip
project files, and during uninstall to remove the project folder
-->
<% if fastmsi %>
<SetProperty Id="FastUnzip"
Value="FASTZIPDIR=[INSTALLLOCATION];FASTZIPAPPNAME=chef-workstation"
Sequence="execute"
Before="FastUnzip" />

<CustomAction Id="FastUnzip"
BinaryKey="CustomActionFastMsiDLL"
DllEntry="FastUnzip"
Execute="deferred"
Impersonate="no"
Return="check" />

<Binary Id="CustomActionFastMsiDLL"
SourceFile="CustomActionFastMsi.CA.dll" />

<CustomAction Id="Cleanup"
Directory="INSTALLLOCATION"
ExeCommand="cmd /C &quot;rd /S /Q chef-workstation&quot;"
Execute="deferred"
Impersonate="no"
Return="ignore" />

<InstallExecuteSequence>
<Custom Action="FastUnzip" After="InstallFiles">NOT Installed</Custom>
<Custom Action="Cleanup" After="RemoveFiles">REMOVE~="ALL"</Custom>
</InstallExecuteSequence>

<UI>
<ProgressText Action="FastUnzip">!(loc.FileExtractionProgress)</ProgressText>
</UI>
<% end %>

<CustomActionRef Id="WixBroadcastSettingChange" />
<CustomActionRef Id="WixBroadcastEnvironmentChange" />

<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="WINDOWSVOLUME">
<Directory Id="INSTALLLOCATION" Name="opscode">
<Directory Id="PROJECTLOCATION" Name="chef-workstation">
<Directory Id="PROJECTLOCATIONBIN" Name="bin">
<Component Id="ChefWorkstationPath" Guid="{BC744260-FD5B-4A0F-8EE5-76283072CC09}" >
<Environment Id="Environment"
Name="PATH" Action="set" Part="last" System="yes" Value="[PROJECTLOCATIONBIN]" />
</Component>
</Directory>
</Directory>
</Directory>
</Directory>
</Directory>

<!-- Set the components defined in our fragment files that will be used for our feature -->
<Feature Id="ChefWorkstationFeature" Title="!(loc.FeatureMainName)" Absent="disallow" AllowAdvertise="no" Level="1" ConfigurableDirectory="INSTALLLOCATION">
<ComponentGroupRef Id="ProjectDir" />
<ComponentRef Id="ChefWorkstationPath" />
</Feature>

<!--
UI Stuff
TODO: Icon
-->
<Icon Id="project16.ico" SourceFile="Resources\assets\project_16x16.ico"/>
<Icon Id="project32.ico" SourceFile="Resources\assets\project_32x32.ico"/>
<Icon Id="project.ico" SourceFile="Resources\assets\project.ico"/>
<Property Id="ARPPRODUCTICON" Value="project16.ico" />
<!-- TODO: chef.sh or chef.io? -->

<Property Id="ARPHELPLINK" Value="https://chef.sh/" />
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLLOCATION" />

<UIRef Id="ChefWorkstationUI_InstallDir"/>
<UI Id="ChefWorkstationUI_InstallDir">
<UIRef Id="WixUI_FeatureTree"/>
<TextStyle Id="WixUI_Font_Normal_White" FaceName="Tahoma" Size="8" Red="255" Green="255" Blue="255" />
<TextStyle Id="WixUI_Font_Bigger_White" FaceName="Tahoma" Size="12" Red="255" Green="255" Blue="255" />
<TextStyle Id="WixUI_Font_Title_White" FaceName="Tahoma" Size="9" Bold="yes" Red="255" Green="255" Blue="255" />
</UI>

<WixVariable Id="WixUILicenseRtf" Value="Resources\assets\LICENSE.rtf" />
<WixVariable Id="WixUIDialogBmp" Value="Resources\assets\dialog_background.bmp" />
<WixVariable Id="WixUIBannerBmp" Value="Resources\assets\banner_background.bmp" />

<WixVariable Id="WixUIExclamationIco" Value="Resources\assets\project_32x32.ico" />
<WixVariable Id="WixUIInfoIco" Value="Resources\assets\project_32x32.ico" />
<WixVariable Id="WixUINewIco" Value="Resources\assets\project_16x16.ico" />
<WixVariable Id="WixUIUpIco" Value="Resources\assets\project_16x16.ico" />

</Product>
</Wix>