Add build rules for Debian package

pull/525/head
Petter Reinholdtsen 2022-04-28 15:30:07 +02:00
rodzic 098671510d
commit 28522b737e
12 zmienionych plików z 197 dodań i 140 usunięć

Wyświetl plik

@ -149,13 +149,9 @@ DRIVER_OBJS:=$(patsubst src/%.cc,$(BUILD)/%.o,$(DRIVER_OBJS))
all: $(BUILD)/wmbusmeters $(BUILD)/wmbusmetersd $(BUILD)/wmbusmeters.g $(BUILD)/wmbusmeters-admin $(BUILD)/testinternals
deb: wmbusmeters_$(DEBVERSION)_$(DEBARCH).deb
check_deb:
lintian --no-tag-display-limit wmbusmeters_$(DEBVERSION)_$(DEBARCH).deb
clean_deb:
rm -f wmbusmeters_$(DEBVERSION)_$(DEBARCH).deb
deb:
test -L debian || ln -s deb debian
debuild
# Check docs verifies that all options in the source have been mentioned in the README and in the man page.
# Also any option not in the source but mentioned in the docs is warned for as well.
@ -176,9 +172,6 @@ install: $(BUILD)/wmbusmeters check_docs
uninstall:
@./uninstall.sh /
wmbusmeters_$(DEBVERSION)_$(DEBARCH).deb:
@./deb/create_deb.sh $(BUILD) $@ $(DEBVERSION) $(DEBARCH)
snapcraft:
snapcraft
@ -372,3 +365,5 @@ list_copyrights:
# Include dependency information generated by gcc in a previous compile.
include $(wildcard $(patsubst %.o,%.d,$(PROG_OBJS) $(DRIVER_OBJS)))
.PHONY: deb

Wyświetl plik

@ -1,5 +1,5 @@
wmbusmeters (1.3.0-1) stable; urgency=medium
* First package upload (Closes: #xxxxxx)
* First package upload (Closes: #998721).
-- Fredrik Öhrström <oehrstroem@gmail.com> Sat, 26 Jun 2021 12:39:00 +0100

23
deb/control 100644
Wyświetl plik

@ -0,0 +1,23 @@
Source: wmbusmeters
Section: kernel
Priority: optional
Maintainer: Petter Reinholdtsen <pere@debian.org>
Build-Depends: debhelper-compat (= 13)
, librtlsdr-dev
, libncurses-dev
, rtl-wmbus
Standards-Version: 4.5.1
Homepage: https://github.com/weetmuts/wmbusmeters
Vcs-Browser: https://github.com/weetmuts/wmbusmeters
Vcs-Git: https://github.com/weetmuts/wmbusmeters.git
Rules-Requires-Root: no
Package: wmbusmeters
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
, rtl-wmbus
Description: read wireless and wired M-BUS telegrams from utility meters
Receives and decodes C1,T1 or S1 telegrams (using
the wireless or wired mbus protocol) to acquire utility meter
readings. The readings can then be published using MQTT,
curled to a REST api, inserted into a database or stored in a log file.

118
deb/copyright 100644
Wyświetl plik

@ -0,0 +1,118 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: wmbusmeters
Source: https://github.com/weetmuts/wmbusmeters
Upstream-Contact: Fredrik Öhrström <oehrstroem@gmail.com>
Files: *
Copyright: 2017-2022 Fredrik Öhrström <oehrstroem@gmail.com>
License: GPL-3+
Files: src/aes.cc
Copyright: 2019 kokke
License: CC0
Files: src/aes.h
Copyright: 2019 kokke
License: CC0
Files: src/driver_iperl.cc
Copyright: 2022 Fredrik Öhrström
2018 David Mallon
License: GPL-3+
Files: src/driver_minomess.cc
Copyright: 2021 Olli Salonen
License: GPL-3+
Files: src/driver_sharky774.cc
Copyright: 2021 Vincent Privat
2022 Fredrik Öhrström
License: GPL-3+
Files: src/driver_sharky.cc
Copyright: 2021 Vincent Privat
License: GPL-3+
Files: src/manufacturer_specificities.cc
Copyright: 2019 Jacek Tomasiak
2021 Vincent Privat
License: GPL-3+
Files: src/manufacturer_specificities.h
Copyright: 2019 Jacek Tomasiak
2021 Vincent Privat
License: GPL-3+
Files: src/meter_emerlin868.cc
Copyright: 2020 Fredrik Öhrström
2018 David Mallon
License: GPL-3+
Files: src/meter_ev200.cc
Copyright: 2020 Fredrik Öhrström
2018 David Mallon
License: GPL-3+
Files: src/meter_hydrus.cc
Copyright: 2020 Fredrik Öhrström
2021 Vincent Privat
License: GPL-3+
Files: src/meter_izar.cc
Copyright: 2019 Jacek Tomasiak
2020 Fredrik Öhrström
2021 Vincent Privat
License: GPL-3+
Files: src/meter_multical403.cc
Copyright: 2020 Fredrik Öhrström
2020 Eric Bus
License: GPL-3+
Files: src/meter_multical602.cc
Copyright: 2021 Fredrik Öhrström
2020 Eric Bus
License: GPL-3+
Files: src/meter_multical603.cc
Copyright: 2020 Fredrik Öhrström
2020 Eric Bus
License: GPL-3+
Files: src/meter_multical803.cc
Copyright: 2020 Fredrik Öhrström
2020 Eric Bus
2020 Nikodem Jędrzejczak
License: GPL-3+
Files: src/meter_sensostar.cc
Copyright: 2020 Patrick Schwarz
License: GPL-3+
Files: src/meter_topaseskr.cc
Copyright: 2020 Fredrik Öhrström
2020 Avandorp
License: GPL-3+
Files: src/sha256.cc
Copyright: 2013 Tom St Denis <tomstdenis@gmail.com>
2013 WaterJuice <waterjuice.org>
License: CC0
Files: src/sha256.h
Copyright: 2013 Tom St Denis <tomstdenis@gmail.com>
2013 WaterJuice <waterjuice.org>
License: CC0
License: GPL-3+
This program 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, or
(at your option) any later version.
.
On Debian systems, the complete text of the GNU General Public License
version 3 can be found in file "/usr/share/common-licenses/GPL-3".
License: CC0
The authors, and therefore would be copyright holders, have as much
as possible relinguished their copyright to the public domain.

Wyświetl plik

@ -1,110 +0,0 @@
#!/bin/sh
BUILD=$1
DEB=$2
DEBVERSION=$3
DEBARCH=$4
if [ -z "$BUILD" ]
then
echo "You must supply a directory for the deb contents."
exit 1
fi
if [ ! -x "$BUILD/wmbusmeters" ]
then
echo "You have to build wmbusmeters first."
exit 1
fi
if [ "$USER" != "root" ]
then
echo 'You have to run this command as "sudo make deb"'
exit 1
fi
if [ -z "$DEB" ]
then
echo "Uou must supply a name for the deb file."
exit 1
fi
if [ -z "$DEBVERSION" ]
then
echo "You must supply deb version."
exit 1
fi
if [ -z "$DEBARCH" ]
then
echo "You must supply a deb arch."
exit 1
fi
# Now run the standard install script into the directory
# that is to become the deb package.
rm -rf $BUILD/debian/wmbusmeters
mkdir -p $BUILD/debian/wmbusmeters/DEBIAN
./install.sh $BUILD/wmbusmeters $BUILD/debian/wmbusmeters --no-adduser
ISIZE=$(du -s --apparent-size build/debian/wmbusmeters/ | cut -f 1)
# Remove the conf and log files, they are to be installed by postinst.
rm $BUILD/debian/wmbusmeters/etc/wmbusmeters.conf
rm -rf $BUILD/debian/wmbusmeters/etc/wmbusmetersd
rm -rf $BUILD/debian/wmbusmeters/var/log/wmbusmeters
cat >> $BUILD/debian/wmbusmeters/DEBIAN/conffiles << EOF
/etc/logrotate.d/wmbusmeters
EOF
mkdir -p $BUILD/debian/wmbusmeters/usr/share/doc/wmbusmeters
# Install the changelog.
cp deb/changelog $BUILD/debian/wmbusmeters/usr/share/doc/wmbusmeters/changelog.Debian
gzip -v9 -n $BUILD/debian/wmbusmeters/usr/share/doc/wmbusmeters/changelog.Debian
# Automatically collect copyright information.
./deb/collect_copyrights.sh $BUILD/debian/wmbusmeters/usr/share/doc/wmbusmeters/copyright
# Install the install/remove scripts.
for x in preinst postinst prerm postrm
do
cp deb/$x $BUILD/debian/wmbusmeters/DEBIAN/
chmod 555 $BUILD/debian/wmbusmeters/DEBIAN/$x
done
# Build the control file.
cat >> $BUILD/debian/wmbusmeters/DEBIAN/control << EOF
Package: wmbusmeters
Version: $DEBVERSION
Maintainer: Fredrik Öhrström <oehrstroem@gmail.com>
Architecture: $DEBARCH
Installed-Size: $ISIZE
Depends: libc6 (>= 2.27)
Section: kernel
Priority: optional
Homepage: https://github.com/weetmuts/wmbusmeters
Description: read wireless and wired mbus telegrams from utility meters
Wmbusmeters receives and decodes C1,T1 or S1 telegrams (using
the wireless or wired mbus protocol) to acquire utility meter
readings. The readings can then be published using MQTT,
curled to a REST api, inserted into a database or stored in a log file.
.
Installing this package results in a full installation, including the
configuration files and the daemon. Configuration files for an existing
installation are preserved.
EOF
# Change owner to root
chown -R root:root $BUILD/debian/wmbusmeters
# Package the deb.
(cd $BUILD/debian; dpkg-deb --build wmbusmeters .)
# Move the built deb back to the source root.
mv $BUILD/debian/wmbusmeters_${DEBVERSION}_${DEBARCH}.deb .
chown $SUDO_USER:$SUDO_USER wmbusmeters_${DEBVERSION}_${DEBARCH}.deb
echo Built package $
echo But the deb package is not yet working correctly! Work in progress.

Wyświetl plik

@ -1,6 +1,16 @@
#!/bin/sh
ADD_WMBUSMETERS_USER
set -e
# Start wmbusmeters service
systemctl start wmbusmeters.service
# Add the wmbusmeters group unless it's already there
addgroup --quiet --system wmbusmeters || true
# creating wmbusmeters user unless it's already there
if ! getent passwd wmbusmeters >/dev/null; then
adduser --system --ingroup wmbusmeters \
--home / --no-create-home \
--gecos "wmbusmeters daemon" \
wmbusmeters
fi
#DEBHELPER#

Wyświetl plik

@ -1,11 +1,16 @@
#!/bin/bash
# More cleanup?
set -e
ID=$(id -u wmbusmeters 2>/dev/null)
if [ ! "$ID" = "" ]
then
userdel wmbusmeters
# FIXME Is it safe to remove userand group on removal, or is it owning
# any files?
if false && getent passwd wmbusmeters >/dev/null; then
userdel wmbusmetersq
echo user: removed wmbusmeters
fi
if false && getent group wmbusmeters >/dev/null; then
groupdel wmbusmeters
echo group: removed wmbusmeters
fi
#DEBHELPER#

Wyświetl plik

@ -1,4 +0,0 @@
#!/bin/sh
# Shutdown wmbusmeters service if it is running.
systemctl stop wmbusmeters.service

Wyświetl plik

@ -1,6 +0,0 @@
#!/bin/bash
# Stop the service
echo "Stopping any wmbusmeters.service running..."
systemctl stop wmbusmeters.service || true

17
deb/rules 100755
Wyświetl plik

@ -0,0 +1,17 @@
#!/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 $@

Wyświetl plik

@ -0,0 +1 @@
3.0 (quilt)

8
deb/watch 100644
Wyświetl plik

@ -0,0 +1,8 @@
# See uscan(1) for format
# Compulsory line, this is a version 4 file
version=4
opts="filenamemangle=s%(?:.*?)?v?(\d[\d.]*)\.tar\.gz%wmbusmeters-$1.tar.gz%" \
https://github.com/weetmuts/wmbusmeters/tags \
(?:.*?/)?v?(\d[\d.]*)\.tar\.gz debian uupdate