From 939125335e718cdd7217f1a7326e444855fabf9d Mon Sep 17 00:00:00 2001 From: Frederic Guilbault <2@0464.ca> Date: Mon, 12 Oct 2020 17:07:36 -0400 Subject: [PATCH 1/8] Add files needed to make Debian package. --- debian/README | 0 debian/README.Debian | 46 ++++++++++++++++++++++++ debian/changelog | 6 ++++ debian/compat | 1 + debian/control | 16 +++++++++ debian/copyright | 22 ++++++++++++ debian/docs | 1 + debian/patches/fix-Makefile.patch | 59 +++++++++++++++++++++++++++++++ debian/patches/series | 1 + debian/postrm | 40 +++++++++++++++++++++ debian/source/format | 1 + 11 files changed, 193 insertions(+) create mode 100644 debian/README create mode 100644 debian/README.Debian create mode 100644 debian/changelog create mode 100644 debian/compat create mode 100644 debian/control create mode 100644 debian/copyright create mode 100644 debian/docs create mode 100644 debian/patches/fix-Makefile.patch create mode 100644 debian/patches/series create mode 100644 debian/postrm create mode 100644 debian/source/format diff --git a/debian/README b/debian/README new file mode 100644 index 0000000..e69de29 diff --git a/debian/README.Debian b/debian/README.Debian new file mode 100644 index 0000000..d4bff53 --- /dev/null +++ b/debian/README.Debian @@ -0,0 +1,46 @@ +kplex for Debian +---------------- + +This package installs an init script in /etc/init.d but does not set things up +to start kplex at boot time. To have kplex run at boot: +* Read the instructions on enabling kplex at boot time, paying particular heed + to recommendations to create a non-root user to run kplex as +* Create a configuration file for kplex and install it as /etc/kplex.conf +* Enable boot-time invocation of kplex with: + update-rc.d kplex defaults + + -- Keith Young Mon, 04 Mar 2013 11:18:17 +0000 + + + + + + +# How to Build kplex into a debian package +---------------- + First, make sure you have the required dependencies : + ``` + sudo apt-get install build-essential devscripts lintian + ``` + + To build a local package: + ``` + debuild -i -us -uc -b + ``` + + To build a signed source package (required by launchpad) + ``` + debuild -S + ``` + + # Known problems + + By default the Linter complain about: + `E: kplex changes: bad-distribution-in-changes-file unstable` + + Considering that kplex does not depend on any package. + If you build a local package this doesn't impact anything. + But it you plan to distribute via some kind of repository, the distribution version matter. + In that case you need to set the proper version code name in debian/changelog (search&replace for the word `unstable` ) + + -- Frederic Guilbault <2@0464.ca> Mon, 12 Oct 2020 00:00:00 +0000 diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..1b4ea3a --- /dev/null +++ b/debian/changelog @@ -0,0 +1,6 @@ +kplex (1.4-1) unstable; urgency=low + + * Initial release. Closes: #0010 + * Fixed Makefile for Debian + + -- Keith Young Sun, 06 Jan 2019 19:23:04 +0000 diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..f599e28 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +10 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..e2343de --- /dev/null +++ b/debian/control @@ -0,0 +1,16 @@ +Source: kplex +Section: net +Priority: optional +Maintainer: Keith Young +Uploaders: Frederic Guilbault <2@0464.ca>, Keith Young +Build-Depends: debhelper (>= 9) +Standards-Version: 4.5.0 +Homepage: http://www.stripydog.com/kplex + +Package: kplex +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: NMEA-0183 multiplexer for GNU/Linux + kplex combines, filters and prioritises NMEA-0183 data from various types of + inputs (serial, network, file, pseudo terminal) and sends it to various + outputs. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..9626a00 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,22 @@ +Format: http://dep.debian.net/deps/dep5 +Upstream-Name: kplex +Source: http://www/stripydog.com/kplex/ + +Files: debian/* +Copyright: 2012-2013 Keith Young +License: GPL-3 + 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 3 of the License, or + (at your option) any later version. + . + This package 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 3 can be found in "/usr/share/common-licenses/GPL-3". diff --git a/debian/docs b/debian/docs new file mode 100644 index 0000000..e845566 --- /dev/null +++ b/debian/docs @@ -0,0 +1 @@ +README diff --git a/debian/patches/fix-Makefile.patch b/debian/patches/fix-Makefile.patch new file mode 100644 index 0000000..726d510 --- /dev/null +++ b/debian/patches/fix-Makefile.patch @@ -0,0 +1,59 @@ +--- a/Makefile ++++ b/Makefile +@@ -1,25 +1,7 @@ +-OS=$(shell uname -s) +-ifneq ("$(wildcard .git)","") +-CFLAGS?=-g -Wall +-VERSION := $(shell git describe --dirty --tags | sed 's/^v//') +-CURR_VERSION := $(shell sed 's/^\#define VERSION "\(.*\)"$$/\1/' version.h 2>/dev/null) +-else +-BASE_VERSION := $(shell cat base_version) +-endif +-ifeq ($(OS),Linux) +-DESTDIR?=/usr +-LDLIBS?=-pthread -lutil +-INSTGROUP?=root +-else +-DESTDIR?=/usr/local +-MANDIR?=$(DESTDIR)/man +-INSTGROUP?=wheel +-ifneq ($(OS),Darwin) +-LDLIBS?=-lpthread -lutil +-endif +-endif +-BINDIR?=$(DESTDIR)/bin +-MANDIR?=$(DESTDIR)/share/man ++LDLIBS=-pthread -lutil ++BINDIR=$(DESTDIR)/usr/bin ++MANDIR=$(DESTDIR)/usr/share/man ++DOCDIR=$(DESTDIR)/usr/share/kplex + + objects=kplex.o fileio.o serial.o bcast.o tcp.o options.o error.o lookup.o mcast.o gofree.o udp.o + +@@ -33,17 +15,20 @@ + $(objects): kplex.h + kplex.o: kplex_mods.h version.h + +-version.h: +- @echo '#define VERSION "'$(BASE_VERSION)'"' > version.h +- + install: kplex +- test -d "$(BINDIR)" || install -d -g $(INSTGROUP) -o root -m 755 $(BINDIR) +- install -g $(INSTGROUP) -o root -m 755 kplex $(BINDIR)/kplex +- test -d $(MANDIR)/man1 && gzip -c kplex.1 > $(MANDIR)/man1/kplex.1.gz ++ install -D -g root -o root -m 755 kplex $(BINDIR)/kplex ++ install -D -g root -o root -m 755 kplex.init $(DESTDIR)/etc/init.d/kplex ++ install -D -g root -o root -m 644 kplex.conf.ex $(DESTDIR)/etc/kplex.conf ++ install -D -g root -o root -m 644 kplex.service $(DOCDIR)/kplex.service ++ install -D -g root -o root -m 755 -d $(MANDIR)/man1 ++ gzip -9 -c kplex.1 > $(MANDIR)/man1/kplex.1.gz + + uninstall: + -rm -f $(BINDIR)/kplex + -rm -f $(MANDIR)/man1/kplex.1.gz ++ -rm -f $(DESTDIR)/etc/init.d/kplex ++ -rm -f $(DESTDIR)/etc/kplex.conf ++ -rm -f $(DOCDIR) + + clean: + -rm -f kplex $(objects) diff --git a/debian/patches/series b/debian/patches/series new file mode 100644 index 0000000..f636147 --- /dev/null +++ b/debian/patches/series @@ -0,0 +1 @@ +fix-Makefile.patch diff --git a/debian/postrm b/debian/postrm new file mode 100644 index 0000000..6bf2b1b --- /dev/null +++ b/debian/postrm @@ -0,0 +1,40 @@ +#!/bin/sh +# postrm script for kplex +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `remove' +# * `purge' +# * `upgrade' +# * `failed-upgrade' +# * `abort-install' +# * `abort-install' +# * `abort-upgrade' +# * `disappear' +# +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + purge) + update-rc.d -f kplex remove + ;; + remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) + ;; + + *) + echo "postrm called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..163aaf8 --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) From ddbbd78a5fd02128d3d3f82eb01e9d31412773eb Mon Sep 17 00:00:00 2001 From: Frederic Guilbault <2@0464.ca> Date: Mon, 12 Oct 2020 17:20:47 -0400 Subject: [PATCH 2/8] Add missing rules file --- debian/rules | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100755 debian/rules diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..955dd78 --- /dev/null +++ b/debian/rules @@ -0,0 +1,13 @@ +#!/usr/bin/make -f +# -*- makefile -*- +# Sample debian/rules that uses debhelper. +# This file was originally written by Joey Hess and Craig Small. +# As a special exception, when this file is copied by dh-make into a +# dh-make output file, you may use that output file without restriction. +# This special exception was added by Craig Small in version 0.37 of dh-make. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +%: + dh $@ From 09f55cf4ebcd73a8f673e3a931286c75361858c4 Mon Sep 17 00:00:00 2001 From: Frederic Guilbault <2@0464.ca> Date: Mon, 12 Oct 2020 17:43:21 -0400 Subject: [PATCH 3/8] Force make install prefix. --- debian/rules | 3 +++ 1 file changed, 3 insertions(+) diff --git a/debian/rules b/debian/rules index 955dd78..a666e33 100755 --- a/debian/rules +++ b/debian/rules @@ -11,3 +11,6 @@ %: dh $@ + +override_dh_auto_install: + $(MAKE) DESTDIR=$$(pwd)/debian/kplex PREFIX=/usr install \ No newline at end of file From 16dd7bebfe90d54d4c11800a28046ab8556ac630 Mon Sep 17 00:00:00 2001 From: Frederic Guilbault <2@0464.ca> Date: Wed, 9 Dec 2020 14:24:58 -0500 Subject: [PATCH 4/8] Move the makefile patch to rules --- debian/patches/fix-Makefile.patch | 59 ------------------------------- debian/patches/series | 1 - debian/rules | 11 ++++-- 3 files changed, 8 insertions(+), 63 deletions(-) delete mode 100644 debian/patches/fix-Makefile.patch delete mode 100644 debian/patches/series diff --git a/debian/patches/fix-Makefile.patch b/debian/patches/fix-Makefile.patch deleted file mode 100644 index 726d510..0000000 --- a/debian/patches/fix-Makefile.patch +++ /dev/null @@ -1,59 +0,0 @@ ---- a/Makefile -+++ b/Makefile -@@ -1,25 +1,7 @@ --OS=$(shell uname -s) --ifneq ("$(wildcard .git)","") --CFLAGS?=-g -Wall --VERSION := $(shell git describe --dirty --tags | sed 's/^v//') --CURR_VERSION := $(shell sed 's/^\#define VERSION "\(.*\)"$$/\1/' version.h 2>/dev/null) --else --BASE_VERSION := $(shell cat base_version) --endif --ifeq ($(OS),Linux) --DESTDIR?=/usr --LDLIBS?=-pthread -lutil --INSTGROUP?=root --else --DESTDIR?=/usr/local --MANDIR?=$(DESTDIR)/man --INSTGROUP?=wheel --ifneq ($(OS),Darwin) --LDLIBS?=-lpthread -lutil --endif --endif --BINDIR?=$(DESTDIR)/bin --MANDIR?=$(DESTDIR)/share/man -+LDLIBS=-pthread -lutil -+BINDIR=$(DESTDIR)/usr/bin -+MANDIR=$(DESTDIR)/usr/share/man -+DOCDIR=$(DESTDIR)/usr/share/kplex - - objects=kplex.o fileio.o serial.o bcast.o tcp.o options.o error.o lookup.o mcast.o gofree.o udp.o - -@@ -33,17 +15,20 @@ - $(objects): kplex.h - kplex.o: kplex_mods.h version.h - --version.h: -- @echo '#define VERSION "'$(BASE_VERSION)'"' > version.h -- - install: kplex -- test -d "$(BINDIR)" || install -d -g $(INSTGROUP) -o root -m 755 $(BINDIR) -- install -g $(INSTGROUP) -o root -m 755 kplex $(BINDIR)/kplex -- test -d $(MANDIR)/man1 && gzip -c kplex.1 > $(MANDIR)/man1/kplex.1.gz -+ install -D -g root -o root -m 755 kplex $(BINDIR)/kplex -+ install -D -g root -o root -m 755 kplex.init $(DESTDIR)/etc/init.d/kplex -+ install -D -g root -o root -m 644 kplex.conf.ex $(DESTDIR)/etc/kplex.conf -+ install -D -g root -o root -m 644 kplex.service $(DOCDIR)/kplex.service -+ install -D -g root -o root -m 755 -d $(MANDIR)/man1 -+ gzip -9 -c kplex.1 > $(MANDIR)/man1/kplex.1.gz - - uninstall: - -rm -f $(BINDIR)/kplex - -rm -f $(MANDIR)/man1/kplex.1.gz -+ -rm -f $(DESTDIR)/etc/init.d/kplex -+ -rm -f $(DESTDIR)/etc/kplex.conf -+ -rm -f $(DOCDIR) - - clean: - -rm -f kplex $(objects) diff --git a/debian/patches/series b/debian/patches/series deleted file mode 100644 index f636147..0000000 --- a/debian/patches/series +++ /dev/null @@ -1 +0,0 @@ -fix-Makefile.patch diff --git a/debian/rules b/debian/rules index a666e33..bad5d1e 100755 --- a/debian/rules +++ b/debian/rules @@ -7,10 +7,15 @@ # This special exception was added by Craig Small in version 0.37 of dh-make. # Uncomment this to turn on verbose mode. -#export DH_VERBOSE=1 - +export DH_VERBOSE=1 %: dh $@ override_dh_auto_install: - $(MAKE) DESTDIR=$$(pwd)/debian/kplex PREFIX=/usr install \ No newline at end of file + $(MAKE) DESTDIR=$$(pwd)/debian/kplex PREFIX=/usr install + + install -d $$(pwd)/debian/kplex/lib/systemd/system/ + install -m 0644 kplex.service $$(pwd)/debian/kplex/lib/systemd/system/ + + install -d $$(pwd)/debian/kplex/etc/init.d/ + install -D -g root -o root -m 755 kplex.init $$(pwd)/debian/kplex/etc/init.d/ \ No newline at end of file From 2fd8b869ce960e109d93e2b2311036ae023ba762 Mon Sep 17 00:00:00 2001 From: Frederic Guilbault <2@0464.ca> Date: Wed, 9 Dec 2020 14:26:20 -0500 Subject: [PATCH 5/8] Change base distro to something compatible with launchpad. it's more likely for now that this package will endup in a PPA then official debian distribution. --- debian/changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 1b4ea3a..e89661e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -kplex (1.4-1) unstable; urgency=low +kplex (1.4-1) focal; urgency=low * Initial release. Closes: #0010 * Fixed Makefile for Debian From d4b8e3cdae9e521205ae7c118c3da56316469f1d Mon Sep 17 00:00:00 2001 From: Frederic Guilbault <2@0464.ca> Date: Wed, 9 Dec 2020 21:02:03 -0500 Subject: [PATCH 6/8] Install the init files conform with debian helper tools --- debian/postrm | 40 ---------------------------------------- debian/rules | 10 ++++++---- 2 files changed, 6 insertions(+), 44 deletions(-) delete mode 100644 debian/postrm diff --git a/debian/postrm b/debian/postrm deleted file mode 100644 index 6bf2b1b..0000000 --- a/debian/postrm +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/sh -# postrm script for kplex -# -# see: dh_installdeb(1) - -set -e - -# summary of how this script can be called: -# * `remove' -# * `purge' -# * `upgrade' -# * `failed-upgrade' -# * `abort-install' -# * `abort-install' -# * `abort-upgrade' -# * `disappear' -# -# for details, see http://www.debian.org/doc/debian-policy/ or -# the debian-policy package - - -case "$1" in - purge) - update-rc.d -f kplex remove - ;; - remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) - ;; - - *) - echo "postrm called with unknown argument \`$1'" >&2 - exit 1 - ;; -esac - -# dh_installdeb will replace this with shell code automatically -# generated by other debhelper scripts. - -#DEBHELPER# - -exit 0 diff --git a/debian/rules b/debian/rules index bad5d1e..d4d9feb 100755 --- a/debian/rules +++ b/debian/rules @@ -12,10 +12,12 @@ export DH_VERBOSE=1 dh $@ override_dh_auto_install: + install -m 0644 kplex.service $$(pwd)/debian/ + install -D -g root -o root -m 755 kplex.init $$(pwd)/debian $(MAKE) DESTDIR=$$(pwd)/debian/kplex PREFIX=/usr install - install -d $$(pwd)/debian/kplex/lib/systemd/system/ - install -m 0644 kplex.service $$(pwd)/debian/kplex/lib/systemd/system/ +override_dh_installinit: + dh_installinit --name=kplex --no-start --no-enable - install -d $$(pwd)/debian/kplex/etc/init.d/ - install -D -g root -o root -m 755 kplex.init $$(pwd)/debian/kplex/etc/init.d/ \ No newline at end of file +override_dh_installsystemd: + dh_installsystemd --name=kplex --no-enable -no-start From baad18ed79e2e3e6b27f57b3dc106ce1a31c10ba Mon Sep 17 00:00:00 2001 From: Frederic Guilbault <2@0464.ca> Date: Thu, 10 Dec 2020 20:51:24 -0500 Subject: [PATCH 7/8] add conf file to debian package and fix gitignore --- .gitignore | 6 ++++++ debian/rules | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 6596da5..cf21d9c 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,9 @@ kplex core version.h + +# Debian package +debian/files +debian/kplex +debian/kplex.* +debian/debhelper-build-stamp \ No newline at end of file diff --git a/debian/rules b/debian/rules index d4d9feb..06cb64d 100755 --- a/debian/rules +++ b/debian/rules @@ -13,7 +13,9 @@ export DH_VERBOSE=1 override_dh_auto_install: install -m 0644 kplex.service $$(pwd)/debian/ - install -D -g root -o root -m 755 kplex.init $$(pwd)/debian + install -m 0644 -D kplex.conf.ex $$(pwd)/debian/kplex/etc/kplex.conf + install -m 0755 -D -g root -o root kplex.init $$(pwd)/debian + $(MAKE) DESTDIR=$$(pwd)/debian/kplex PREFIX=/usr install override_dh_installinit: From ad14838b4b75da13091e2302e7bd9f9e7543da49 Mon Sep 17 00:00:00 2001 From: Frederic Guilbault <2@0464.ca> Date: Thu, 10 Dec 2020 21:48:21 -0500 Subject: [PATCH 8/8] Source is native as the debian folder is part of the official repo --- debian/source/format | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/source/format b/debian/source/format index 163aaf8..89ae9db 100644 --- a/debian/source/format +++ b/debian/source/format @@ -1 +1 @@ -3.0 (quilt) +3.0 (native)