@cryptotaxi247 / netdata-1 / commits / 3116f98b2

Simplify development on Windows (package-windows.sh) (#22087)

thiagoftsm committed Mar 30, 2026 at 18:10 UTC 3116f98b2f06c39672e558023ded73c61eb6eedf
1 file changed +69
packaging/windows/wix-installer.sh new
+69
@@ -0,0 +1,69 @@
1 +#!/bin/bash
2 +
3 +repo_root="$(dirname "$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" > /dev/null && pwd -P)")")"
4 +
5 +# shellcheck source=packaging/windows/win-build-dir.sh
6 +. "${repo_root}/packaging/windows/win-build-dir.sh"
7 +
8 +set -eu -o pipefail
9 +
10 +wix_arch="${WIX_ARCH:-x64}"
11 +WIX_BIN="${WIX_BIN:-}"
12 +
13 +find_cmd() {
14 + local cmd
15 +
16 + for cmd in "$@"; do
17 + if command -v "${cmd}" > /dev/null 2>&1; then
18 + command -v "${cmd}"
19 + return 0
20 + fi
21 + done
22 +
23 + return 1
24 +}
25 +
26 +find_wix() {
27 + local candidate=""
28 +
29 + if candidate="$(find_cmd wix wix.exe)"; then
30 + printf '%s\n' "${candidate}"
31 + return 0
32 + fi
33 +
34 + for candidate in \
35 + ${HOME:+"${HOME}/.dotnet/tools/wix.exe"} \
36 + "/c/Program Files/WixToolset v6.0/bin/wix.exe" \
37 + "/c/Program Files/WiX Toolset v6.0/bin/wix.exe" \
38 + "/c/Program Files/WixToolset v5.0/bin/wix.exe" \
39 + "/c/Program Files/WiX Toolset v5.0/bin/wix.exe" \
40 + "/c/Program Files (x86)/WixToolset v6.0/bin/wix.exe" \
41 + "/c/Program Files (x86)/WiX Toolset v6.0/bin/wix.exe" \
42 + "/c/Program Files (x86)/WixToolset v5.0/bin/wix.exe" \
43 + "/c/Program Files (x86)/WiX Toolset v5.0/bin/wix.exe"
44 + do
45 + if [ -f "${candidate}" ]; then
46 + printf '%s\n' "${candidate}"
47 + return 0
48 + fi
49 + done
50 +
51 + return 1
52 +}
53 +
54 +if [ -z "${WIX_BIN}" ]; then
55 + WIX_BIN="$(find_wix || true)"
56 +fi
57 +
58 +# shellcheck disable=SC2154 # build is set by the sourced win-build-dir.sh
59 +if [ -n "${WIX_BIN}" ] && [ -f "${build}/netdata.wxs" ]; then
60 + ${GITHUB_ACTIONS+echo "::group::MSI"}
61 + cd "${build}"
62 + "${WIX_BIN}" build \
63 + -arch "${wix_arch}" \
64 + -ext WixToolset.Util.wixext \
65 + -ext WixToolset.UI.wixext \
66 + -out "${repo_root}/packaging/windows/netdata-${wix_arch}.msi" \
67 + "netdata.wxs"
68 + ${GITHUB_ACTIONS+echo "::endgroup::"}
69 +fi