Skip to content

Instantly share code, notes, and snippets.

@Gcenx
Forked from superzazu/wsenginebuilder.sh
Created July 4, 2018 14:52
Show Gist options
  • Save Gcenx/99c0842214501e07f51200b0b3b2acb2 to your computer and use it in GitHub Desktop.
Save Gcenx/99c0842214501e07f51200b0b3b2acb2 to your computer and use it in GitHub Desktop.
Wineskin Engine Builder v1.0: create Wineskin engines from winehq.org
#!/usr/bin/env bash
# Wineskin Engine Builder v1.0: create Wineskin engines from winehq.org
set -e
if [[ $# -ne 3 ]]; then
echo "usage: wsenginebuilder version branch arch" >&2
echo "example 1: wsenginebuilder 3.11 devel osx64" >&2
echo "example 2: wsenginebuilder 3.0.1 stable osx" >&2
exit 1
fi
version=$1
branch=$2
arch=$3
if ! [[ "$branch" =~ ^(devel|stable|staging)$ ]]; then
echo "error: branch must be 'devel', 'stable' or 'staging'" >&2
exit 1
fi
if ! [[ $arch =~ ^(osx|osx64)$ ]]; then
echo "error: arch must be 'osx' (32bit) or 'osx64' (32 + 64bit)" >&2
exit 1
fi
if ! [ -x "$(command -v 7z)" ]; then
echo "error: 7z is not installed (install with \"brew install p7zip\")" >&2
exit 1
fi
filename="portable-winehq-$branch-$version-$arch.tar.gz"
output="wswine-$branch-$version-$arch.tar.7z"
# download file from wine website
curl --fail -O "https://dl.winehq.org/wine-builds/macosx/pool/$filename"
# extract tar.gz to wswine.bundle
mkdir -p wswine.bundle
tar xzf $filename --strip-components=2 -C wswine.bundle
# output wine version in the bundle
echo "wine $branch $version $arch" > wswine.bundle/version
# archive wswine.bundle folder into a tar.7z file
tar cf wswine.tar wswine.bundle
7z a $output wswine.tar
# cleanup
rm ./wswine.tar
rm -rf ./wswine.bundle
rm ./$filename
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment