Created
June 27, 2018 14:35
-
-
Save superzazu/5b1c19bd80551d8214a5d402178e683b to your computer and use it in GitHub Desktop.
Wineskin Engine Builder v1.0: create Wineskin engines from winehq.org
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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