From 78c943892ed526ea4ce6cd068bf551f08cbb1151 Mon Sep 17 00:00:00 2001 From: Ralph Ronnquist Date: Mon, 10 Jan 2022 16:12:36 +1100 Subject: [PATCH] building deb package --- Makefile | 42 +++++++++++++++++++++++++++++++++++++----- debian/changelog | 5 +++++ debian/control | 26 ++++++++++++++++++++++++++ debian/copyright | 19 +++++++++++++++++++ debian/rules | 26 ++++++++++++++++++++++++++ debian/source/format | 1 + sitetool/Makefile | 3 +++ 7 files changed, 117 insertions(+), 5 deletions(-) create mode 100644 debian/changelog create mode 100644 debian/control create mode 100644 debian/copyright create mode 100755 debian/rules create mode 100644 debian/source/format diff --git a/Makefile b/Makefile index 1d27cfa..e320708 100644 --- a/Makefile +++ b/Makefile @@ -2,11 +2,13 @@ MAIN = command.lsp LSP = $(filter-out $(MAIN),$(wildcard *.lsp)) BIN = hourglass hourglass-web hourglass-site DOCS = hourglass-guide.html hourglass-guide.pdf +MANPGS = hourglass.8 IMGS = $(wildcard *.png) OTHER = setup.sh hourglass.conf VERSION = 0.1 +GENERATED = $(BIN) $(DOCS) $(MANPGS) -dist: hourglass-$(VERSION).tgz +default: dist hourglass: $(MAIN) $(LSP) packnl -w $@ $^ @@ -19,15 +21,45 @@ hourglass-site: sitetool $(MAKE) -C sitetool mv sitetool/sitetool $@ -hourglass-$(VERSION).tgz: $(BIN) $(OTHER) $(DOCS) $(IMGS) - tar czf $@ $^ - %.html: %.adoc asciidoctor $< > $@ %.pdf: %.adoc | $(IMGS) asciidoctor-pdf $< > $@ +%.8: %.8.adoc + a2x -d manpage -f manpage $^ + +############################################################ clean: $(MAKE) -C manager clean - rm -f $(BIN) hourglass-$(VERSION).tgz + $(MAKE) -C sitetool clean + rm -f $(GENERATED) + +############################################################ +hourglass-$(VERSION).tgz: $(BIN) $(OTHER) $(DOCS) $(MANPGS) $(IMGS) + tar czf $@ $^ + +dist: hourglass-$(VERSION).tgz + +######################################################## +BINDIR = $(DESTDIR)/usr/local/bin +MANDIR = $(DESTDIR)/usr/local/man/man8 +RUNDIR = $(DESTDIR)/var/lib/hourglass +DOCDIR = $(DESTDIR)/usr/share/hourglass + +INSTALLTARGETS = $(addprefix $(BINDIR)/,$(BIN)) +INSTALLTARGETS += $(addprefix $(MANDIR)/,$(MANPGS)) +INSTALLTARGETS += $(addprefix $(DOCDIR)/,$(DOCS)) +INSTALLTARGETS += $(addprefix $(RUNDIR)/,$(OTHER)) + + +$(BINDIR)/% $(MANDIR)/% $(RUNDIR)/% $(DOCDIR)/%: % + install -D -T $< $@ + +install: $(INSTALLTARGETS) + +BUILDPACKAGE = -us -uc --build=full + +deb: + PREFIX= INCLUDE_PREFIX=/usr dpkg-buildpackage $(BUILDPACKAGE) diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..966cc3a --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +hourglass (0.1) unstable; urgency=medium + + * Initial release + + -- Ralph Ronnquist Mon, 10 Jan 2022 14:41:16 +1100 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..17e3790 --- /dev/null +++ b/debian/control @@ -0,0 +1,26 @@ +Source: hourglass +Section: unknown +Priority: optional +Maintainer: Ralph Ronnquist +Build-Depends: debhelper-compat (= 13) +Standards-Version: 4.5.1 +Homepage: https://borta.rrq.id.au/git?p=ralph/hourglass.git +Vcs-Browser: https://borta.rrq.id.au/git?p=ralph/hourglass.git +Vcs-Git: https://borta.rrq.id.au/git?p=ralph/hourglass.git +Rules-Requires-Root: no + +Package: hourglass +Architecture: amd64 +Depends: ${shlibs:Depends}, ${misc:Depends}, newlisp, iptables, ipset +Description: Automated Network Access Control System + This is a collection of programs (scripts) that implement an + automated network access control policy, aptly named "Hourglass". The + general idea is to have the network open or closed on weekly policy + schedule, with an easy-to-use interface for adhoc adjustments. + . + The Hourglass policy setting includes open and close times separately + for each weekday, as well as limits of the accumulated usage during + the open times. For example, one could set up Hourglass to have the + network open between 11am and 4pm each day, closed otherwise and each + day allow for 2 hours of usage. The following is a snapshot of the + operator web view of the policy. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..26cfb50 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,19 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: hourglass +Source: https://borta.rrq.id.au/git?p=ralph/hourglass.git + +Files: * +Copyright: 2022, Ralph Ronnquist +License: GPL-2 + This package is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License. It is + distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. + . + See the GNU General Public License for more details. You should have + received a copy of the GNU General Public License along with this + program. If not, see . On Debian + systems, the complete text of the GNU General Public License version + 2 can be found in "/usr/share/common-licenses/GPL-2". diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..d4e2cb1 --- /dev/null +++ b/debian/rules @@ -0,0 +1,26 @@ +#!/usr/bin/make -f +# See debhelper(7) (uncomment to enable) +# output every command that modifies files on the build system. +#export DH_VERBOSE = 1 + +# see FEATURE AREAS in dpkg-buildflags(1) +#export DEB_BUILD_MAINT_OPTIONS = hardening=+all + +# see ENVIRONMENT in dpkg-buildflags(1) +# package maintainers to append CFLAGS +#export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic +# package maintainers to append LDFLAGS +#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed + +%: + dh $@ + +# dh_make generated override targets +# This is example for Cmake (See https://bugs.debian.org/641051 ) +#override_dh_auto_configure: +# dh_auto_configure -- \ +# -DCMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH) + +override_dh_usrlocal: + #mkdir -p usr/local/bin + dh $@ diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..89ae9db --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (native) diff --git a/sitetool/Makefile b/sitetool/Makefile index aac1ea4..1e7ee7e 100644 --- a/sitetool/Makefile +++ b/sitetool/Makefile @@ -7,3 +7,6 @@ default: sitetool sitetool: $(MAIN) $(LSP) $(TCL) $(OTHER) packnl -w $@ $^ + +clean: + rm -f sitetool -- 2.39.2