diff --git a/dev-tools/packer/platforms/centos/run.sh.j2 b/dev-tools/packer/platforms/centos/run.sh.j2 index 1c35281e0dca..d5df40c6e11d 100644 --- a/dev-tools/packer/platforms/centos/run.sh.j2 +++ b/dev-tools/packer/platforms/centos/run.sh.j2 @@ -24,8 +24,8 @@ RPM_VERSION=`echo ${VERSION} | sed 's/-/_/g'` fpm --force -s dir -t rpm \ -n {{.beat_name}} -v ${RPM_VERSION} \ --architecture {{.rpm_arch}} \ - --vendor "Elastic" \ - --license "ASL 2.0" \ + --vendor "{{.beat_vendor}}" \ + --license "{{.beat_license}}" \ --description "{{.beat_description}}" \ --url {{.beat_url}} \ --rpm-init /tmp/{{.beat_name}}.init \ diff --git a/dev-tools/packer/platforms/centos/systemd.j2 b/dev-tools/packer/platforms/centos/systemd.j2 index 457f289fa83a..8f14e9effcea 100644 --- a/dev-tools/packer/platforms/centos/systemd.j2 +++ b/dev-tools/packer/platforms/centos/systemd.j2 @@ -1,6 +1,6 @@ [Unit] Description={{.beat_name}} -Documentation=https://www.elastic.co/guide/en/beats/{{.beat_name}}/current/index.html +Documentation={{.beat_doc_url}} Wants=network-online.target After=network-online.target diff --git a/dev-tools/packer/platforms/debian/run.sh.j2 b/dev-tools/packer/platforms/debian/run.sh.j2 index 6815062edb3f..95ff01792bee 100644 --- a/dev-tools/packer/platforms/debian/run.sh.j2 +++ b/dev-tools/packer/platforms/debian/run.sh.j2 @@ -20,8 +20,8 @@ fi # create deb fpm --force -s dir -t deb \ -n {{.beat_name}} -v ${VERSION} \ - --vendor "Elastic" \ - --license "ASL 2.0" \ + --vendor "{{.beat_vendor}}" \ + --license "{{.beat_license}}" \ --architecture {{.deb_arch}} \ --description "{{.beat_description}}" \ --url {{.beat_url}} \ diff --git a/dev-tools/packer/platforms/debian/systemd.j2 b/dev-tools/packer/platforms/debian/systemd.j2 index 457f289fa83a..8f14e9effcea 100644 --- a/dev-tools/packer/platforms/debian/systemd.j2 +++ b/dev-tools/packer/platforms/debian/systemd.j2 @@ -1,6 +1,6 @@ [Unit] Description={{.beat_name}} -Documentation=https://www.elastic.co/guide/en/beats/{{.beat_name}}/current/index.html +Documentation={{.beat_doc_url}} Wants=network-online.target After=network-online.target diff --git a/dev-tools/packer/xgo-scripts/before_build.sh b/dev-tools/packer/xgo-scripts/before_build.sh index 58f5b04bc3e4..9cd82ddabb07 100755 --- a/dev-tools/packer/xgo-scripts/before_build.sh +++ b/dev-tools/packer/xgo-scripts/before_build.sh @@ -54,7 +54,7 @@ go install github.com/tsg/gotpl cat ${LIBBEAT_PATH}/docs/version.asciidoc >> ${PREFIX}/package.yml # Make variable naming of doc-branch compatible with gotpl. Generate and copy README.md into homedir sed -i -e 's/:doc-branch/doc_branch/g' ${PREFIX}/package.yml -/go/bin/gotpl ${LIBBEAT_PATH}/../dev-tools/packer/readme.md.j2 < ${PREFIX}/package.yml > ${PREFIX}/homedir/README.md +/go/bin/gotpl /templates/readme.md.j2 < ${PREFIX}/package.yml > ${PREFIX}/homedir/README.md # Copy template cp $BEATNAME.template.json $PREFIX/$BEATNAME.template.json diff --git a/libbeat/scripts/Makefile b/libbeat/scripts/Makefile index b46c21c8674e..3e6a699f899c 100755 --- a/libbeat/scripts/Makefile +++ b/libbeat/scripts/Makefile @@ -1,11 +1,14 @@ - ### VARIABLE SETUP ### - +### Application using libbeat may override the following variables in their Makefile BEATNAME?=libbeat BEAT_DESCRIPTION?=Sends events to Elasticsearch or Logstash +BEAT_VENDOR?=Elastic +BEAT_LICENSE?=ASL 2.0 +BEAT_DOC_URL?=https://www.elastic.co/guide/en/beats/${BEATNAME}/current/index.html BEAT_DIR?=github.com/elastic/beats/${BEATNAME} ES_BEATS?=.. GOPACKAGES?=${BEAT_DIR}/... +PACKER_TEMPLATES_DIR?=${ES_BEATS}/dev-tools/packer # Makefile for a custom beat that includes this libbeat/scripts/Makefile: # if glide is used to manage vendor dependencies, @@ -337,6 +340,7 @@ prepare-package: # cross compile on ubuntu docker run --rm \ -v $(abspath ${ES_BEATS}/dev-tools/packer/xgo-scripts):/scripts \ + -v $(abspath ${PACKER_TEMPLATES_DIR}):/templates \ -v $(abspath ../):/source \ -v $(BUILD_DIR):/build \ -e PUREGO="yes" \ @@ -355,6 +359,7 @@ prepare-package-cgo: # cross compile on ubuntu docker run --rm \ -v $(abspath ${ES_BEATS}/dev-tools/packer/xgo-scripts):/scripts \ + -v $(abspath ${PACKER_TEMPLATES_DIR}):/templates \ -v $(abspath ../):/source \ -v $(BUILD_DIR):/build \ -e PACK=${BEATNAME} \ @@ -369,6 +374,7 @@ prepare-package-cgo: docker run --rm \ -v ${BUILD_DIR}:/build \ -v $(abspath ${ES_BEATS}/dev-tools/packer/xgo-scripts):/scripts \ + -v $(abspath ${PACKER_TEMPLATES_DIR}):/templates \ -v $(abspath ..):/source \ -e PACK=${BEATNAME} \ -e BEFORE_BUILD=before_build.sh \ @@ -396,6 +402,9 @@ package: package-setup echo "beat_url: https://${BEAT_DIR}" >> ${BUILD_DIR}/package.yml echo "beat_repo: ${BEAT_DIR}" >> ${BUILD_DIR}/package.yml echo "beat_description: ${BEAT_DESCRIPTION}" >> ${BUILD_DIR}/package.yml + echo "beat_vendor: ${BEAT_VENDOR}" >> ${BUILD_DIR}/package.yml + echo "beat_license: ${BEAT_LICENSE}" >> ${BUILD_DIR}/package.yml + echo "beat_doc_url: ${BEAT_DOC_URL}" >> ${BUILD_DIR}/package.yml cat ${ES_BEATS}/dev-tools/packer/version.yml >> ${BUILD_DIR}/package.yml if [ $(CGO) = true ]; then \