More work on getting packaging working
This commit is contained in:
parent
a21a4355e5
commit
292c6bfd80
16
Makefile
16
Makefile
@ -1,13 +1,15 @@
|
||||
PACKAGE_NAME := pgmon
|
||||
VERSION := 1.0
|
||||
|
||||
BUILD_DIR := build
|
||||
|
||||
DEB_IMAGE := debian-package-builder
|
||||
RPM_IMAGE := rpm-package-builder
|
||||
|
||||
SCRIPT := src/$(PACKAGE_NAME).py
|
||||
|
||||
# Top-level targets
|
||||
.PHONY: all clean deb rpm
|
||||
.PHONY: all clean deb rpm test
|
||||
|
||||
all: deb rpm
|
||||
|
||||
@ -28,6 +30,8 @@ rpm:
|
||||
clean:
|
||||
rm -rf $(BUILD_DIR)
|
||||
|
||||
test:
|
||||
cd src ; python3 -m unittest
|
||||
|
||||
# Container targets
|
||||
.PHONY: docker deb-package-image rpm-package-image
|
||||
@ -56,22 +60,22 @@ package-rpm:
|
||||
cp RPM/$(PACKAGE_NAME).spec /output/SPECS/
|
||||
rpmbuild --define '_topdir /output' \
|
||||
--define 'version $(VERSION)' \
|
||||
-ba /output/SPECS/$(PACKAGE_NAME).spec
|
||||
cp /output/rpm/RPMS/x86_64/*.rpm /output/
|
||||
-bb /output/SPECS/$(PACKAGE_NAME).spec
|
||||
cp /output/RPMS/x86_64/*.rpm /output/
|
||||
|
||||
# Install into the specified destination directory (used inside the packaging systems)
|
||||
.PHONY: install
|
||||
|
||||
install:
|
||||
# Set up directories
|
||||
mkdir -p $(DESTDIR)/usr/bin
|
||||
mkdir -p $(DESTDIR)/usr/local/bin
|
||||
mkdir -p $(DESTDIR)/usr/share/man/man1
|
||||
mkdir -p $(DESTDIR)/etc/$(PACKAGE_NAME)
|
||||
mkdir -p $(DESTDIR)/lib/systemd/system
|
||||
|
||||
# Install script
|
||||
cp script.py $(DESTDIR)/usr/bin/$(PACKAGE_NAME)
|
||||
chmod 755 $(DESTDIR)/usr/bin/$(PACKAGE_NAME)
|
||||
cp $(SCRIPT) $(DESTDIR)/usr/local/bin/$(PACKAGE_NAME)
|
||||
chmod 755 $(DESTDIR)/usr/local/bin/$(PACKAGE_NAME)
|
||||
|
||||
# Install manpage
|
||||
cp manpages/* $(DESTDIR)/usr/share/man/man1/
|
||||
|
||||
@ -13,8 +13,10 @@ Requires: python3, python3-psycopg2, systemd
|
||||
A bridge to sit between monitoring tools and PostgreSQL
|
||||
|
||||
%prep
|
||||
# Do nothing since we don't need a tarball
|
||||
|
||||
%build
|
||||
# Do nothing since we have nothing to build
|
||||
|
||||
%install
|
||||
make -C /src install DESTDIR=%{buildroot}
|
||||
|
||||
0
manpages/pgmon.1
Normal file
0
manpages/pgmon.1
Normal file
14
systemd/pgmon.service
Normal file
14
systemd/pgmon.service
Normal file
@ -0,0 +1,14 @@
|
||||
# This is a meta unit modeled after the PostgreSQL unit file from the Debian
|
||||
# packages.
|
||||
|
||||
[Unit]
|
||||
Description=PostgreSQL monitoring bridge
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/bin/true
|
||||
ExecReload=/bin/true
|
||||
RemainAfterExit=on
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@ -1,11 +1,11 @@
|
||||
[unit]
|
||||
Description=PostgreSQL Monitoring Bridge
|
||||
#PartOf=pgmon.service
|
||||
#Before=pgmon.service
|
||||
PartOf=pgmon.service
|
||||
Before=pgmon.service
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/local/bin/pgmon.py /etc/pgmon/%i.cfg
|
||||
ExecStart=/usr/local/bin/pgmon /etc/pgmon/%i.yml
|
||||
ExecReload=kill -HUP $MAINPID
|
||||
Restart=on-failure
|
||||
Type=exec
|
||||
|
||||
Loading…
Reference in New Issue
Block a user