#!/usr/bin/env bash # Builds LiveWall-Setup-.exe from prebuilt/ with NSIS (makensis). # # ./installer/build-installer.sh # uses ../prebuilt # SOURCE_DIR=/abs/path ./installer/build-installer.sh # # On Debian/Ubuntu: sudo apt-get install nsis set -euo pipefail here="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" root="$(dirname "$here")" csproj="$root/LiveWall/LiveWall.csproj" version="$(sed -n 's:.*\(.*\).*:\1:p' "$csproj" | head -1)" [ -n "$version" ] || { echo "Could not read from $csproj" >&2; exit 1; } # NSIS VIProductVersion wants four numbers. version4="$version" case "$(awk -F. '{print NF}' <<< "$version")" in 1) version4="$version.0.0.0" ;; 2) version4="$version.0.0" ;; 3) version4="$version.0" ;; esac source_dir="${SOURCE_DIR:-$root/prebuilt}" [ -f "$source_dir/LiveWall.exe" ] || { echo "No published build in $source_dir" >&2; exit 1; } command -v makensis >/dev/null || { echo "makensis not found - install the 'nsis' package" >&2; exit 1; } # Optional: COMPRESS=zlib|lzma|lzma-solid (default lzma-solid), OUT_SUFFIX, SIGNTOOL compress="${COMPRESS:-lzma-solid}" suffix="${OUT_SUFFIX:-}" extra=() [ -n "${SIGNTOOL:-}" ] && extra+=(-DSIGNTOOL="$SIGNTOOL") [ -n "$suffix" ] && extra+=(-DOUT_SUFFIX="$suffix") echo "Building LiveWall $version installer from $source_dir (compressor: $compress)" makensis -V2 \ -DVERSION="$version" \ -DVERSION4="$version4" \ -DSOURCE_DIR="$source_dir" \ -DCOMPRESS="$compress" \ "${extra[@]}" \ "$here/LiveWall.nsi" out="$root/LiveWall-Setup-$version$suffix.exe" ls -lh "$out" echo echo "sha256 $(sha256sum "$out" | cut -d' ' -f1) $(basename "$out")" [ -n "${SIGNTOOL:-}" ] || echo "note not signed - see docs/antivirus.md"