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

Disabling BundleIsVersionChecked for pkg installers #48995

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

doggydogworld
Copy link
Contributor

@doggydogworld doggydogworld commented Nov 14, 2024

Overview

The package installer utility by default will perform a version check to determine how to handle an already installed package. By default if it determines the version is a downgrade it will not perform any actions.

This can result in some surprising results e.g.:

$ installer -pkg teleport-16.4.7.pkg -target /
$ tsh version
Teleport v16.4.7 git:v16.4.7-0-g15dfef1 go1.22.9
$ installer -pkg teleport-17.0.0-beta.2.pkg -target /
$ tsh version
Teleport v16.4.7 git:v16.4.7-0-g15dfef1 go1.22.9

Implementation

To allow for downgrading we can disable BundleIsVersionChecked in the plist for our package installer bundles.

For documentation on the behavior of this attribute you can run the following on a Mac

man pkgutil

Fixes #41844

changelog: Downgrading Teleport through macOS Package Installers is now supported.

@zmb3
Copy link
Collaborator

zmb3 commented Nov 14, 2024

Is there a particular reason why we do this during build at the command line rather than just adding this attribute to our existing plist files?

@doggydogworld
Copy link
Contributor Author

doggydogworld commented Nov 14, 2024

Is there a particular reason why we do this during build at the command line rather than just adding this attribute to our existing plist files?

For future compatibility and because those directories are actually valid Application Bundles.

The plist generated by the commands is actually very minimal. Most of the attributes seen in the plist files we have are filled in during pkgbuild as sane defaults. When passing in a component-plist those attributes will be overridden by the passed in plist. It could mean that in the future if any of those attributes are deprecated it could impact our build.

In Mac's Finder if you navigate to those directories you can actually run those like normal Application Bundles normally located in /Applications. This is useful for quick incremental local development. To be fair I'm not sure if the plist is actually necessary for these to run but removing it may "corrupt" the Application Bundle not allowing it to run.

For reference these are the attributes from the build plist before pkgbuild is run:

	<dict>
		<key>BundleHasStrictIdentifier</key>
		<true/>
		<key>BundleIsRelocatable</key>
		<true/>
		<key>BundleIsVersionChecked</key>
		<false/>
		<key>BundleOverwriteAction</key>
		<string>upgrade</string>
		<key>RootRelativeBundlePath</key>
		<string>tctl.app</string>
	</dict>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow tsh pkg to install older versions over higher versions on Mac
2 participants