#!/usr/bin/env bash set -euo pipefail VERSION="${VERSION:-0.1.0}" ARCH="${ARCH:-amd64}" PKG_NAME="local-installer-agent" BUILD_ROOT="build" BUILD_DIR="${BUILD_ROOT}/${PKG_NAME}_${VERSION}_${ARCH}" rm -rf "${BUILD_ROOT}" mkdir -p "${BUILD_DIR}/opt/local-installer-agent" mkdir -p "${BUILD_DIR}/etc/local-installer-agent" mkdir -p "${BUILD_DIR}/etc/systemd/system" mkdir -p "${BUILD_DIR}/DEBIAN" cp -r app "${BUILD_DIR}/opt/local-installer-agent/" cp requirements.txt "${BUILD_DIR}/opt/local-installer-agent/" cp packaging/systemd/local-installer-agent.service \ "${BUILD_DIR}/etc/systemd/system/local-installer-agent.service" cp packaging/DEBIAN/control "${BUILD_DIR}/DEBIAN/control" cp packaging/DEBIAN/postinst "${BUILD_DIR}/DEBIAN/postinst" cp packaging/DEBIAN/prerm "${BUILD_DIR}/DEBIAN/prerm" cp packaging/DEBIAN/postrm "${BUILD_DIR}/DEBIAN/postrm" chmod 755 "${BUILD_DIR}/DEBIAN/postinst" chmod 755 "${BUILD_DIR}/DEBIAN/prerm" chmod 755 "${BUILD_DIR}/DEBIAN/postrm" cat > "${BUILD_DIR}/etc/local-installer-agent/agent.env" <