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

add numeric install version value to windows registry on install #1953

Merged
merged 2 commits into from
Nov 12, 2024
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 go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ require (
github.com/gorilla/websocket v1.4.2
github.com/groob/plist v0.0.0-20190114192801-a99fbe489d03
github.com/knightsc/system_policy v1.1.1-0.20211029142728-5f4c0d5419cc
github.com/kolide/kit v0.0.0-20240411131714-94dd1939cf50
github.com/kolide/kit v0.0.0-20241104170139-c647b1ab5279
github.com/kolide/krypto v0.1.1-0.20231229162826-db516b7e0121
github.com/mat/besticon v3.9.0+incompatible
github.com/mattn/go-sqlite3 v1.14.19
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@ github.com/kolide/go-ole v0.0.0-20241008210444-65130153c767 h1:kcLxfX6wdtztSwpgz
github.com/kolide/go-ole v0.0.0-20241008210444-65130153c767/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78=
github.com/kolide/goleveldb v0.0.0-20240514204455-8d30cd4d31c6 h1:6/RKW8FQlrtaBeL7We3SdpdoiGZk3Pm5STXsSxbm9ho=
github.com/kolide/goleveldb v0.0.0-20240514204455-8d30cd4d31c6/go.mod h1:zgOxCKTwS/xpJtz6LH60b3lZoQ30kqtc252N+SM4enc=
github.com/kolide/kit v0.0.0-20240411131714-94dd1939cf50 h1:N7RaYBPTK5o4y2z1z8kl/G3iAeP73QCfAUH4y39GRCc=
github.com/kolide/kit v0.0.0-20240411131714-94dd1939cf50/go.mod h1:pFbEKXFww1uqu4RRO7qCnUmQ2EIwKYRzUqpJbODNlfc=
github.com/kolide/kit v0.0.0-20241104170139-c647b1ab5279 h1:nFN/UwsX1OuTgekQWuynr1SwWlcPT8t1iNtjtm81sMA=
github.com/kolide/kit v0.0.0-20241104170139-c647b1ab5279/go.mod h1:pFbEKXFww1uqu4RRO7qCnUmQ2EIwKYRzUqpJbODNlfc=
github.com/kolide/krypto v0.1.1-0.20231229162826-db516b7e0121 h1:f7APX9VNsCkD/tdlAjbU4A22FyfTOCF6QadlvnzZElg=
github.com/kolide/krypto v0.1.1-0.20231229162826-db516b7e0121/go.mod h1:/0sxd3OIxciTlMTeZI/9WTaUHsx/K/+3f+NbD5dywTY=
github.com/kolide/systray v1.10.5-0.20241021175748-13aef6380bdb h1:d2pfEh5Yd6+C+D096YQlHwcq28TPOjoeoG+lCQojkJM=
Expand Down
1 change: 1 addition & 0 deletions pkg/packagekit/assets/main.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
<RegistryValue Key="Identifier" Value="{{.Opts.Identifier}}" Type="string" />
<RegistryValue Key="User" Value="[LogonUser]" Type="string" />
<RegistryValue Key="Version" Value="{{.Opts.Version}}" Type="string" />
<RegistryValue Key="InstalledVersionNum" Value="{{.Opts.VersionNum}}" Type="integer" />
</RegistryKey>
</Component>
</DirectoryRef>
Expand Down
1 change: 1 addition & 0 deletions pkg/packagekit/package.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ type PackageOptions struct {
Root string // source directory to package
Scripts string // directory of packaging scripts (postinst, prerm, etc)
Version string // package version
VersionNum int // package version in numeric format. used to create comparable windows registry keys
FlagFile string // Path to the flagfile for configuration

DisableService bool // Whether to install a system service in a disabled state
Expand Down
8 changes: 8 additions & 0 deletions pkg/packagekit/package_wix.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"text/template"

"github.com/google/uuid"
"github.com/kolide/kit/version"
"github.com/kolide/launcher/pkg/packagekit/authenticode"
"github.com/kolide/launcher/pkg/packagekit/wix"
"golang.org/x/text/cases"
Expand Down Expand Up @@ -52,6 +53,13 @@ func PackageWixMSI(ctx context.Context, w io.Writer, po *PackageOptions, include
return err
}

// populate VersionNum if it isn't already set by the caller. we'll
// store this in the registry on install to give a comparable field
// for intune to drive upgrade behavior from
if po.VersionNum == 0 {
po.VersionNum = version.VersionNum()
}

// We include a random nonce as part of the ProductCode
// guid. This is so that any MSI rebuild triggers the Major
// Upgrade flow, and not the "Another version of this product
Expand Down
Loading