emissary-firmware/install/emissary-files.mk

34 lines
1.4 KiB
Makefile

install-emissary-files:
mkdir -p files/etc/config
cp -r misc/emissary/config/* files/etc/config/
mkdir -p files/etc/init.d
cp -r misc/emissary/init.d/* files/etc/init.d/
mkdir -p files/etc/uci-defaults
cp -r misc/emissary/uci-defaults/* files/etc/uci-defaults/
mkdir -p gitea-dl/emissary-agent_linux_$(EMISSARY_ARCH)
cd gitea-dl && tar -xzf emissary-agent_*_linux_$(EMISSARY_ARCH).tar.gz -C emissary-agent_linux_$(EMISSARY_ARCH)
# Copy agent config
mkdir -p files/etc/emissary
cp gitea-dl/emissary-agent_linux_$(EMISSARY_ARCH)/misc/packaging/common/config-agent.yml files/etc/emissary/agent.yml
# Patch agent config
tools/yq/bin/yq -i '.agent.serverUrl = "$${EMISSARY_SERVER_URL}"' files/etc/emissary/agent.yml
tools/yq/bin/yq -i '.agent.reconciliationInterval = "$${EMISSARY_RECONCILIATION_INTERVAL}"' files/etc/emissary/agent.yml
# Copy emissary binary
mkdir -p files/usr/local/bin
cp gitea-dl/emissary-agent_linux_$(EMISSARY_ARCH)/emissary files/usr/local/bin/emissary
chmod +x files/usr/local/bin/emissary
# Set defaults
mkdir -p files/etc/emissary
rm -rf files/etc/emissary/default.conf
echo "EMISSARY_RECONCILIATION_INTERVAL='$(EMISSARY_RECONCILIATION_INTERVAL)'" > files/etc/emissary/default.conf
echo "EMISSARY_SERVER_URL='$(EMISSARY_SERVER_URL)'" >> files/etc/emissary/default.conf
# Compress emissary binary
tools/upx/bin/upx -9 files/usr/local/bin/emissary