Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
language: python

sudo: required

services:
- docker

before_install:
- docker pull centos:6
- docker pull debian:6

script:
# rpm build
- >
docker run -v $(pwd):/var/tmp centos:6 bash -c
"cd /var/tmp &&
yum install -y tar make rpm-build python2-devel python-setuptools &&
make rpm && rpm -i mamonsu*.rpm &&
/etc/init.d/mamonsu restart"
# deb build
- >
docker run -v $(pwd):/var/tmp debian:6 bash -c
"cd /var/tmp && apt-get update &&
echo package mamonsu/zabbix_server string '127.0.0.1' | debconf-set-selections &&
echo package mamonsu/zabbix_client string '127.0.0.1' | debconf-set-selections &&
echo package mamonsu/postgres_user string 'postgres' | debconf-set-selections &&
echo package mamonsu/postgres_password string 'postgres' | debconf-set-selections &&
echo package mamonsu/postgres_database string 'postgres' | debconf-set-selections &&
echo package mamonsu/postgres_host string '127.0.0.1' | debconf-set-selections &&
echo package mamonsu/postgres_port string '5432' | debconf-set-selections &&
echo package mamonsu/postgres_query_timeout string '10' | debconf-set-selections &&
echo package mamonsu/log_level string 'INFO' | debconf-set-selections &&
apt-get install -y make dpkg-dev debhelper python-dev python-setuptools &&
make deb && dpkg -i mamonsu*.deb &&
/etc/init.d/mamonsu restart"
39 changes: 10 additions & 29 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
VERSION=$(shell python -c 'import mamonsu; print(mamonsu.__version__)')
BUILDDIR=$(CURDIR)/build/mamonsu-$(VERSION)

all:
@echo Install
Expand All @@ -11,29 +12,29 @@ publish: clean
python setup.py sdist upload
@echo

prepare_build_dir: clean
prepare_builddir: clean
@echo Prepare build directory
mkdir build
tar --transform='s,^\.,mamonsu-$(VERSION),'\
-czf build/mamonsu-$(VERSION).tar.gz .\
--exclude=build
tar xvf build/mamonsu-$(VERSION).tar.gz -C build
cp build/mamonsu-$(VERSION).tar.gz \
build/mamonsu-$(VERSION)/rpm/SOURCES
$(BUILDDIR)/rpm/SOURCES
chown -R root.root $(BUILDDIR)
@echo

deb: prepare_build_dir
deb: prepare_builddir
@echo Build deb
cd build/mamonsu-$(VERSION) && dpkg-buildpackage -b
cd $(BUILDDIR) && dpkg-buildpackage -b
cp -av build/mamonsu*.deb .
@echo

rpm: prepare_build_dir
rpm: prepare_builddir
@echo Build rpm
chown -R root.root build/mamonsu-$(VERSION)
rpmbuild -ba --define '_topdir $(CURDIR)/build/mamonsu-$(VERSION)/rpm'\
$(CURDIR)/build/mamonsu-$(VERSION)/rpm/SPECS/mamonsu.spec
cp -av $(CURDIR)/build/mamonsu-$(VERSION)/rpm/RPMS/noarch/mamonsu*.rpm .
rpmbuild -ba --define '_topdir $(BUILDDIR)/rpm'\
$(BUILDDIR)/rpm/SPECS/mamonsu.spec
cp -av $(BUILDDIR)/rpm/RPMS/noarch/mamonsu*.rpm .
@echo

clean: python_clean
Expand All @@ -44,23 +45,3 @@ python_clean:
rm -rf *.egg dist build .coverage
find . -name '__pycache__' -delete -print -o -name '*.pyc' -delete -print
@echo

deb_clean:
@echo Cleaning up deb fragments
rm -rf debian/mamonsu
rm -rf mamonsu.egg-info
rm -f build-stamp
rm -f configure-stamp
rm -f debian/files
rm -f debian/mamonsu.debhelper.log
rm -f debian/mamonsu.postinst.debhelper
rm -f debian/mamonsu.postrm.debhelper
rm -f debian/mamonsu.prerm.debhelper
rm -f debian/mamonsu.substvars
@echo

rpm_clean:
@echo Cleaning up rpm fragments
rm -rf rpmbuild
find . -name 'rpm-tmp.*' -delete -print
@echo
22 changes: 11 additions & 11 deletions debian/config
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ CONFIGFILE=/etc/mamonsu/agent.conf

db_version 2.0
db_capb
db_title Configure mamonsu agent

HOSTNAME=$(hostname -f || 'locahost')

Expand All @@ -19,16 +20,15 @@ db_set mamonsu/postgres_port "5432"
db_set mamonsu/postgres_query_timeout "10"
db_set mamonsu/log_level "INFO"

db_title Configure mamonsu agent
db_input high mamonsu/zabbix_server
db_input high mamonsu/zabbix_client
db_input high mamonsu/postgres_user
db_input high mamonsu/postgres_password
db_input high mamonsu/postgres_database
db_input high mamonsu/postgres_host
db_input high mamonsu/postgres_port
db_input high mamonsu/postgres_query_timeout
db_input high mamonsu/log_level
db_input high mamonsu/zabbix_server || true
db_input high mamonsu/zabbix_client || true
db_input high mamonsu/postgres_user || true
db_input high mamonsu/postgres_password || true
db_input high mamonsu/postgres_database || true
db_input high mamonsu/postgres_host || true
db_input high mamonsu/postgres_port || true
db_input high mamonsu/postgres_query_timeout || true
db_input high mamonsu/log_level || true

db_go
db_go || true

1 change: 0 additions & 1 deletion debian/postinst
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ if [ "$1" = "configure" ]; then
addgroup --system --quiet mamonsu
fi
if ! getent passwd mamonsu > /dev/null 2>&1 ; then
# Not yet. Create it.
adduser --quiet \
--system --disabled-login --ingroup mamonsu \
--home /var/run/mamonsu/ --no-create-home \
Expand Down