feat: move all emissary 'data' files to /data

This commit is contained in:
wpetit 2023-03-29 12:23:28 +02:00
parent 844c5d0e17
commit aa314a939f
4 changed files with 19 additions and 9 deletions

View File

@ -12,6 +12,10 @@ install-emissary-files: tools/yq/bin/yq tools/upx/bin/upx
mkdir -p files/lib/upgrade/keep.d mkdir -p files/lib/upgrade/keep.d
cp -r misc/emissary/keep.d/* files/lib/upgrade/keep.d/ cp -r misc/emissary/keep.d/* files/lib/upgrade/keep.d/
# Copy profile.d files
mkdir -p files/etc/profile.d
cp -r misc/emissary/profile.d/* files/etc/profile.d/
mkdir -p gitea-dl/emissary-agent_linux_$(EMISSARY_ARCH) 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) cd gitea-dl && tar -xzf emissary-agent_*_linux_$(EMISSARY_ARCH).tar.gz -C emissary-agent_linux_$(EMISSARY_ARCH)
@ -22,9 +26,11 @@ install-emissary-files: tools/yq/bin/yq tools/upx/bin/upx
# Patch agent config # Patch agent config
tools/yq/bin/yq -i '.agent.serverUrl = "$${EMISSARY_SERVER_URL}"' files/etc/emissary/agent.yml 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 tools/yq/bin/yq -i '.agent.reconciliationInterval = "$${EMISSARY_RECONCILIATION_INTERVAL}"' files/etc/emissary/agent.yml
tools/yq/bin/yq -i '.agent.privateKeyPath = "/etc/emissary/agent-key.json"' files/etc/emissary/agent.yml tools/yq/bin/yq -i '.agent.privateKeyPath = "/data/emissary/agent-key.json"' files/etc/emissary/agent.yml
tools/yq/bin/yq -i '.agent.controllers.persistence.stateFile = "/etc/emissary/agent-state.json"' files/etc/emissary/agent.yml tools/yq/bin/yq -i '.agent.controllers.persistence.stateFile = "/data/emissary/agent-state.json"' files/etc/emissary/agent.yml
tools/yq/bin/yq -i '.agent.controllers.sysupgrade.firmwareVersionCommand = ["sh", "-c", "source /etc/emissary_firmware && echo \"$$FIRMWARE_VERSION\""]' files/etc/emissary/agent.yml tools/yq/bin/yq -i '.agent.controllers.sysupgrade.firmwareVersionCommand = ["sh", "-c", "source /etc/emissary_firmware && echo \"$$FIRMWARE_VERSION\""]' files/etc/emissary/agent.yml
tools/yq/bin/yq -i '.agent.controllers.app.dataDir = "/data/emissary/apps/data"' files/etc/emissary/agent.yml
tools/yq/bin/yq -i '.agent.controllers.app.downloadDir = "/data/emissary/apps/bundles"' files/etc/emissary/agent.yml
# Copy emissary binary # Copy emissary binary
mkdir -p files/usr/local/bin mkdir -p files/usr/local/bin
@ -32,10 +38,10 @@ install-emissary-files: tools/yq/bin/yq tools/upx/bin/upx
chmod +x files/usr/local/bin/emissary chmod +x files/usr/local/bin/emissary
# Set defaults # Set defaults
mkdir -p files/etc/emissary mkdir -p files/data/emissary
rm -rf files/etc/emissary/default.conf rm -rf files/data/emissary/default.conf
echo "EMISSARY_RECONCILIATION_INTERVAL='$(EMISSARY_RECONCILIATION_INTERVAL)'" > files/etc/emissary/default.conf echo "EMISSARY_RECONCILIATION_INTERVAL='$(EMISSARY_RECONCILIATION_INTERVAL)'" > files/data/emissary/default.conf
echo "EMISSARY_SERVER_URL='$(EMISSARY_SERVER_URL)'" >> files/etc/emissary/default.conf echo "EMISSARY_SERVER_URL='$(EMISSARY_SERVER_URL)'" >> files/data/emissary/default.conf
# Compress emissary binary # Compress emissary binary
tools/upx/bin/upx -9 files/usr/local/bin/emissary tools/upx/bin/upx -9 files/usr/local/bin/emissary

View File

@ -1,3 +1,4 @@
/etc/machine-id /etc/machine-id
/etc/emissary/agent-key.json /data/emissary/agent-key.json
/etc/emissary/agent-state.json /data/emissary/agent-state.json
/data/emissary/apps/data

View File

@ -0,0 +1,3 @@
#!/bin/sh
export PATH="${PATH}:/usr/local/bin"

View File

@ -3,7 +3,7 @@
set -e set -e
main() { main() {
local default_config="/etc/emissary/default.conf" local default_config="/data/emissary/default.conf"
if [ ! -f "${default_config}" ]; then if [ ! -f "${default_config}" ]; then
exit 0 exit 0