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 $@ $^
$(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)
--- /dev/null
+hourglass (0.1) unstable; urgency=medium
+
+ * Initial release
+
+ -- Ralph Ronnquist <ralph.ronnquist@gmail.com> Mon, 10 Jan 2022 14:41:16 +1100
--- /dev/null
+Source: hourglass
+Section: unknown
+Priority: optional
+Maintainer: Ralph Ronnquist <ralph.ronnquist@gmail.com>
+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.
--- /dev/null
+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 <ralph.ronnquist@gmail.com>
+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 <https://www.gnu.org/licenses/>. On Debian
+ systems, the complete text of the GNU General Public License version
+ 2 can be found in "/usr/share/common-licenses/GPL-2".
--- /dev/null
+#!/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 $@
--- /dev/null
+3.0 (native)
sitetool: $(MAIN) $(LSP) $(TCL) $(OTHER)
packnl -w $@ $^
+
+clean:
+ rm -f sitetool