2014-01-28 01:21:47 +04:00
|
|
|
# This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
|
2017-09-14 00:02:07 +03:00
|
|
|
# Although MIG components can be installed using the typical go tools
|
|
|
|
# e.g., using "go get", the Makefile here provides a few helper functions
|
|
|
|
# related to specific tasks. This includes appying a value to the mig package
|
|
|
|
# Version variable to give the components a version.
|
|
|
|
#
|
|
|
|
# We also have various targets in here related to binary signing and package
|
|
|
|
# creation.
|
|
|
|
#
|
|
|
|
# When the makefile is used to build components the binaries are placed in a
|
|
|
|
# bin directory at the repository root rather then in $GOPATH/bin.
|
|
|
|
|
|
|
|
BUILDENV := dev
|
|
|
|
BUILDREL := 0
|
|
|
|
BINSUFFIX :=
|
|
|
|
OS := $(shell uname -s| tr '[:upper:]' '[:lower:]')
|
|
|
|
ARCH := amd64
|
|
|
|
BINDIR := bin/$(OS)/$(ARCH)
|
|
|
|
|
2014-12-28 21:40:10 +03:00
|
|
|
ifeq ($(OS),windows)
|
2017-09-14 00:02:07 +03:00
|
|
|
# On windows, the version is year.month.date.release
|
2015-09-24 18:27:39 +03:00
|
|
|
BUILDREV := $(shell date +%y).$(shell date +%m).$(shell date +%d).$(BUILDREL)
|
2014-12-28 21:40:10 +03:00
|
|
|
BINSUFFIX := ".exe"
|
|
|
|
else
|
2017-09-14 00:02:07 +03:00
|
|
|
# On linux and darwin, the version is yearmonthdate.release+lastcommit.env
|
2015-09-24 18:27:39 +03:00
|
|
|
BUILDREV := $(shell date +%Y%m%d)-$(BUILDREL).$(shell git log --pretty=format:'%h' -n 1).$(BUILDENV)
|
2014-12-28 21:40:10 +03:00
|
|
|
endif
|
2014-01-28 01:21:47 +04:00
|
|
|
|
2017-03-29 18:19:02 +03:00
|
|
|
# Set this to yes if you want yara support and want to use the yara module
|
|
|
|
#
|
|
|
|
# This assumes yara has been compiled with the following options:
|
|
|
|
# --disable-shared --disable-magic --disable-cuckoo --without-crypto
|
|
|
|
#
|
|
|
|
# If you have built yara some other way or have yara shared libraries
|
2017-09-14 00:02:07 +03:00
|
|
|
# installed you will need to adjust the makefile.
|
2017-03-29 18:19:02 +03:00
|
|
|
#
|
|
|
|
# You may have to set the CPATH and LIBRARY_PATH environment variables
|
|
|
|
# if you have installed the yara headers and library somewhere the build
|
2017-09-14 00:02:07 +03:00
|
|
|
# tools can't locate.
|
|
|
|
WITHYARA := no
|
2017-03-29 18:19:02 +03:00
|
|
|
|
2016-10-29 00:05:08 +03:00
|
|
|
# These variables control signature operations used when building various
|
|
|
|
# targets on OSX.
|
|
|
|
#
|
|
|
|
# OSXPROCSIGID if set will result in the specified identity being used to
|
|
|
|
# sign the mig-agent and mig-loader binaries when built on OSX. If empty,
|
|
|
|
# the compiled binaries will not be signed.
|
|
|
|
#
|
2017-03-29 18:19:02 +03:00
|
|
|
# OSXPACKSIGID if set will result in the specified identity being used to
|
2016-10-29 00:05:08 +03:00
|
|
|
# sign the mig-loader package (osx-loader-pkg). If empty the .pkg will not
|
|
|
|
# be signed.
|
|
|
|
#
|
|
|
|
# This uses the signature related options to pkgbuild and codesign
|
|
|
|
#
|
|
|
|
# https://developer.apple.com/library/content/technotes/tn2206/_index.html
|
|
|
|
# https://developer.apple.com/developer-id/
|
|
|
|
#
|
2017-09-14 00:02:07 +03:00
|
|
|
OSXPROCSIGID ?=
|
|
|
|
OSXPACKSIGID ?=
|
|
|
|
SIGNFLAGS :=
|
2014-01-28 01:21:47 +04:00
|
|
|
|
2014-06-16 23:50:09 +04:00
|
|
|
ifeq ($(ARCH),amd64)
|
|
|
|
FPMARCH := x86_64
|
|
|
|
endif
|
|
|
|
ifeq ($(ARCH),386)
|
2014-08-21 17:10:59 +04:00
|
|
|
FPMARCH := i386
|
2014-06-16 23:50:09 +04:00
|
|
|
endif
|
2014-12-28 21:40:10 +03:00
|
|
|
|
2017-09-14 00:02:07 +03:00
|
|
|
# MSICONF is used for building Windows agent packages, and indicates the path to the
|
|
|
|
# wxs file wixl should use.
|
2014-12-28 21:40:10 +03:00
|
|
|
MSICONF := mig-agent-installer.wxs
|
2014-01-28 01:21:47 +04:00
|
|
|
|
2016-10-29 00:05:08 +03:00
|
|
|
# If code signing is enabled for OSX binaries, pass the -s flag during linking
|
|
|
|
# otherwise the signed binary will not execute correctly
|
|
|
|
# https://github.com/golang/go/issues/11887
|
|
|
|
ifneq ($(OSXPROCSIGID),)
|
|
|
|
ifeq ($(OS),darwin)
|
|
|
|
STRIPOPT := -s
|
|
|
|
endif
|
|
|
|
endif
|
2016-12-22 19:33:29 +03:00
|
|
|
|
2017-03-29 18:19:02 +03:00
|
|
|
CGOLDFLAGS :=
|
2016-12-22 19:33:29 +03:00
|
|
|
GO := GOOS=$(OS) GOARCH=$(ARCH) GO15VENDOREXPERIMENT=1 go
|
2018-07-11 20:14:54 +03:00
|
|
|
MIGVERFLAGS := -X github.com/mozilla/mig.Version=$(BUILDREV)
|
2016-10-29 00:05:08 +03:00
|
|
|
GOLDFLAGS := -ldflags "$(MIGVERFLAGS) $(STRIPOPT)"
|
2014-01-28 01:21:47 +04:00
|
|
|
INSTALL := install
|
2017-07-25 21:46:01 +03:00
|
|
|
SERVERTARGETS := mig-scheduler mig-api mig-runner runner-compliance runner-scribe
|
2016-12-30 04:22:54 +03:00
|
|
|
CLIENTTARGETS := mig-cmd mig-console mig-action-generator mig-action-verifier \
|
2017-09-14 00:02:07 +03:00
|
|
|
mig-agent-search
|
|
|
|
AGENTTARGETS := mig-agent mig-loader
|
|
|
|
ALLTARGETS := $(AGENTTARGETS) $(SERVERTARGETS) $(CLIENTTARGETS)
|
|
|
|
|
|
|
|
# MODULETAGS can be set to indicate a specific module set the agent and command line will
|
|
|
|
# include support for. By default, this is a set of modules that do not require cgo. For example,
|
|
|
|
# to include the memory module in the agent something like "make MODULETAGS='modmemory' mig-agent".
|
|
|
|
# To include no default modules, and only the memory module something like
|
|
|
|
# "make MODULETAGS='nomoddefaults modmemory' mig-agent" can be used. To see a list of available
|
|
|
|
# module tags see the modulepack package.
|
2017-09-07 23:20:46 +03:00
|
|
|
MODULETAGS :=
|
2017-09-14 00:02:07 +03:00
|
|
|
|
2017-09-07 19:27:18 +03:00
|
|
|
BUILDTAGS := $(MODULETAGS)
|
2017-09-07 23:41:59 +03:00
|
|
|
GOOPTS := -tags "$(BUILDTAGS)"
|
2017-09-07 19:27:18 +03:00
|
|
|
|
2017-03-29 18:19:02 +03:00
|
|
|
ifeq ($(WITHYARA),yes)
|
|
|
|
ifeq ($(OS),linux)
|
|
|
|
CGOLDFLAGS += -lyara -lm
|
|
|
|
else ifeq ($(OS),darwin)
|
|
|
|
# Nothing special required here for this to work on darwin
|
|
|
|
else
|
|
|
|
$(error WITHYARA not supported for this platform)
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
export CGO_LDFLAGS = $(CGOLDFLAGS)
|
|
|
|
|
2016-12-30 04:22:54 +03:00
|
|
|
all: test $(ALLTARGETS)
|
2014-01-28 01:21:47 +04:00
|
|
|
|
2015-08-26 18:58:15 +03:00
|
|
|
create-bindir:
|
2017-09-14 00:02:07 +03:00
|
|
|
mkdir -p $(BINDIR)
|
2015-08-26 18:58:15 +03:00
|
|
|
|
2017-09-07 18:57:34 +03:00
|
|
|
mig-agent: create-bindir
|
2017-09-14 00:02:07 +03:00
|
|
|
@echo building mig-agent for $(OS)/$(ARCH)
|
2018-07-11 20:14:54 +03:00
|
|
|
$(GO) build $(GOOPTS) -o $(BINDIR)/mig-agent-$(BUILDREV)$(BINSUFFIX) $(GOLDFLAGS) github.com/mozilla/mig/mig-agent
|
2018-08-17 02:34:15 +03:00
|
|
|
$(GO) build $(GOOPTS) -o $(BINDIR)/mig_agent_cfg tools/mig_agent_cfg.go
|
2014-08-13 20:25:30 +04:00
|
|
|
ln -fs "$$(pwd)/$(BINDIR)/mig-agent-$(BUILDREV)$(BINSUFFIX)" "$$(pwd)/$(BINDIR)/mig-agent-latest"
|
2017-09-14 00:02:07 +03:00
|
|
|
[ -x "$(BINDIR)/mig-agent-$(BUILDREV)$(BINSUFFIX)" ]
|
2016-12-22 19:33:29 +03:00
|
|
|
# If our build target is darwin and OSXPROCSIGID is set, sign the binary
|
2016-11-01 00:24:33 +03:00
|
|
|
if [ $(OS) = "darwin" -a ! -z "$(OSXPROCSIGID)" ]; then \
|
2016-10-29 00:05:08 +03:00
|
|
|
codesign -s "$(OSXPROCSIGID)" $(BINDIR)/mig-agent-$(BUILDREV)$(BINSUFFIX); \
|
|
|
|
fi
|
2014-07-30 21:09:43 +04:00
|
|
|
|
2015-08-26 18:58:15 +03:00
|
|
|
mig-scheduler: create-bindir
|
2018-07-11 20:14:54 +03:00
|
|
|
$(GO) build $(GOOPTS) -o $(BINDIR)/mig-scheduler $(GOLDFLAGS) github.com/mozilla/mig/mig-scheduler
|
2014-01-28 01:21:47 +04:00
|
|
|
|
2015-08-26 18:58:15 +03:00
|
|
|
mig-api: create-bindir
|
2018-07-11 20:14:54 +03:00
|
|
|
$(GO) build $(GOOPTS) -o $(BINDIR)/mig-api $(GOLDFLAGS) github.com/mozilla/mig/mig-api
|
2014-02-11 21:06:20 +04:00
|
|
|
|
2015-09-11 01:27:59 +03:00
|
|
|
mig-runner: create-bindir
|
2018-07-11 20:14:54 +03:00
|
|
|
$(GO) build $(GOOPTS) -o $(BINDIR)/mig-runner $(GOLDFLAGS) github.com/mozilla/mig/mig-runner
|
2015-09-11 01:27:59 +03:00
|
|
|
|
2015-08-26 18:58:15 +03:00
|
|
|
mig-action-generator: create-bindir
|
2018-08-17 02:34:15 +03:00
|
|
|
S(GO) build $(GOOPTS) -o $(BINDIR)/mig-action-generator $(GOLDFLAGS) github.com/mozilla/mig/client/mig-action-generator
|
2014-01-28 01:21:47 +04:00
|
|
|
|
2017-09-08 23:56:37 +03:00
|
|
|
mig-loader: create-bindir
|
2018-07-11 20:14:54 +03:00
|
|
|
$(GO) build $(GOOPTS) -o $(BINDIR)/mig-loader$(BINSUFFIX) $(GOLDFLAGS) github.com/mozilla/mig/mig-loader
|
2016-11-01 00:24:33 +03:00
|
|
|
if [ $(OS) = "darwin" -a ! -z "$(OSXPROCSIGID)" ]; then \
|
2016-10-29 00:05:08 +03:00
|
|
|
codesign -s "$(OSXPROCSIGID)" $(BINDIR)/mig-loader; \
|
|
|
|
fi
|
2015-07-31 00:36:02 +03:00
|
|
|
|
2015-08-26 18:58:15 +03:00
|
|
|
mig-action-verifier: create-bindir
|
2018-07-11 20:14:54 +03:00
|
|
|
$(GO) build $(GOOPTS) -o $(BINDIR)/mig-action-verifier $(GOLDFLAGS) github.com/mozilla/mig/client/mig-action-verifier
|
2014-02-19 00:33:25 +04:00
|
|
|
|
2017-09-07 23:37:33 +03:00
|
|
|
mig-console: create-bindir
|
2018-07-11 20:14:54 +03:00
|
|
|
$(GO) build $(GOOPTS) -o $(BINDIR)/mig-console $(GOLDFLAGS) github.com/mozilla/mig/client/mig-console
|
2014-06-18 07:39:07 +04:00
|
|
|
|
2017-09-07 23:37:33 +03:00
|
|
|
mig-cmd: create-bindir
|
2018-07-11 20:14:54 +03:00
|
|
|
$(GO) build $(GOOPTS) -o $(BINDIR)/mig $(GOLDFLAGS) github.com/mozilla/mig/client/mig
|
2014-11-07 17:38:18 +03:00
|
|
|
|
2015-08-26 18:58:15 +03:00
|
|
|
mig-agent-search: create-bindir
|
2018-07-11 20:14:54 +03:00
|
|
|
$(GO) build $(GOOPTS) -o $(BINDIR)/mig-agent-search $(GOLDFLAGS) github.com/mozilla/mig/client/mig-agent-search
|
2015-08-26 00:54:52 +03:00
|
|
|
|
2015-12-29 22:11:01 +03:00
|
|
|
runner-compliance: create-bindir
|
2018-07-11 20:14:54 +03:00
|
|
|
$(GO) build $(GOOPTS) -o $(BINDIR)/runner-compliance $(GOLDFLAGS) github.com/mozilla/mig/runner-plugins/runner-compliance
|
2015-12-29 22:11:01 +03:00
|
|
|
|
2016-01-12 23:35:11 +03:00
|
|
|
runner-scribe: create-bindir
|
2018-07-11 20:14:54 +03:00
|
|
|
$(GO) build $(GOOPTS) -o $(BINDIR)/runner-scribe $(GOLDFLAGS) github.com/mozilla/mig/runner-plugins/runner-scribe
|
2016-01-12 23:35:11 +03:00
|
|
|
|
2015-08-23 18:13:17 +03:00
|
|
|
go_vendor_dependencies:
|
2017-08-17 00:05:44 +03:00
|
|
|
govend -v -u
|
2015-01-02 22:13:18 +03:00
|
|
|
|
2014-01-31 05:03:49 +04:00
|
|
|
rpm-agent: mig-agent
|
|
|
|
rm -fr tmp
|
2014-12-26 22:49:42 +03:00
|
|
|
$(INSTALL) -D -m 0755 $(BINDIR)/mig-agent-$(BUILDREV) tmp/sbin/mig-agent-$(BUILDREV)
|
2017-09-14 00:02:07 +03:00
|
|
|
mkdir -p tmp/var/lib/mig
|
2016-03-08 06:38:49 +03:00
|
|
|
make agent-install-script-linux
|
|
|
|
make agent-remove-script-linux
|
2014-01-31 05:03:49 +04:00
|
|
|
fpm -C tmp -n mig-agent --license GPL --vendor mozilla --description "Mozilla InvestiGator Agent" \
|
2016-04-06 00:55:33 +03:00
|
|
|
-m "Mozilla <noreply@mozilla.com>" --url http://mig.mozilla.org --architecture $(FPMARCH) -v $(BUILDREV) \
|
2014-12-28 02:33:07 +03:00
|
|
|
--after-remove tmp/agent_remove.sh --after-install tmp/agent_install.sh \
|
2014-12-26 22:44:18 +03:00
|
|
|
-s dir -t rpm .
|
2014-01-31 05:03:49 +04:00
|
|
|
|
2014-04-17 22:05:59 +04:00
|
|
|
deb-agent: mig-agent
|
|
|
|
rm -fr tmp
|
2016-04-06 00:55:33 +03:00
|
|
|
$(INSTALL) -s -D -m 0755 $(BINDIR)/mig-agent-$(BUILDREV) tmp/sbin/mig-agent-$(BUILDREV)
|
|
|
|
$(INSTALL) -D -m 0644 LICENSE tmp/usr/share/doc/mig-agent/copyright
|
2017-09-14 00:02:07 +03:00
|
|
|
mkdir -p tmp/var/lib/mig
|
2016-03-08 06:38:49 +03:00
|
|
|
make agent-install-script-linux
|
|
|
|
make agent-remove-script-linux
|
2016-04-06 00:55:33 +03:00
|
|
|
fpm -C tmp -n mig-agent --license GPL --vendor mozilla \
|
|
|
|
--description "Mozilla InvestiGator Agent\nAgent binary" \
|
|
|
|
-m "Mozilla <noreply@mozilla.com>" --url http://mig.mozilla.org \
|
|
|
|
--architecture $(FPMARCH) -v $(BUILDREV) \
|
2014-12-28 02:33:07 +03:00
|
|
|
--after-remove tmp/agent_remove.sh --after-install tmp/agent_install.sh \
|
2014-12-26 22:44:18 +03:00
|
|
|
-s dir -t deb .
|
2014-04-17 22:05:59 +04:00
|
|
|
|
2016-03-03 19:02:48 +03:00
|
|
|
deb-loader: mig-loader
|
|
|
|
rm -fr tmp
|
2016-04-06 00:55:33 +03:00
|
|
|
$(INSTALL) -s -D -m 0755 $(BINDIR)/mig-loader tmp/sbin/mig-loader
|
|
|
|
$(INSTALL) -D -m 0644 LICENSE tmp/usr/share/doc/mig-loader/copyright
|
2017-09-14 00:02:07 +03:00
|
|
|
mkdir -p tmp/var/lib/mig
|
|
|
|
mkdir -p tmp/etc/mig
|
2016-04-06 00:55:33 +03:00
|
|
|
fpm -C tmp -n mig-loader --license GPL --vendor mozilla \
|
|
|
|
--description "Mozilla InvestiGator Agent Loader\nAgent loader binary" \
|
|
|
|
-m "Mozilla <noreply@mozilla.com>" --url http://mig.mozilla.org \
|
|
|
|
--architecture $(FPMARCH) -v $(BUILDREV) \
|
2016-03-03 19:02:48 +03:00
|
|
|
-s dir -t deb .
|
|
|
|
|
2016-05-18 00:27:19 +03:00
|
|
|
rpm-loader: mig-loader
|
|
|
|
rm -fr tmp
|
|
|
|
$(INSTALL) -s -D -m 0755 $(BINDIR)/mig-loader tmp/sbin/mig-loader
|
|
|
|
$(INSTALL) -D -m 0644 LICENSE tmp/usr/share/doc/mig-loader/copyright
|
2017-09-14 00:02:07 +03:00
|
|
|
mkdir -p tmp/var/lib/mig
|
|
|
|
mkdir -p tmp/etc/mig
|
2016-05-18 00:27:19 +03:00
|
|
|
fpm -C tmp -n mig-loader --license GPL --vendor mozilla \
|
|
|
|
--description "Mozilla InvestiGator Agent Loader\nAgent loader binary" \
|
|
|
|
-m "Mozilla <noreply@mozilla.com>" --url http://mig.mozilla.org \
|
|
|
|
--architecture $(FPMARCH) -v $(BUILDREV) \
|
|
|
|
-s dir -t rpm .
|
|
|
|
|
2014-12-29 22:06:08 +03:00
|
|
|
dmg-agent: mig-agent
|
2014-12-28 21:40:10 +03:00
|
|
|
ifneq ($(OS),darwin)
|
2017-09-14 00:02:07 +03:00
|
|
|
echo 'Set OS=darwin on the make command line to build an OSX package (must be on darwin)'
|
2014-12-28 21:40:10 +03:00
|
|
|
else
|
2015-04-02 15:49:23 +03:00
|
|
|
rm -fr tmp tmpdmg
|
2016-03-08 06:47:24 +03:00
|
|
|
mkdir -p tmp/usr/local/bin
|
|
|
|
mkdir tmpdmg
|
2016-03-08 06:38:49 +03:00
|
|
|
$(INSTALL) -m 0755 $(BINDIR)/mig-agent-$(BUILDREV) tmp/usr/local/bin/mig-agent-$(BUILDREV)
|
2017-09-14 00:02:07 +03:00
|
|
|
mkdir -p 'tmp/Library/Preferences/mig/'
|
2016-03-08 06:38:49 +03:00
|
|
|
make agent-install-script-osx
|
2014-06-20 02:02:21 +04:00
|
|
|
fpm -C tmp -n mig-agent --license GPL --vendor mozilla --description "Mozilla InvestiGator Agent" \
|
2016-04-06 00:55:33 +03:00
|
|
|
-m "Mozilla <noreply@mozilla.com>" --url http://mig.mozilla.org --architecture $(FPMARCH) -v $(BUILDREV) \
|
2014-12-26 23:36:25 +03:00
|
|
|
--after-install tmp/agent_install.sh \
|
2014-12-29 22:06:08 +03:00
|
|
|
-s dir -t osxpkg --osxpkg-identifier-prefix org.mozilla.mig -p tmpdmg/mig-agent-$(BUILDREV)-$(FPMARCH).pkg .
|
|
|
|
hdiutil makehybrid -hfs -hfs-volume-name "Mozilla InvestiGator Agent" \
|
|
|
|
-o ./mig-agent-$(BUILDREV)-$(FPMARCH).dmg tmpdmg
|
2014-12-28 21:40:10 +03:00
|
|
|
endif
|
2014-06-20 02:02:21 +04:00
|
|
|
|
2016-03-08 06:38:49 +03:00
|
|
|
agent-install-script-linux:
|
2017-09-14 00:02:07 +03:00
|
|
|
echo '#!/bin/sh' > tmp/agent_install.sh
|
2016-03-08 06:38:49 +03:00
|
|
|
echo 'chmod 500 /sbin/mig-agent-$(BUILDREV)' >> tmp/agent_install.sh
|
|
|
|
echo 'chown root:root /sbin/mig-agent-$(BUILDREV)' >> tmp/agent_install.sh
|
|
|
|
echo 'rm /sbin/mig-agent; ln -s /sbin/mig-agent-$(BUILDREV) /sbin/mig-agent' >> tmp/agent_install.sh
|
2014-07-31 01:08:48 +04:00
|
|
|
chmod 0755 tmp/agent_install.sh
|
|
|
|
|
2016-03-08 06:38:49 +03:00
|
|
|
agent-install-script-osx:
|
2017-09-14 00:02:07 +03:00
|
|
|
echo '#!/bin/sh' > tmp/agent_install.sh
|
|
|
|
echo 'chmod 500 /usr/local/bin/mig-agent-$(BUILDREV)' >> tmp/agent_install.sh
|
|
|
|
echo 'chown root:root /usr/local/bin/mig-agent-$(BUILDREV)' >> tmp/agent_install.sh
|
|
|
|
echo 'rm /usr/local/bin/mig-agent; ln -s /usr/local/bin/mig-agent-$(BUILDREV)' \
|
|
|
|
'/usr/local/bin/mig-agent' >> tmp/agent_install.sh
|
2016-03-08 06:38:49 +03:00
|
|
|
chmod 0755 tmp/agent_install.sh
|
|
|
|
|
|
|
|
agent-remove-script-linux:
|
2017-09-14 00:02:07 +03:00
|
|
|
echo '#!/bin/sh' > tmp/agent_remove.sh
|
|
|
|
echo 'for f in "/etc/cron.d/mig-agent" "/etc/init/mig-agent.conf"' \
|
|
|
|
'"/etc/init.d/mig-agent" "/etc/systemd/system/mig-agent.service"; do' >> tmp/agent_remove.sh
|
|
|
|
echo ' [ -e "$$f" ] && rm -f "$$f"' >> tmp/agent_remove.sh
|
|
|
|
echo 'done' >> tmp/agent_remove.sh
|
|
|
|
echo 'echo mig-agent removed but not killed if running' >> tmp/agent_remove.sh
|
2014-12-26 22:44:18 +03:00
|
|
|
chmod 0755 tmp/agent_remove.sh
|
|
|
|
|
2014-12-28 21:40:10 +03:00
|
|
|
msi-agent: mig-agent
|
|
|
|
ifneq ($(OS),windows)
|
2017-09-14 00:02:07 +03:00
|
|
|
echo 'Set OS=windows on the make command line to compile an MSI package'
|
2014-12-28 21:40:10 +03:00
|
|
|
else
|
|
|
|
rm -fr tmp
|
|
|
|
mkdir 'tmp'
|
|
|
|
$(INSTALL) -m 0755 $(BINDIR)/mig-agent-$(BUILDREV).exe tmp/mig-agent-$(BUILDREV).exe
|
|
|
|
cp conf/$(MSICONF) tmp/
|
|
|
|
sed -i "s/REPLACE_WITH_MIG_AGENT_VERSION/$(BUILDREV)/" tmp/$(MSICONF)
|
2017-09-14 00:02:07 +03:00
|
|
|
wixl tmp/$(MSICONF)
|
2014-12-28 21:40:10 +03:00
|
|
|
cp tmp/mig-agent-installer.msi mig-agent-$(BUILDREV).msi
|
|
|
|
endif
|
|
|
|
|
2017-07-25 21:46:01 +03:00
|
|
|
deb-server: mig-scheduler mig-api mig-runner
|
2014-01-31 05:03:49 +04:00
|
|
|
rm -rf tmp
|
2015-05-14 17:21:43 +03:00
|
|
|
$(INSTALL) -D -m 0755 $(BINDIR)/mig-scheduler tmp/opt/mig/bin/mig-scheduler
|
|
|
|
$(INSTALL) -D -m 0755 $(BINDIR)/mig-api tmp/opt/mig/bin/mig-api
|
2015-09-24 15:42:49 +03:00
|
|
|
$(INSTALL) -D -m 0755 $(BINDIR)/mig-runner tmp/opt/mig/bin/mig-runner
|
2015-05-14 17:21:43 +03:00
|
|
|
$(INSTALL) -D -m 0640 conf/scheduler.cfg.inc tmp/etc/mig/scheduler.cfg
|
|
|
|
$(INSTALL) -D -m 0640 conf/api.cfg.inc tmp/etc/mig/api.cfg
|
2017-09-14 00:02:07 +03:00
|
|
|
mkdir -p tmp/var/cache/mig
|
2015-05-14 17:21:43 +03:00
|
|
|
fpm -C tmp -n mig-server --license GPL --vendor mozilla --description "Mozilla InvestiGator Server" \
|
2017-09-14 00:02:07 +03:00
|
|
|
-m "Mozilla <noreply@mozilla.com>" --url http://mig.mozilla.org \
|
|
|
|
--architecture $(FPMARCH) -v $(BUILDREV) -s dir -t deb .
|
2016-02-15 22:22:51 +03:00
|
|
|
|
2016-10-29 00:05:08 +03:00
|
|
|
osx-loader-pkg: mig-loader
|
|
|
|
ifneq ($(OSXPACKSIGID),)
|
|
|
|
$(eval SIGNFLAGS:=--sign "$(OSXPACKSIGID)")
|
|
|
|
endif
|
2016-02-16 07:52:23 +03:00
|
|
|
tmpdir=$$(mktemp -d) && \
|
2016-10-29 00:05:08 +03:00
|
|
|
scriptstmp=$$(mktemp -d) && \
|
|
|
|
echo $$signflags && \
|
|
|
|
$(INSTALL) -m 0755 -d $${tmpdir}/usr/local/bin && \
|
|
|
|
$(INSTALL) -m 0750 -d $${tmpdir}/etc/mig && \
|
|
|
|
$(INSTALL) -m 0755 -d $${tmpdir}/Library/LaunchAgents && \
|
|
|
|
$(INSTALL) -m 0755 $(BINDIR)/mig-loader $${tmpdir}/usr/local/bin/mig-loader && \
|
|
|
|
$(INSTALL) -m 0755 tools/osx-loader-pkg-postinstall.sh $${scriptstmp}/postinstall && \
|
|
|
|
pkgbuild --root $${tmpdir} --identifier org.mozilla.mig-loader --version $(BUILDREV) \
|
|
|
|
--ownership recommended --scripts $${scriptstmp} \
|
|
|
|
$(SIGNFLAGS) \
|
|
|
|
./mig-loader-$(BUILDREV)-darwin-$(ARCH).pkg && \
|
|
|
|
rm -rf $${tmpdir} && \
|
|
|
|
rm -rf $${scriptstmp}
|
2016-02-15 22:22:51 +03:00
|
|
|
|
2015-01-13 18:11:00 +03:00
|
|
|
doc:
|
|
|
|
make -C doc doc
|
|
|
|
|
2015-08-26 00:54:52 +03:00
|
|
|
test: test-modules
|
2018-07-11 20:14:54 +03:00
|
|
|
$(GO) test github.com/mozilla/mig/mig-agent/...
|
|
|
|
$(GO) test github.com/mozilla/mig/mig-scheduler/...
|
|
|
|
$(GO) test github.com/mozilla/mig/mig-api/...
|
|
|
|
$(GO) test github.com/mozilla/mig/mig-runner/...
|
|
|
|
$(GO) test github.com/mozilla/mig/mig-loader/...
|
|
|
|
$(GO) test github.com/mozilla/mig/client/...
|
|
|
|
$(GO) test github.com/mozilla/mig/database/...
|
|
|
|
$(GO) test github.com/mozilla/mig
|
2014-01-28 01:21:47 +04:00
|
|
|
|
2015-05-08 00:21:43 +03:00
|
|
|
test-modules:
|
2018-07-11 20:14:54 +03:00
|
|
|
$(GO) test github.com/mozilla/mig/modules/
|
|
|
|
$(GO) test github.com/mozilla/mig/modules/agentdestroy
|
|
|
|
$(GO) test github.com/mozilla/mig/modules/example
|
|
|
|
$(GO) test github.com/mozilla/mig/modules/examplepersist
|
|
|
|
$(GO) test github.com/mozilla/mig/modules/file
|
|
|
|
$(GO) test github.com/mozilla/mig/modules/fswatch
|
|
|
|
$(GO) test github.com/mozilla/mig/modules/dispatch
|
|
|
|
$(GO) test github.com/mozilla/mig/modules/audit
|
|
|
|
$(GO) test github.com/mozilla/mig/modules/memory
|
|
|
|
$(GO) test github.com/mozilla/mig/modules/netstat
|
|
|
|
$(GO) test github.com/mozilla/mig/modules/ping
|
|
|
|
$(GO) test github.com/mozilla/mig/modules/pkg
|
|
|
|
$(GO) test github.com/mozilla/mig/modules/scribe
|
|
|
|
$(GO) test github.com/mozilla/mig/modules/timedrift
|
|
|
|
$(GO) test github.com/mozilla/mig/modules/sshkey
|
2017-03-29 18:19:02 +03:00
|
|
|
ifeq ($(WITHYARA),yes)
|
2018-07-11 20:14:54 +03:00
|
|
|
$(GO) test github.com/mozilla/mig/modules/yara
|
2017-03-29 18:19:02 +03:00
|
|
|
endif
|
|
|
|
|
2015-05-07 23:14:15 +03:00
|
|
|
vet:
|
2018-07-11 20:14:54 +03:00
|
|
|
$(GO) vet github.com/mozilla/mig/mig-agent/...
|
|
|
|
$(GO) vet github.com/mozilla/mig/mig-scheduler/...
|
|
|
|
$(GO) vet github.com/mozilla/mig/mig-api/...
|
|
|
|
$(GO) vet github.com/mozilla/mig/mig-runner/...
|
|
|
|
$(GO) vet github.com/mozilla/mig/client/...
|
|
|
|
$(GO) vet github.com/mozilla/mig/modules/...
|
|
|
|
$(GO) vet github.com/mozilla/mig/database/...
|
|
|
|
$(GO) vet github.com/mozilla/mig
|
2015-05-07 23:14:15 +03:00
|
|
|
|
2017-11-07 01:05:44 +03:00
|
|
|
clean:
|
2014-08-28 22:30:48 +04:00
|
|
|
rm -rf bin
|
|
|
|
rm -rf tmp
|
2016-12-22 19:18:14 +03:00
|
|
|
|
2017-09-14 00:02:07 +03:00
|
|
|
.PHONY: doc
|