OpenRCT2/scripts/build-installer
Margen67 3188865313
Script improvements (#14452)
shebang:
 Move parameters from set.
 Add newline after for consistency.
curl:
 Add -f;
  Prevents output on error.
 Use -O where applicable;
  -o with the same filename as the URL is pointless.
 Add -S after -s:
  Makes curl still error despite being silent.
build-symbols:
 Add zip fallback.
get-discord-rpc:
 Move git clone parameters before repository for readability.
 Use --depth 1 to speed up cloning.
install-nsis:
 Use ProgramData environment variable.
build-appimage-docker.sh:
 Add -e to docker run.
 Run script directly.
build-appimage.sh:
 Make if more consistent.
Remove unused Travis scripts.
setenv:
 unset instead of blanking variables.
vstool.cmd:
 Use ProgramFiles(x86) environment variable.
2021-04-12 19:01:15 -03:00

47 lines
1.4 KiB
Bash
Executable file

#!/bin/bash -e
if [[ "$#" -gt 2 || "$1" == "-h" ]]; then
echo 'Create a Windows installer for OpenRCT2'
echo ''
echo 'Usage: create-installer [-i] [<destination>]'
echo ''
echo ' -i install portable NSIS'
exit 1
fi
installnsis=
output=$1
if [[ "$1" == "-i" ]]; then
installnsis=true
output=$2
fi
basedir="$(readlink -f `dirname $0`/..)"
if [[ "$output" == "" ]]; then
mkdir -p "$basedir/artifacts"
output="$basedir/artifacts/openrct2-installer-$CONFIGURATION-$PLATFORM.exe"
fi
outputdir=$(dirname $output)
if ! [ -d "$outputdir" ]; then
echo -e >&2 "\033[0;31m$outputdir does not exist\033[0m"
exit 1
fi
output=$(cygpath -w $(readlink -f $output))
# Check makensis is available
if [[ "$installnsis" == "true" ]]; then
$basedir/scripts/install-nsis -d /tmp/nsis
export PATH=/tmp/nsis/bin:$PATH
fi
if ! [ -x "$(command -v makensis)" ]; then
echo -e >&2 "\033[0;31mmakensis not found\033[0m"
exit 1
fi
nsispath=$(cygpath -w $basedir/distribution/windows/install.nsi)
echo -e "\033[0;36mCreating installer for OpenRCT2 $OPENRCT2_VERSION-$OPENRCT2_VERSION_EXTRA ($PLATFORM)...\033[0m"
makensis "/DOUTFILE=$output" "//DAPPV_MAIN=$OPENRCT2_VERSION" "//DAPPV_EXTRA=${OPENRCT2_VERSION_EXTRA//\//\\}" "//DPLATFORM=$PLATFORM" "$nsispath"
printf '\033[0;32m%s\033[0m\n' "${output} created successfully"