fleet/assets/scripts/install-wine.sh
Scott Gress c3f50293e9
Pin new Wine version in install-wine.sh script (#43482)
<!-- Add the related story/sub-task/bug number, like Resolves #123, or
remove if NA -->
**Related issue:** Resolves #43476 

# Details

Bumps the cask commit we're pinned to, as the upstream has removed the
previous version (10) in favor of the latest (11). This is gonna
probably happen every year. We could consider hosting our own mirror but
not sure it's worth it for something that happens once a year.

# Checklist for submitter

If some of the following don't apply, delete the relevant line.

- [ ] Changes file added for user-visible changes in `changes/`,
`orbit/changes/` or `ee/fleetd-chrome/changes`.
See [Changes
files](https://github.com/fleetdm/fleet/blob/main/docs/Contributing/guides/committing-changes.md#changes-files)
for more information.
n/a

## Testing

- [X] QA'd all new/changed functionality manually

Ran the job successfully on this branch:
https://github.com/fleetdm/fleet/actions/runs/24358586742/job/71132009934

But it's a ticking clock; brew is gonna stop letting us install apps
that don't pass gatekeeper in September:

<img width="1025" height="245" alt="image"
src="https://github.com/user-attachments/assets/5a35b31e-649c-46a0-bdad-3abef41a3e0c"
/>

Will open separate issue for this.



<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Chores**
* Updated Wine installation tooling to reference the latest Homebrew
configuration definition, improving installation reliability.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-04-13 13:59:07 -05:00

68 lines
2.2 KiB
Bash
Executable file

#!/bin/bash
# Please don't delete. This script is linked to, as a redirect, from fleetctl and the Fleet website.
set -eo pipefail
brew_wine(){
# Wine reference: https://wiki.winehq.org/MacOS
# Wine can be installed without brew via a distribution such as https://github.com/Gcenx/macOS_Wine_builds/releases/tag/10.0 or by building from source.
# To install a version tied to a specific commit SHA we must create a local tap and install from it after wine 4.6.4 dropped support, see
# https://github.com/Homebrew/brew/pull/20414
TAP_PATH="$(brew --repository)/Library/Taps/fleet/homebrew-local/Casks"
mkdir -p "${TAP_PATH}"
echo "# tap auto-generated by Fleet for installing wine-stable" > "$(dirname "${TAP_PATH}")/README.md"
curl -O https://raw.githubusercontent.com/Homebrew/homebrew-cask/8a5c4ae85cc2def6a1192779469170df3853e80c/Casks/w/wine-stable.rb
mv wine-stable.rb "${TAP_PATH}/"
brew install --cask fleet/local/wine-stable
xattr -dr com.apple.quarantine "$(brew --prefix)/Caskroom/wine-stable"
exit 0
}
warn_wine(){
printf "\nWARNING: The Wine app developer has an Apple Developer certificate but the\napp bundle post-installation will not be code-signed or notarized.\n\nDo you wish to proceed?\n\n"
while true
do
read -r -p "install> " install
case "$install" in
y|yes|Y|YES) brew_wine ;;
n|no|N|NO) printf "\nExiting...\n\n"; exit 1 ;;
*) printf "\nPlease enter yes or no at the prompt...\n\n" ;;
esac
done
}
# option to execute script in non-interactive mode
while getopts 'n' option
do
case "$option" in
n) mode=auto ;;
*) : ;;
esac
done
# prevent root execution
if [ "$EUID" = 0 ]
then
printf "\nTo prevent unnecessary privilege elevation do not execute this script as the root user.\nExiting...\n\n"; exit 1
fi
# check if Homebrew is installed
if ! command -v brew > /dev/null 2>&1
then
printf "\nHomebrew is not installed.\nPlease install Homebrew.\nFor instructions, see https://brew.sh/\n\n"; exit 1
fi
# install Wine
if [ "$mode" = 'auto' ]
then
printf "\n%s executed in non-interactive mode.\n\n" "$0"; brew_wine
else
warn_wine
fi