From 6e2d9ed66ca911833d0ac2cc8e1fb46972bd7100 Mon Sep 17 00:00:00 2001 From: Josh Mullins Date: Thu, 13 Jan 2022 12:10:29 -0500 Subject: [PATCH 1/2] Added hologram host arg to allow pre-configured internal-use installers --- Dockerfile | 3 ++- buildscripts/build_osx_pkgs.sh | 6 ++++++ buildscripts/compile_hologram.sh | 2 +- buildscripts/start.sh | 2 ++ hologram.sh | 2 +- 5 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 076204c..d4e0f7a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,7 +14,8 @@ RUN apt-get update && apt-get install -y \ rsyslog \ ruby \ zlib1g-dev \ - ruby-dev + ruby-dev \ + jq RUN gem install fpm diff --git a/buildscripts/build_osx_pkgs.sh b/buildscripts/build_osx_pkgs.sh index d2f9924..28d5ae0 100755 --- a/buildscripts/build_osx_pkgs.sh +++ b/buildscripts/build_osx_pkgs.sh @@ -23,6 +23,12 @@ install -m 0644 ${HOLOGRAM_DIR}/agent/support/darwin/com.adroll.hologram-me.plis install -m 0755 ${HOLOGRAM_DIR}/agent/support/darwin/postinstall.sh /hologram-build/darwin/scripts/postinstall install -m 0755 ${HOLOGRAM_DIR}/agent/support/darwin/preinstall.sh /hologram-build/darwin/scripts/preinstall +# Special handling for custom host override +if [[ -n "$HOLOGRAM_HOST" ]] +then + cat "${HOLOGRAM_DIR}/config/agent.json" | jq ". + {\"host\": \"$HOLOGRAM_HOST\"}" > /hologram-build/darwin/root/etc/hologram/agent.json +fi + NUM_FILES=$(find /hologram-build/darwin/root | wc -l) INSTALL_KB_SIZE=$(du -k -s /hologram-build/darwin/root | awk '{print $1}') diff --git a/buildscripts/compile_hologram.sh b/buildscripts/compile_hologram.sh index 05aecc1..aa6c553 100755 --- a/buildscripts/compile_hologram.sh +++ b/buildscripts/compile_hologram.sh @@ -7,7 +7,7 @@ source ${HOLOGRAM_DIR}/buildscripts/returncodes.sh export GIT_TAG=$(git describe --tags --long) echo "Compiling for linux..." -GOOS=linux go install -ldflags="-X 'main.Version=${GIT_TAG}'" github.com/AdRoll/hologram/... || exit ${ERRCOMPILE} +GOOS=linux go install -ldflags="-X 'main.Version=${GIT_TAG}'" github.com/AdRoll/hologram/... || exit ${ERRCOMPILE} echo "Compiling for osx" GOOS=darwin go install -ldflags="-X 'main.Version=${GIT_TAG}'" github.com/AdRoll/hologram/... || exit ${ERRCOMPILE} diff --git a/buildscripts/start.sh b/buildscripts/start.sh index 3cd1e1b..c9491b4 100755 --- a/buildscripts/start.sh +++ b/buildscripts/start.sh @@ -4,6 +4,8 @@ source ${HOLOGRAM_DIR}/buildscripts/returncodes.sh rsyslogd # Believe it or not you need syslog to test hologram +export HOLOGRAM_HOST="$2" + if [ "$1" == "build_linux" ]; then compile_hologram.sh --deps || exit $? build_linux_pkgs.sh || exit $? diff --git a/hologram.sh b/hologram.sh index a89fd1c..7f45f72 100755 --- a/hologram.sh +++ b/hologram.sh @@ -1,3 +1,3 @@ #!/bin/bash #docker build -t adroll/hologram_env . -docker run --rm -t -i -v $(pwd):/go/src/github.com/AdRoll/hologram adroll/hologram_env $1 +docker run --rm -t -i -v $(pwd):/go/src/github.com/AdRoll/hologram adroll/hologram_env $1 $2 From bf235914654ac87f9485775dfda262c102d8e5b8 Mon Sep 17 00:00:00 2001 From: Josh Mullins Date: Tue, 23 Aug 2022 14:48:42 -0400 Subject: [PATCH 2/2] Uncommented docker build command This docker file is required to build the installers --- hologram.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hologram.sh b/hologram.sh index 7f45f72..1a66290 100755 --- a/hologram.sh +++ b/hologram.sh @@ -1,3 +1,3 @@ #!/bin/bash -#docker build -t adroll/hologram_env . +docker build -t adroll/hologram_env . docker run --rm -t -i -v $(pwd):/go/src/github.com/AdRoll/hologram adroll/hologram_env $1 $2