carrier/windows/installer.sh

32 lines
1.2 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
# Pack the dist/ bundle into carrier-windows-<version>-setup.exe.
#
# Run from the carrier checkout after windows/bundle.sh has produced
# dist/. Requires Inno Setup 7 (per-user install, which its own
# installer's "just me" option produces).
set -euo pipefail
say() { printf '\n==> %s\n' "$*"; }
die() { printf '\n!! %s\n' "$*" >&2; exit 1; }
# MSYS2's login shells prune LOCALAPPDATA from the environment, so fall
# back to cygpath (CSIDL 28 = local AppData of the current user).
if [ -n "${LOCALAPPDATA:-}" ]; then
appdata=$(cygpath -u "$LOCALAPPDATA")
else
appdata=$(cygpath -F 28)
fi
ISCC="$appdata/Programs/Inno Setup 7/ISCC.exe"
[ -f "$ISCC" ] || die "Inno Setup not found at $ISCC — install it from https://jrsoftware.org/isdl.php"
[ -d dist ] || die "no dist/ bundle — run windows/bundle.sh first"
version=$(sed -n 's/^version = "\(.*\)"$/\1/p' Cargo.toml | head -1)
say "compiling the installer"
# MSYS2_ARG_CONV_EXCL stops MSYS2 mangling /DVersion into a path.
MSYS2_ARG_CONV_EXCL="*" "$ISCC" /DVersion="$version" windows/carrier.iss \
|| die "ISCC failed"
say "done — carrier-windows-$version-setup.exe (in the checkout root)"