farmcontrol-server/scripts/build-linux-packages.sh
Tom Butcher f3ae50c788
Some checks failed
farmcontrol/farmcontrol-server/pipeline/head There was a failure building this commit
Add Windows MSI packaging and finalize desktop artifacts script
- Introduced a new Windows Installer XML (WXS) file for packaging the Farm Control Server as an MSI.
- Added a PowerShell script to build the MSI from the WXS file.
- Implemented a new script to finalize desktop artifacts, handling the publication of macOS and Windows packages.
- Updated the Linux build script to improve artifact naming and organization.
- Enhanced the Electrobun configuration to include a post-package script for finalizing desktop artifacts.
2026-07-28 22:37:38 +01:00

55 lines
1.7 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
version="$(bun --eval "console.log(JSON.parse(await Bun.file('package.json').text()).version)")"
arch="x64"
output_dir="app_dist"
binary="${output_dir}/linux/farmcontrol-server"
deb_name="farmcontrol-server-${version}-${arch}.deb"
rpm_name="farmcontrol-server-${version}-${arch}.rpm"
common_fpm_args=(
-f
-s dir
-n farmcontrol-server
-p "${output_dir}/"
-v "${version}"
--after-install packaging/linux/after-install.sh
--before-remove packaging/linux/before-remove.sh
--after-remove packaging/linux/after-remove.sh
"${binary}=/usr/bin/farmcontrol-server"
packaging/linux/farmcontrol-server.service=/lib/systemd/system/farmcontrol-server.service
)
fpm -t deb "${common_fpm_args[@]}"
fpm -t rpm "${common_fpm_args[@]}"
deb_source="${output_dir}/farmcontrol-server_${version}_amd64.deb"
rpm_source="${output_dir}/farmcontrol-server-${version}-1.x86_64.rpm"
if [[ ! -f "${deb_source}" ]]; then
deb_source="$(find "${output_dir}" -maxdepth 1 -name 'farmcontrol-server_*_amd64.deb' | head -n 1)"
fi
if [[ ! -f "${rpm_source}" ]]; then
rpm_source="$(find "${output_dir}" -maxdepth 1 -name 'farmcontrol-server-*.x86_64.rpm' | head -n 1)"
fi
if [[ -z "${deb_source}" || ! -f "${deb_source}" ]]; then
echo "Could not find generated .deb package in ${output_dir}" >&2
exit 1
fi
if [[ -z "${rpm_source}" || ! -f "${rpm_source}" ]]; then
echo "Could not find generated .rpm package in ${output_dir}" >&2
exit 1
fi
mv "${deb_source}" "${output_dir}/${deb_name}"
mv "${rpm_source}" "${output_dir}/${rpm_name}"
rm -rf "${output_dir}/linux"
echo "Published ${output_dir}/${deb_name}"
echo "Published ${output_dir}/${rpm_name}"