Skip to content

Commit

Permalink
Initial MSI support
Browse files Browse the repository at this point in the history
  • Loading branch information
defensivedepth committed Nov 28, 2024
1 parent 969367a commit 35b24a8
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 3 deletions.
9 changes: 6 additions & 3 deletions so-elastic-agent-builder/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

ARG MSITOOLS_VERSION=v0.103

FROM alpine:3.19 as msibuilder
FROM ghcr.io/security-onion-solutions/alpine:3.20.2 AS msibuilder

# Re-declare ARG to make it available in this stage
ARG MSITOOLS_VERSION
Expand All @@ -26,7 +26,7 @@ RUN git clone https://github.com/GNOME/msitools.git /build/msitools \
&& ninja -C builddir install

# Final stage with Go
FROM ghcr.io/security-onion-solutions/golang:1.22.6-alpine
FROM ghcr.io/security-onion-solutions/golang:1.23.3-alpine

# Install runtime dependencies for wixl
RUN apk add --no-cache \
Expand All @@ -38,8 +38,11 @@ COPY --from=msibuilder /usr/local/bin/wixl* /usr/local/bin/
COPY --from=msibuilder /usr/local/lib/libmsi* /usr/local/lib/
COPY --from=msibuilder /usr/local/share/wixl-0.103 /usr/local/share/wixl-0.103

# Set up Go workspace
# Set up workspace:
# source is go code
# msi is config & lib for wixl
RUN mkdir /workspace
ADD source /workspace
ADD msi /workspace
WORKDIR /workspace
RUN go get .
33 changes: 33 additions & 0 deletions so-elastic-agent-builder/msi/so-elastic-agent.wxs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="SO-Agent" Language="1033" Version="1.0.0" Manufacturer="Security Onion Solutions" UpgradeCode="bc258551-c208-4c6b-97b0-a164eb550599">
<Package InstallerVersion="301" Compressed="yes" InstallScope="perMachine" />
<MediaTemplate EmbedCab="yes" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFiles64Folder">
<Directory Id="CompanyFolder" Name="Elastic">
<Directory Id="INSTALLLOCATION" Name="Agent">
<Component Id="installer" Guid="2cbb30bc-0a99-aa6b-f2b3-5495290ae580" Win64="yes">
<File Id="installer" Source="/output/so-elastic-agent_windows_amd64" KeyPath="yes" />
</Component>
</Directory>
</Directory>
</Directory>
</Directory>
<Feature Id="SOElasticAgent" Title="SOElasticAgent" Description="Installs all the files needed for SOElasticAgent" Level="1" AllowAdvertise="no" ConfigurableDirectory="INSTALLLOCATION">
<ComponentRef Id="installer"/>
</Feature>
<Binary Id="WixCA" SourceFile="wixca.dll" />
<CustomAction Id="SetInstall" Property="Install" Value="&quot;[#installer]&quot;"></CustomAction>
<CustomAction Id="SetUninstall" Property="Uninstall" Value="&quot;[INSTALLLOCATION]elastic-agent.exe&quot; uninstall"></CustomAction>
<CustomAction Id="Uninstall" BinaryKey="WixCA" DllEntry="WixQuietExec" Execute="deferred" Return="ignore" Impersonate="no"/>
<CustomAction Id="Install" BinaryKey="WixCA" DllEntry="WixQuietExec" Execute="deferred" Return="ignore" Impersonate="no"/>
<InstallExecuteSequence>
<Custom Action="SetUninstall" After="InstallInitialize">REMOVE=&quot;ALL&quot;</Custom>
<Custom Action="Uninstall" After="SetUninstall">REMOVE=&quot;ALL&quot;</Custom>
<Custom Action="SetInstall" Before="Install">Not Installed</Custom>
<Custom Action="Install" Before="InstallFinalize">Not Installed</Custom>
</InstallExecuteSequence>
</Product>
</Wix>
Binary file added so-elastic-agent-builder/msi/wixca.dll
Binary file not shown.

0 comments on commit 35b24a8

Please sign in to comment.