-
Notifications
You must be signed in to change notification settings - Fork 232
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add MSI build script and templates for Windows infrastructure agent
- Loading branch information
Showing
4 changed files
with
115 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
#!/bin/bash | ||
|
||
# sudo apt update | ||
# sudo apt install -y msitools | ||
|
||
|
||
# Exit script on any error | ||
set -e | ||
|
||
# Variables | ||
OUTPUT_DIR="./dist/windows" | ||
APP_NAME="oneuptime-infrastructure-agent" | ||
# Take version from --version argument | ||
|
||
APP_VERSION=$1 | ||
|
||
# Log version | ||
echo "Building MSI for version: $APP_VERSION" | ||
|
||
# Paths to binaries | ||
BINARIES=( | ||
"./dist/oneuptime_windows_amd64_v1/oneuptime-infrastructure-agent.exe" | ||
"./dist/oneuptime_windows_arm64/oneuptime-infrastructure-agent.exe" | ||
) | ||
|
||
# Architecture mappings | ||
ARCHES=("amd64" "arm64") | ||
|
||
# Ensure output directory exists | ||
mkdir -p "$OUTPUT_DIR" | ||
|
||
# Check if wixl is installed | ||
if ! command -v wixl &> /dev/null; then | ||
echo "Error: wixl is not installed. Please install it using 'sudo apt install -y msitools'." | ||
exit 1 | ||
fi | ||
|
||
# Generate MSI files for each binary | ||
for i in "${!BINARIES[@]}"; do | ||
BINARY="${BINARIES[$i]}" | ||
ARCH="${ARCHES[$i]}" | ||
WXS_INPUT_FILE="./windows/app-$ARCH-template.wxs" | ||
WXS_OUTPUT_FILE="./windows/app-$ARCH.wxs" | ||
MSI_FILE="$OUTPUT_DIR/$APP_NAME-$APP_VERSION-$ARCH.msi" | ||
|
||
# log binary and arch | ||
echo "Building MSI for binary: $BINARY and arch: $ARCH" | ||
|
||
# Update the WXS file with the correct binary | ||
sed "s|binary_placeholder|$BINARY|g" $WXS_INPUT_FILE > "$WXS_OUTPUT_FILE" | ||
|
||
# Update version in WXS file | ||
sed -i "s|version_placeholder|$APP_VERSION|g" "$WXS_OUTPUT_FILE" | ||
|
||
echo "Packaging $BINARY into $MSI_FILE..." | ||
wixl -o "$MSI_FILE" "$WXS_OUTPUT_FILE" | ||
|
||
if [ $? -eq 0 ]; then | ||
echo "MSI successfully created: $MSI_FILE" | ||
else | ||
echo "Error: Failed to create MSI for $ARCH." | ||
exit 1 | ||
fi | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?xml version="1.0"?> | ||
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> | ||
<Product Id="*" Name="OneUptime Infrastructure Agent (amd64)" Language="1033" Version="version_placeholder" Manufacturer="HackerBay, Inc." UpgradeCode="4ea4efc3-2b63-4afd-b1a9-ab47e626b752"> | ||
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" /> | ||
<MajorUpgrade DowngradeErrorMessage="A newer version of OneUptime Infrastructure Agent is already installed." /> | ||
<Media Id="1" Cabinet="media1.cab" EmbedCab="yes" /> | ||
|
||
<Directory Id="TARGETDIR" Name="SourceDir"> | ||
<Directory Id="ProgramFilesFolder"> | ||
<Directory Id="INSTALLFOLDER" Name="OneUptimeAgent" /> | ||
</Directory> | ||
</Directory> | ||
|
||
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER"> | ||
<Component Id="MainExecutable" Guid="2fffc00b-249b-4425-9bbb-524689362a81"> | ||
<File Source="binary_placeholder" /> | ||
</Component> | ||
</ComponentGroup> | ||
|
||
<Feature Id="ProductFeature" Title="OneUptime Infrastructure Agent (amd64)" Level="1"> | ||
<ComponentGroupRef Id="ProductComponents" /> | ||
</Feature> | ||
</Product> | ||
</Wix> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?xml version="1.0"?> | ||
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> | ||
<Product Id="*" Name="OneUptime Infrastructure Agent (arm64)" Language="1033" Version="version_placeholder" Manufacturer="HackerBay, Inc." UpgradeCode="e2c6daee-3273-43ab-bef1-09cc0960c356"> | ||
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" /> | ||
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." /> | ||
<Media Id="1" Cabinet="media1.cab" EmbedCab="yes" /> | ||
|
||
<Directory Id="TARGETDIR" Name="SourceDir"> | ||
<Directory Id="ProgramFilesFolder"> | ||
<Directory Id="INSTALLFOLDER" Name="OneUptimeAgent" /> | ||
</Directory> | ||
</Directory> | ||
|
||
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER"> | ||
<Component Id="MainExecutable" Guid="PUT-ARM64-GUID-HERE"> | ||
<File Source="binary_placeholder" /> | ||
</Component> | ||
</ComponentGroup> | ||
|
||
<Feature Id="ProductFeature" Title="OneUptime Infrastructure Agent (arm64)" Level="1"> | ||
<ComponentGroupRef Id="ProductComponents" /> | ||
</Feature> | ||
</Product> | ||
</Wix> |