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/.
2014-06-12 01:19:52 +04:00
BUILDENV := dev
2015-09-24 18:27:39 +03:00
BUILDREL := 0
2014-12-28 21:40:10 +03:00
i f e q ( $( OS ) , w i n d o w s )
2015-09-24 18:27:39 +03:00
# on windows, the version is year.month.date.release
BUILDREV := $( shell date +%y) .$( shell date +%m) .$( shell date +%d) .$( BUILDREL)
2014-12-28 21:40:10 +03:00
BINSUFFIX := ".exe"
e l s e
2015-09-24 18:27:39 +03:00
# on *nix, the version is yearmonthdate.release+lastcommit.env
BUILDREV := $( shell date +%Y%m%d) -$( BUILDREL) .$( shell git log --pretty= format:'%h' -n 1) .$( BUILDENV)
2014-12-28 21:40:10 +03:00
BINSUFFIX := ""
e n d i f
2014-01-28 01:21:47 +04:00
2014-07-30 21:09:43 +04:00
# Supported OSes: linux darwin windows
2014-01-28 01:21:47 +04:00
# Supported ARCHes: 386 amd64
2014-12-28 21:40:10 +03:00
OS := $( shell uname -s| tr '[:upper:]' '[:lower:]' )
2014-01-28 01:21:47 +04:00
ARCH := amd64
2014-06-16 23:50:09 +04:00
i f e q ( $( ARCH ) , a m d 6 4 )
FPMARCH := x86_64
e n d i f
i f e q ( $( ARCH ) , 3 8 6 )
2014-08-21 17:10:59 +04:00
FPMARCH := i386
2014-06-16 23:50:09 +04:00
e n d i f
2014-12-28 21:40:10 +03:00
2014-01-28 01:21:47 +04:00
PREFIX := /usr/local/
DESTDIR := /
BINDIR := bin/$( OS) /$( ARCH)
2015-03-16 17:49:50 +03:00
AGTCONF := conf/mig-agent-conf.go.inc
2016-02-04 21:30:23 +03:00
LOADERCONF := conf/mig-loader-conf.go.inc
2014-12-28 21:40:10 +03:00
MSICONF := mig-agent-installer.wxs
2016-03-23 22:36:36 +03:00
SIGNFLAGS :=
2014-01-28 01:21:47 +04:00
2014-06-12 01:19:52 +04:00
GCC := gcc
2014-01-28 01:21:47 +04:00
CFLAGS :=
LDFLAGS :=
2015-05-11 19:41:02 +03:00
GOOPTS :=
2015-08-26 00:54:52 +03:00
GO := GOOS = $( OS) GOARCH = $( ARCH) GO15VENDOREXPERIMENT = 1 go
2015-08-23 18:13:17 +03:00
GOGETTER := GOPATH = $( shell pwd ) /.tmpdeps go get -d
2015-09-24 15:54:07 +03:00
GOLDFLAGS := -ldflags " -X mig.ninja/mig.Version= $( BUILDREV) "
2014-01-28 01:21:47 +04:00
GOCFLAGS :=
MKDIR := mkdir
INSTALL := install
2014-04-17 22:05:59 +04:00
2015-12-30 02:25:09 +03:00
all : test mig -agent mig -scheduler mig -api mig -cmd mig -console mig -runner mig -action -generator mig -action -verifier worker -agent -intel \
2015-07-31 00:36:02 +03:00
runner-compliance runner-scribe mig-loader
2014-01-28 01:21:47 +04:00
2015-08-26 18:58:15 +03:00
create-bindir :
$( MKDIR) -p $( BINDIR)
mig-agent : create -bindir
2014-04-25 20:53:41 +04:00
echo building mig-agent for $( OS) /$( ARCH)
2015-08-26 00:54:52 +03:00
if [ ! -r $( AGTCONF) ] ; then echo " $( AGTCONF) configuration file does not exist " ; exit 1; fi
# test if the agent configuration variable contains something different than the default value
# and if so, replace the link to the default configuration with the provided configuration
2015-08-26 18:58:15 +03:00
if [ $( AGTCONF) != "conf/mig-agent-conf.go.inc" ] ; then rm mig-agent/configuration.go; cp $( AGTCONF) mig-agent/configuration.go; fi
$( GO) build $( GOOPTS) -o $( BINDIR) /mig-agent-$( BUILDREV) $( BINSUFFIX) $( GOLDFLAGS) mig.ninja/mig/mig-agent
2014-08-13 20:25:30 +04:00
ln -fs " $$ (pwd)/ $( BINDIR) /mig-agent- $( BUILDREV) $( BINSUFFIX) " " $$ (pwd)/ $( BINDIR) /mig-agent-latest "
2014-07-30 21:09:43 +04:00
[ -x " $( BINDIR) /mig-agent- $( BUILDREV) $( BINSUFFIX) " ] && echo SUCCESS && exit 0
2015-08-26 18:58:15 +03:00
mig-scheduler : create -bindir
$( GO) build $( GOOPTS) -o $( BINDIR) /mig-scheduler $( GOLDFLAGS) mig.ninja/mig/mig-scheduler
2014-01-28 01:21:47 +04:00
2015-08-26 18:58:15 +03:00
mig-api : create -bindir
$( GO) build $( GOOPTS) -o $( BINDIR) /mig-api $( GOLDFLAGS) mig.ninja/mig/mig-api
2014-02-11 21:06:20 +04:00
2015-09-11 01:27:59 +03:00
mig-runner : create -bindir
$( GO) build $( GOOPTS) -o $( BINDIR) /mig-runner $( GOLDFLAGS) mig.ninja/mig/mig-runner
2015-08-26 18:58:15 +03:00
mig-action-generator : create -bindir
$( GO) build $( GOOPTS) -o $( BINDIR) /mig-action-generator $( GOLDFLAGS) mig.ninja/mig/client/mig-action-generator
2014-01-28 01:21:47 +04:00
2015-07-31 00:36:02 +03:00
mig-loader : create -bindir
2016-02-04 21:30:23 +03:00
if [ ! -r $( LOADERCONF) ] ; then echo " $( LOADERCONF) configuration file does not exist " ; exit 1; fi
# test if the loader configuration variable contains something different than the default value
2015-07-31 00:36:02 +03:00
# and if so, replace the link to the default configuration with the provided configuration
2016-02-04 21:30:23 +03:00
if [ $( LOADERCONF) != "conf/mig-loader-conf.go.inc" ] ; then rm mig-loader/configuration.go; cp $( LOADERCONF) mig-loader/configuration.go; fi
2015-07-31 00:36:02 +03:00
$( GO) build $( GOOPTS) -o $( BINDIR) /mig-loader $( GOLDFLAGS) mig.ninja/mig/mig-loader
2015-08-26 18:58:15 +03:00
mig-action-verifier : create -bindir
$( GO) build $( GOOPTS) -o $( BINDIR) /mig-action-verifier $( GOLDFLAGS) mig.ninja/mig/client/mig-action-verifier
2014-02-19 00:33:25 +04:00
2015-08-26 18:58:15 +03:00
mig-console : create -bindir
$( GO) build $( GOOPTS) -o $( BINDIR) /mig-console $( GOLDFLAGS) mig.ninja/mig/client/mig-console
2014-06-18 07:39:07 +04:00
2015-08-26 18:58:15 +03:00
mig-cmd : create -bindir
$( GO) build $( GOOPTS) -o $( BINDIR) /mig $( GOLDFLAGS) mig.ninja/mig/client/mig
2014-11-07 17:38:18 +03:00
2015-08-26 18:58:15 +03:00
mig-agent-search : create -bindir
$( GO) build $( GOOPTS) -o $( BINDIR) /mig-agent-search $( GOLDFLAGS) mig.ninja/mig/client/mig-agent-search
2015-08-26 00:54:52 +03:00
2015-08-26 18:58:15 +03:00
worker-agent-verif : create -bindir
$( GO) build $( GOOPTS) -o $( BINDIR) /mig-worker-agent-verif $( GOLDFLAGS) mig.ninja/mig/workers/mig-worker-agent-verif
2015-08-26 00:54:52 +03:00
2015-08-26 18:58:15 +03:00
worker-agent-intel : create -bindir
$( GO) build $( GOOPTS) -o $( BINDIR) /mig-worker-agent-intel $( GOLDFLAGS) mig.ninja/mig/workers/mig-worker-agent-intel
2015-08-26 00:54:52 +03:00
2015-12-29 22:11:01 +03:00
runner-compliance : create -bindir
$( GO) build $( GOOPTS) -o $( BINDIR) /runner-compliance $( GOLDFLAGS) mig.ninja/mig/runner-plugins/runner-compliance
2016-01-12 23:35:11 +03:00
runner-scribe : create -bindir
$( GO) build $( GOOPTS) -o $( BINDIR) /runner-scribe $( GOLDFLAGS) mig.ninja/mig/runner-plugins/runner-scribe
2015-08-23 18:13:17 +03:00
go_vendor_dependencies :
GOOS = "linux" $( GOGETTER) github.com/bobappleyard/readline
GOOS = "darwin" $( GOGETTER) github.com/bobappleyard/readline
GOOS = "windows" $( GOGETTER) github.com/golang/sys/windows/svc/eventlog
$( GOGETTER) github.com/gorilla/mux
$( GOGETTER) github.com/jvehent/cljs
$( GOGETTER) github.com/jvehent/gozdef
2014-12-22 05:45:31 +03:00
$( GOGETTER) github.com/jvehent/service-go
2015-08-23 18:13:17 +03:00
$( GOGETTER) github.com/kardianos/osext
$( GOGETTER) github.com/lib/pq
$( GOGETTER) github.com/mozilla/masche/listlibs
$( GOGETTER) github.com/mozilla/masche/memsearch
$( GOGETTER) github.com/mozilla/masche/process
2016-03-18 22:10:58 +03:00
$( GOGETTER) github.com/mozilla/scribe
$( GOGETTER) github.com/oschwald/geoip2-golang
2015-08-23 18:13:17 +03:00
$( GOGETTER) github.com/streadway/amqp
2015-09-11 01:27:59 +03:00
$( GOGETTER) github.com/gorhill/cronexpr
2015-08-23 18:13:17 +03:00
$( GOGETTER) golang.org/x/crypto/openpgp
$( GOGETTER) golang.org/x/crypto/sha3
2015-02-23 22:35:14 +03:00
$( GOGETTER) golang.org/x/net/icmp
$( GOGETTER) golang.org/x/net/ipv4
$( GOGETTER) golang.org/x/net/ipv6
2015-08-23 18:13:17 +03:00
$( GOGETTER) gopkg.in/gcfg.v1
2016-01-14 23:25:36 +03:00
$( GOGETTER) github.com/cheggaaa/pb
2015-08-26 00:54:52 +03:00
echo 'removing .git from vendored pkg and moving them to vendor'
2016-03-18 22:10:58 +03:00
find .tmpdeps/src -name ".git" ! -name ".gitignore" -exec rm -rf { } \; || exit 0
[ -d vendor ] && git rm -rf vendor/ || exit 0
mkdir vendor/ || exit 0
2015-08-26 00:54:52 +03:00
cp -ar .tmpdeps/src/* vendor/
2016-03-18 22:10:58 +03:00
git add vendor/
2015-08-23 18:13:17 +03:00
rm -rf .tmpdeps
2015-01-02 22:13:18 +03:00
2014-12-26 22:44:18 +03:00
rpm : rpm -agent rpm -scheduler
2014-01-31 05:03:49 +04:00
rpm-agent : mig -agent
# Bonus FPM options
# --rpm-digest sha512 --rpm-sign
rm -fr tmp
2014-12-26 22:49:42 +03:00
$( INSTALL) -D -m 0755 $( BINDIR) /mig-agent-$( BUILDREV) tmp/sbin/mig-agent-$( BUILDREV)
2014-12-29 21:22:55 +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
2014-12-29 21:22:55 +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
2016-03-03 19:02:48 +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 .
2014-12-29 22:06:08 +03:00
dmg-agent : mig -agent
2014-12-28 21:40:10 +03:00
i f n e q ( $( OS ) , d a r w i n )
2014-12-29 22:06:08 +03:00
echo 'you must be on MacOS and set OS=darwin on the make command line to build an OSX package'
2014-12-28 21:40:10 +03:00
e l s e
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)
2014-12-29 22:06:08 +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
e n d i f
2014-06-20 02:02:21 +04:00
2016-03-08 06:38:49 +03:00
agent-install-script-linux :
echo '#!/bin/sh' > tmp/agent_install.sh
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 :
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
chmod 0755 tmp/agent_install.sh
agent-remove-script-linux :
2014-12-28 02:33: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
2015-01-22 21:27:10 +03:00
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
i f n e q ( $( OS ) , w i n d o w s )
echo 'you must set OS=windows on the make command line to compile a MSI package'
e l s e
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)
wixl tmp/mig-agent-installer.wxs
cp tmp/mig-agent-installer.msi mig-agent-$( BUILDREV) .msi
e n d i f
2015-08-23 18:13:17 +03:00
package-linux-clients : rpm -clients deb -clients
2015-04-02 17:33:08 +03:00
2015-08-26 21:15:40 +03:00
prepare-clients-packaging : mig -cmd mig -console mig -action -generator mig -action -verifier mig -agent -search
2015-03-18 16:04:40 +03:00
rm -fr tmp
mkdir 'tmp'
$( INSTALL) -D -m 0755 $( BINDIR) /mig tmp/usr/local/bin/mig
$( INSTALL) -D -m 0755 $( BINDIR) /mig-console tmp/usr/local/bin/mig-console
$( INSTALL) -D -m 0755 $( BINDIR) /mig-action-generator tmp/usr/local/bin/mig-action-generator
2015-08-26 21:15:40 +03:00
$( INSTALL) -D -m 0755 $( BINDIR) /mig-action-verifier tmp/usr/local/bin/mig-action-verifier
$( INSTALL) -D -m 0755 $( BINDIR) /mig-agent-search tmp/usr/local/bin/mig-agent-search
rpm-clients : prepare -clients -packaging
# --rpm-sign requires installing package `rpm-sign` and configuring this macros in ~/.rpmmacros
# %_signature gpg
# %_gpg_name Julien Vehent
2015-03-18 16:04:40 +03:00
fpm -C tmp -n mig-clients --license GPL --vendor mozilla --description "Mozilla InvestiGator Clients" \
2016-04-06 00:55:33 +03:00
-m "Mozilla <noreply@mozilla.com>" --url http://mig.mozilla.org --architecture $( FPMARCH) -v $( BUILDREV) \
2015-03-18 16:04:40 +03:00
--rpm-digest sha512 --rpm-sign \
-s dir -t rpm .
2015-08-26 21:15:40 +03:00
deb-clients : prepare -clients -packaging
2015-03-18 16:04:40 +03:00
fpm -C tmp -n mig-clients --license GPL --vendor mozilla --description "Mozilla InvestiGator Clients" \
2016-04-06 00:55:33 +03:00
-m "Mozilla <noreply@mozilla.com>" --url http://mig.mozilla.org --architecture $( FPMARCH) -v $( BUILDREV) \
2015-03-18 16:04:40 +03:00
-s dir -t deb .
# require dpkg-sig, it's a perl script, take it from any debian box and copy it in your PATH
dpkg-sig -k E60892BB9BD89A69F759A1A0A3D652173B763E8F --sign jvehent -m "Julien Vehent" mig-clients_$( BUILDREV) _$( ARCH) .deb
2015-08-23 18:13:17 +03:00
dmg-clients : mig -cmd mig -console mig -action -generator
2015-03-18 16:04:40 +03:00
i f n e q ( $( OS ) , d a r w i n )
echo 'you must be on MacOS and set OS=darwin on the make command line to build an OSX package'
e l s e
rm -fr tmp tmpdmg
mkdir -p tmp/usr/local/bin tmpdmg
$( INSTALL) -m 0755 $( BINDIR) /mig tmp/usr/local/bin/mig
$( INSTALL) -m 0755 $( BINDIR) /mig-console tmp/usr/local/bin/mig-console
$( INSTALL) -m 0755 $( BINDIR) /mig-action-generator tmp/usr/local/bin/mig-action-generator
fpm -C tmp -n mig-clients --license GPL --vendor mozilla --description "Mozilla InvestiGator Clients" \
2016-04-06 00:55:33 +03:00
-m "Mozilla <noreply@mozilla.com>" --url http://mig.mozilla.org --architecture $( FPMARCH) -v $( BUILDREV) \
2015-03-18 16:04:40 +03:00
-s dir -t osxpkg --osxpkg-identifier-prefix org.mozilla.mig -p tmpdmg/mig-clients-$( BUILDREV) -$( FPMARCH) .pkg .
hdiutil makehybrid -hfs -hfs-volume-name "Mozilla InvestiGator Clients" \
-o ./mig-clients-$( BUILDREV) -$( FPMARCH) .dmg tmpdmg
e n d i f
2015-12-30 02:25:09 +03:00
deb-server : mig -scheduler mig -api mig -runner worker -agent -intel
2014-01-31 05:03:49 +04:00
rm -rf tmp
2015-05-14 17:21:43 +03:00
# add binaries
$( 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-09-08 22:42:51 +03:00
$( INSTALL) -D -m 0755 $( BINDIR) /mig-worker-agent-intel tmp/opt/mig/bin/mig-worker-agent-intel
2015-05-14 17:21:43 +03:00
$( INSTALL) -D -m 0755 tools/list_new_agents.sh tmp/opt/mig/bin/list_new_agents.sh
# add configuration templates
$( 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
$( INSTALL) -D -m 0640 conf/agent-intel-worker.cfg.inc tmp/etc/mig/agent-intel-worker.cfg
# add upstart configs
$( INSTALL) -D -m 0640 conf/upstart/mig-scheduler.conf tmp/etc/init/mig-scheduler.conf
$( INSTALL) -D -m 0640 conf/upstart/mig-api.conf tmp/etc/init/mig-api.conf
$( INSTALL) -D -m 0640 conf/upstart/mig-agent-intel-worker.conf tmp/etc/init/mig-agent-intel-worker.conf
2014-01-31 05:03:49 +04: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" \
2016-04-06 00:55:33 +03:00
-m "Mozilla <noreply@mozilla.com>" --url http://mig.mozilla.org --architecture $( FPMARCH) -v $( BUILDREV) -s dir -t deb .
2014-01-31 05:03:49 +04:00
2016-02-15 22:22:51 +03:00
install : install -server install -client
install-server :
$( INSTALL) -m 0755 $( BINDIR) /mig-scheduler $( PREFIX) /bin/mig-scheduler
$( INSTALL) -m 0755 $( BINDIR) /mig-api $( PREFIX) /bin/mig-api
$( INSTALL) -m 0755 $( BINDIR) /mig-runner $( PREFIX) /bin/mig-runner
$( INSTALL) -m 0755 $( BINDIR) /mig-worker-agent-intel $( PREFIX) /bin/mig-worker-agent-intel
install-client :
$( INSTALL) -m 0755 $( BINDIR) /mig $( PREFIX) /bin/mig
$( INSTALL) -m 0755 $( BINDIR) /mig-console $( PREFIX) /bin/mig-console
$( INSTALL) -m 0755 $( BINDIR) /mig-agent-search $( PREFIX) /bin/mig-agent-search
2016-02-16 07:52:23 +03:00
osx-loader-pkg :
tmpdir = $$ ( mktemp -d) && \
scriptstmp = $$ ( mktemp -d) && \
$( INSTALL) -m 0755 -d $$ { tmpdir} /usr/local/bin && \
$( INSTALL) -m 0750 -d $$ { tmpdir} /etc/mig && \
2016-02-16 09:07:57 +03:00
$( INSTALL) -m 0755 -d $$ { tmpdir} /Library/LaunchAgents && \
2016-02-16 07:52:23 +03:00
$( INSTALL) -m 0755 $( BINDIR) /mig-loader $$ { tmpdir} /usr/local/bin/mig-loader && \
touch $$ { tmpdir} /etc/mig/mig-loader.key && \
$( INSTALL) -m 0755 tools/osx-loader-pkg-postinstall.sh $$ { scriptstmp} /postinstall && \
pkgbuild --root $$ { tmpdir} --identifier org.mozilla.mig-loader --version $( BUILDREV) \
2016-03-23 22:36:36 +03:00
--ownership recommended --scripts $$ { scriptstmp} \
$( SIGNFLAGS) \
./mig-loader-$( BUILDREV) -darwin.pkg && \
2016-02-16 07:52:23 +03:00
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
2015-08-26 21:15:40 +03:00
$( GO) test mig.ninja/mig/mig-agent/...
$( GO) test mig.ninja/mig/mig-scheduler/...
$( GO) test mig.ninja/mig/mig-api/...
2015-09-24 15:42:49 +03:00
$( GO) test mig.ninja/mig/mig-runner/...
2015-07-31 00:36:02 +03:00
$( GO) test mig.ninja/mig/mig-loader/...
2015-08-26 00:54:52 +03:00
$( GO) test mig.ninja/mig/client/...
$( GO) test mig.ninja/mig/database/...
$( GO) test mig.ninja/mig/workers/...
$( GO) test mig.ninja/mig
2014-01-28 01:21:47 +04:00
2015-05-08 00:21:43 +03:00
test-modules :
2015-05-11 00:18:09 +03:00
# test all modules
2015-09-02 16:22:57 +03:00
$( GO) test mig.ninja/mig/modules/...
2015-05-08 21:34:32 +03:00
2014-08-18 19:30:34 +04:00
clean-agent :
2015-09-05 14:37:39 +03:00
if [ -d bin/ ] ; then \
find bin/ -name 'mig-agent*' -exec rm { } \; ; \
fi
2014-08-18 19:30:34 +04:00
rm -rf packages
rm -rf tmp
2015-05-07 23:14:15 +03:00
vet :
2015-09-24 15:42:49 +03:00
$( GO) vet mig.ninja/mig/mig-agent/...
$( GO) vet mig.ninja/mig/mig-scheduler/...
$( GO) vet mig.ninja/mig/mig-api/...
$( GO) vet mig.ninja/mig/mig-runner/...
2015-08-26 00:54:52 +03:00
$( GO) vet mig.ninja/mig/client/...
$( GO) vet mig.ninja/mig/modules/...
$( GO) vet mig.ninja/mig/database/...
$( GO) vet mig.ninja/mig/workers/...
$( GO) vet mig.ninja/mig
2015-05-07 23:14:15 +03:00
2014-08-28 22:30:48 +04:00
clean : clean -agent
rm -rf bin
rm -rf tmp
2015-08-26 00:54:52 +03:00
rm -rf .builddir
2014-08-28 22:30:48 +04:00
2015-08-23 18:13:17 +03:00
.PHONY : clean clean -agent doc agent -install -script agent -remove -script