1#!/bin/bash
2set -e
3WORKING_DIRECTORY=$(pwd)
4DIST_DIRECTORY="$WORKING_DIRECTORY/enterprise-dist"
5# copy zip file to /tmp/dist
6mkdir -p /tmp/dist
7cp ./enterprise-dist/*.zip /tmp/dist
8echo "Contents of /tmp/dist"
9ls -al /tmp/dist
10
11# nssm download has been unreliable, use a cached copy of it
12echo "Caching NSSM"
13mkdir -p /tmp/cache
14cp ./scripts/build/ci-msi-build/msigenerator/cache/nssm-2.24.zip /tmp/cache
15
16cd ./scripts/build/ci-msi-build/msigenerator
17echo "Building MSI"
18python3 generator/build.py "$@"
19chmod a+x /tmp/scratch/*.msi
20echo "MSI: Copy to $DIST_DIRECTORY"
21cp /tmp/scratch/*.msi "$DIST_DIRECTORY"
22echo "MSI: Generate SHA256"
23MSI_FILE=$(ls "${DIST_DIRECTORY}"/*.msi)
24SHA256SUM=$(sha256sum "$MSI_FILE" | cut -f1 -d' ')
25echo "$SHA256SUM" > "$MSI_FILE.sha256"
26echo "MSI: SHA256 file content:"
27cat "$MSI_FILE.sha256"
28echo "MSI: contents of $DIST_DIRECTORY"
29ls -al "$DIST_DIRECTORY"
30