From 8f329473839997474aa3042978280e73715f0ffb Mon Sep 17 00:00:00 2001 From: Nicolas Arenas Date: Wed, 25 Jun 2025 07:30:58 +0200 Subject: [PATCH] refs: #2310 create package --- debian/NEWS | 8 ++ debian/README.debian | 10 ++ debian/changelog | 6 + debian/clean | 2 + debian/control | 58 ++++++++++ debian/copyright | 33 ++++++ debian/dirs | 3 + debian/gbp.conf | 3 + debian/opengnsys-opentracker-common.docs | 2 + debian/opengnsys-opentracker-common.install | 1 + debian/opengnsys-opentracker-common.links | 1 + debian/opengnsys-opentracker-common.manpages | 1 + debian/opengnsys-opentracker-ipv6.install | 2 + debian/opengnsys-opentracker.install | 2 + debian/opentracker-ipv6.conf | 106 ++++++++++++++++++ debian/opentracker-ipv6.service | 14 +++ debian/opentracker.1 | 73 ++++++++++++ debian/opentracker.conf | 106 ++++++++++++++++++ debian/opentracker.service | 14 +++ ...-send-4-requests-instead-of-infinity.patch | 25 +++++ debian/patches/series | 1 + debian/postinst | 34 ++++++ debian/rules | 65 +++++++++++ debian/salsa-ci.yml | 4 + debian/source/format | 1 + debian/source/lintian-overrides | 2 + debian/tests/control | 4 + debian/tests/testsuite | 8 ++ debian/upstream/metadata | 2 + debian/watch | 5 + debian/whitelist.txt | 8 ++ 31 files changed, 604 insertions(+) create mode 100644 debian/NEWS create mode 100644 debian/README.debian create mode 100644 debian/changelog create mode 100644 debian/clean create mode 100644 debian/control create mode 100644 debian/copyright create mode 100644 debian/dirs create mode 100644 debian/gbp.conf create mode 100644 debian/opengnsys-opentracker-common.docs create mode 100644 debian/opengnsys-opentracker-common.install create mode 100644 debian/opengnsys-opentracker-common.links create mode 100644 debian/opengnsys-opentracker-common.manpages create mode 100644 debian/opengnsys-opentracker-ipv6.install create mode 100644 debian/opengnsys-opentracker.install create mode 100644 debian/opentracker-ipv6.conf create mode 100644 debian/opentracker-ipv6.service create mode 100644 debian/opentracker.1 create mode 100644 debian/opentracker.conf create mode 100644 debian/opentracker.service create mode 100644 debian/patches/0001-testsuite-send-4-requests-instead-of-infinity.patch create mode 100644 debian/patches/series create mode 100644 debian/postinst create mode 100755 debian/rules create mode 100644 debian/salsa-ci.yml create mode 100644 debian/source/format create mode 100644 debian/source/lintian-overrides create mode 100644 debian/tests/control create mode 100755 debian/tests/testsuite create mode 100644 debian/upstream/metadata create mode 100644 debian/watch create mode 100644 debian/whitelist.txt diff --git a/debian/NEWS b/debian/NEWS new file mode 100644 index 0000000..0dfff7c --- /dev/null +++ b/debian/NEWS @@ -0,0 +1,8 @@ +opentracker (0.0~git20210823.110868e-8) unstable; urgency=medium + + This package now ships a different /etc/opentracker/opentracker-ipv6.conf + from the previously common /etc/opentracker/opentracker.conf. This is + because the IPv6 version breaks if an IPv4 listen IP is configured. See + bug #1053721. + + -- Agathe Porte Sun, 10 Dec 2023 13:44:53 +0100 diff --git a/debian/README.debian b/debian/README.debian new file mode 100644 index 0000000..4cd2b42 --- /dev/null +++ b/debian/README.debian @@ -0,0 +1,10 @@ +By default, the tracker is run in "private" mode using a whitelist access. +You need to explicitly list all of the torrent hashes that you want to announce +into the /etc/opentracker/whitelist.txt file. + +If you want to switch to "public" mode, allowing to announce any torrent hash, +you must recompile the package. You need to comment the +FEATURES+=-DWANT_ACCESSLIST_WHITE option and uncomment the +FEATURES+=-DWANT_ACCESSLIST_BLACK option in the debian/rules file. + +Switching to "public" mode is not recommended by the package maintainer. diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..9aad6ff --- /dev/null +++ b/debian/changelog @@ -0,0 +1,6 @@ +opengnsys-opentracker (1.0.0) unstable; urgency=medium + + * Rename package to avoid conflicts with ubuntu packages + * Build without whitelist support + + -- Nicolas Arenas Tue, 24 Jun 2025 22:09:00 +0100 diff --git a/debian/clean b/debian/clean new file mode 100644 index 0000000..bb620e0 --- /dev/null +++ b/debian/clean @@ -0,0 +1,2 @@ +opengnsys-opentracker-ipv4/ +opengnsys-opentracker-ipv6/ diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..283efd6 --- /dev/null +++ b/debian/control @@ -0,0 +1,58 @@ +Source: opengnsys-opentracker +Section: net +Priority: optional +Maintainer: Nicolas Arenas +Build-Depends: + debhelper-compat (= 13), + libowfat-dev, + zlib1g-dev, +Standards-Version: 4.6.2 +Homepage: +Vcs-Browser: https://ognproject.evlt.uma.es/gitea/narenas/opengnsys-opentracker.git +Vcs-Git: https://ognproject.evlt.uma.es/gitea/narenas/opengnsys-opentracker.git +Rules-Requires-Root: no + +Package: opengnsys-opentracker-common +Architecture: all +Pre-Depends: ${misc:Pre-Depends} +Depends: + ${misc:Depends}, +Description: Open and free bittorrent tracker (common files) + opentracker is a open and free bittorrent tracker project. It aims for minimal + resource usage and is intended to run on your wlan router. + . + This package contains the common files for both IPv4 and IPv6 versions. +Breaks: + opentracker +Replaces: + opentracker + +Package: opengnsys-opentracker +Architecture: any +Pre-Depends: ${misc:Pre-Depends} +Depends: + ${misc:Depends}, + ${shlibs:Depends}, + opengnsys-opentracker-common, +Description: Open and free bittorrent tracker (IPv4) + opentracker is a open and free bittorrent tracker project. It aims for minimal + resource usage and is intended to run on your wlan router. + . + This package contains the IPv4 version. +Breaks: + opentracker-common , +Replaces: + opentracker-common , + +Package: opengnsys-opentracker-ipv6 +Architecture: any +Pre-Depends: ${misc:Pre-Depends} +Depends: + ${misc:Depends}, + ${shlibs:Depends}, + opengnsys-opentracker-common, +Description: Open and free bittorrent tracker (IPv6) + opentracker is a open and free bittorrent tracker project. It aims for minimal + resource usage and is intended to run on your wlan router. + . + This package contains the IPv6 version. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..665154d --- /dev/null +++ b/debian/copyright @@ -0,0 +1,33 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: opentracker +Upstream-Contact: Dirk Engling +Source: https://erdgeist.org/arts/software/opentracker/ + +Files: * +Copyright: Dirk Engling +License: Beerware + THE BEER-WARE LICENSE" (Revision 42): + As long as you retain this notice you can do whatever you want with this + stuff. If we meet some day, and you think this stuff is worth it, you can buy + me a beer in return. + +Files: debian/* +Copyright: + 2015 Kaliko Jack + 2022-2024 Agathe Porte +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, 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 2 can be found in "/usr/share/common-licenses/GPL-2". diff --git a/debian/dirs b/debian/dirs new file mode 100644 index 0000000..c9f8f83 --- /dev/null +++ b/debian/dirs @@ -0,0 +1,3 @@ +etc/opentracker +usr/bin +var/lib/opentracker diff --git a/debian/gbp.conf b/debian/gbp.conf new file mode 100644 index 0000000..e49b66f --- /dev/null +++ b/debian/gbp.conf @@ -0,0 +1,3 @@ +[DEFAULT] +upstream-branch=upstream/latest +debian-branch=debian/latest diff --git a/debian/opengnsys-opentracker-common.docs b/debian/opengnsys-opentracker-common.docs new file mode 100644 index 0000000..be863b5 --- /dev/null +++ b/debian/opengnsys-opentracker-common.docs @@ -0,0 +1,2 @@ +README +README_v6 diff --git a/debian/opengnsys-opentracker-common.install b/debian/opengnsys-opentracker-common.install new file mode 100644 index 0000000..876e5db --- /dev/null +++ b/debian/opengnsys-opentracker-common.install @@ -0,0 +1 @@ +debian/whitelist.txt etc/opentracker/ diff --git a/debian/opengnsys-opentracker-common.links b/debian/opengnsys-opentracker-common.links new file mode 100644 index 0000000..96e17d8 --- /dev/null +++ b/debian/opengnsys-opentracker-common.links @@ -0,0 +1 @@ +usr/share/man/man8/opentracker.8 usr/share/man/man8/opentracker-ipv6.8 diff --git a/debian/opengnsys-opentracker-common.manpages b/debian/opengnsys-opentracker-common.manpages new file mode 100644 index 0000000..f93c71c --- /dev/null +++ b/debian/opengnsys-opentracker-common.manpages @@ -0,0 +1 @@ +debian/opentracker.1 diff --git a/debian/opengnsys-opentracker-ipv6.install b/debian/opengnsys-opentracker-ipv6.install new file mode 100644 index 0000000..b46b1c9 --- /dev/null +++ b/debian/opengnsys-opentracker-ipv6.install @@ -0,0 +1,2 @@ +opengnsys-opentracker-ipv6/opentracker-ipv6 usr/bin +debian/opentracker-ipv6.conf etc/opentracker diff --git a/debian/opengnsys-opentracker.install b/debian/opengnsys-opentracker.install new file mode 100644 index 0000000..c3af9d8 --- /dev/null +++ b/debian/opengnsys-opentracker.install @@ -0,0 +1,2 @@ +opengnsys-opentracker-ipv4/opentracker usr/bin +debian/opentracker.conf etc/opentracker/ diff --git a/debian/opentracker-ipv6.conf b/debian/opentracker-ipv6.conf new file mode 100644 index 0000000..ddb5cda --- /dev/null +++ b/debian/opentracker-ipv6.conf @@ -0,0 +1,106 @@ +# opentracker config file +# + +# I) Address opentracker will listen on, using both, tcp AND udp family +# (note, that port 6969 is implicite if ommitted). +# +# If no listen option is given (here or on the command line), opentracker +# listens on 0.0.0.0:6969 tcp and udp. +# +# The next variable determines if udp sockets are handled in the event +# loop (set it to 0, the default) or are handled in blocking reads in +# dedicated worker threads. You have to set this value before the +# listen.tcp_udp or listen.udp statements before it takes effect, but you +# can re-set it for each listen statement. Normally you should keep it at +# the top of the config file. +# +# listen.udp.workers 4 +# +# listen.tcp_udp 0.0.0.0 +# listen.tcp_udp 192.168.0.1:80 +# listen.tcp_udp 10.0.0.5:6969 +# +# To only listen on tcp or udp family ports, list them this way: +# +# listen.tcp 0.0.0.0 +# listen.udp 192.168.0.1:6969 +# +# Note, that using 0.0.0.0 for udp sockets may yield surprising results. +# An answer packet sent on that socket will not necessarily have the +# source address that the requesting client may expect, but any address +# on that interface. +# + +# II) If opentracker runs in a non-open mode, point it to files containing +# all torrent hashes that it will serve (shell option -w) +# +access.whitelist /etc/opentracker/whitelist.txt +# +# or, if opentracker was compiled to allow blacklisting (shell option -b) +# +# access.blacklist ./blacklist +# +# It is pointless and hence not possible to compile black AND white +# listing, so choose one of those options at compile time. File format +# is straight forward: "\n\n..." +# +# If you do not want to grant anyone access to your stats, enable the +# WANT_RESTRICT_STATS option in Makefile and bless the ip addresses +# allowed to fetch stats here. +# +# access.stats 192.168.0.23 +# +# There is another way of hiding your stats. You can obfuscate the path +# to them. Normally it is located at /stats but you can configure it to +# appear anywhere on your tracker. +# +# access.stats_path stats + +# III) Live sync uses udp multicast packets to keep a cluster of opentrackers +# synchronized. This option tells opentracker which port to listen for +# incoming live sync packets. The ip address tells opentracker, on which +# interface to join the multicast group, those packets will arrive. +# (shell option -i 192.168.0.1 -s 9696), port 9696 is default. +# +# livesync.cluster.listen 192.168.0.1:9696 +# +# Note that two udp sockets will be opened. One on ip address 0.0.0.0 +# port 9696, that will join the multicast group 224.0.42.23 for incoming +# udp packets and one on ip address 192.168.0.1 port 9696 for outgoing +# udp packets. +# +# As of now one and only one ip address must be given, if opentracker +# was built with the WANT_SYNC_LIVE feature. +# + +# IV) Sync between trackers running in a cluster is restricted to packets +# coming from trusted ip addresses. While source ip verification is far +# from perfect, the authors of opentracker trust in the correct +# application of tunnels, filters and LAN setups (shell option -A). +# +# livesync.cluster.node_ip 192.168.0.4 +# livesync.cluster.node_ip 192.168.0.5 +# livesync.cluster.node_ip 192.168.0.6 +# +# This is the admin ip address for old style (HTTP based) asynchronus +# tracker syncing. +# +# batchsync.cluster.admin_ip 10.1.1.1 +# + +# V) Control privilege drop behaviour. +# Put in the directory opentracker will chroot/chdir to. All black/white +# list files must be put in that directory (shell option -d). +# +# +tracker.rootdir /etc/opentracker +# +# Tell opentracker which user to setuid to. +# +tracker.user _opentracker +# + +# VI) opentracker can be told to answer to a "GET / HTTP"-request with a +# redirect to another location (shell option -r). +# +# tracker.redirect_url https://your.tracker.local/ diff --git a/debian/opentracker-ipv6.service b/debian/opentracker-ipv6.service new file mode 100644 index 0000000..66f9a74 --- /dev/null +++ b/debian/opentracker-ipv6.service @@ -0,0 +1,14 @@ +[Unit] +Description=OpenTracker Daemon (IPv6) +After=network.target +Documentation=man:opentracker + +[Service] +User=_opentracker +PrivateTmp=yes +ExecStart=/usr/bin/opentracker-ipv6 -f /etc/opentracker/opentracker-ipv6.conf +ExecStop=/bin/kill -INT $MAINPID +ExecReload=/bin/kill -HUP $MAINPID + +[Install] +WantedBy=multi-user.target diff --git a/debian/opentracker.1 b/debian/opentracker.1 new file mode 100644 index 0000000..af2e2c0 --- /dev/null +++ b/debian/opentracker.1 @@ -0,0 +1,73 @@ +.TH OPENTRACKER "8" "July 2021" "opentracker" "User Commands" +.SH NAME +opentracker \- Open bittorrent tracker +.SH SYNOPSIS +.PP +\fBopentracker\fR +[ -\fBi\fR \fIip\fR ] +[ -\fBp\fR \fIport\fR ] +[ -\fBP\fR \fIport\fR ] +[ -\fBr\fR \fIredirect\fR ] +[ -\fBd\fR \fIdir\fR ] +[ -\fBu\fR \fIuser\fR ] +[ -\fBA\fR \fIip\fR ] +[ -\fBf\fR \fIconfig\fR ] +[ -\fBs\fR \fIlivesyncport\fR ] +[ -\fBw\fR \fIwhitelistfile\fR ] +.SH DESCRIPTION +.PP +This tracker is open in a sense that everyone announcing a torrent is welcome +to do so and will be informed about anyone else announcing the same torrent. +Only source IPs are accepted. The tracker implements a minimal +set of essential features only but was able respond to far more than 10000 +requests per second on a Sun Fire 2200 M2 (that's where we found no more clients +able to fire more of our testsuite.sh script). +.SH OPTIONS +.TP +-\fBf\fR \fIconfig\fR +include and execute the config file +.TP +-\fBi\fR \fIip\fR +specify ip to bind to (default: *, you may specify more than one) +.TP +-\fBp\fR \fIport\fR +specify tcp port to bind to (default: 6969, you may specify more than one) +.TP +-\fBP\fR \fIport\fR +specify udp port to bind to (default: 6969, you may specify more than one) +.TP +-\fBr\fR \fIredirecturlspecify\fR +url where / should be redirected to (default none) +.TP +-\fBd\fR \fIdir\fR +specify directory to try to chroot to (default: ".") +.TP +-\fBu\fR \fIuser\fR +specify user under whose privileges opentracker should run (default: "nobody") +.TP +-\fBA\fR \fIip\fR +bless an ip address as admin address (e.g. to allow syncs from this address) +.TP +-\fBw\fR \fIfile\fR +specify whitelist file + +\fB\-h, \-?, \-\-help\fP +show a help message and exit +.TP +\fB\-ht, \-\-host\fI HOST\fP +host (default: localhost) +.TP +\fB\-p, \-\-port\fI PORT\fP +port (default: 8080) +.TP +\fB\-mp, \-\-multiprocessor\fI PROCESS_COUNT\fP +define how many processes for the grammar checker +.TP +\fB\-t, \-\-test_page\fP +page to test the server on / +.TP +\fB\-on, \-\-opt-on\fR [\fIOPT\fR]...\fP +activate options +.TP +\fB\-off, \-\-opt-off\fR [\fIOPT\fR]...\fP +deactivate options diff --git a/debian/opentracker.conf b/debian/opentracker.conf new file mode 100644 index 0000000..0a697bb --- /dev/null +++ b/debian/opentracker.conf @@ -0,0 +1,106 @@ +# opentracker config file +# + +# I) Address opentracker will listen on, using both, tcp AND udp family +# (note, that port 6969 is implicite if ommitted). +# +# If no listen option is given (here or on the command line), opentracker +# listens on 0.0.0.0:6969 tcp and udp. +# +# The next variable determines if udp sockets are handled in the event +# loop (set it to 0, the default) or are handled in blocking reads in +# dedicated worker threads. You have to set this value before the +# listen.tcp_udp or listen.udp statements before it takes effect, but you +# can re-set it for each listen statement. Normally you should keep it at +# the top of the config file. +# +# listen.udp.workers 4 +# +# listen.tcp_udp 0.0.0.0 +# listen.tcp_udp 192.168.0.1:80 +# listen.tcp_udp 10.0.0.5:6969 +# +# To only listen on tcp or udp family ports, list them this way: +# +# listen.tcp 0.0.0.0 +# listen.udp 192.168.0.1:6969 +# +# Note, that using 0.0.0.0 for udp sockets may yield surprising results. +# An answer packet sent on that socket will not necessarily have the +# source address that the requesting client may expect, but any address +# on that interface. +# + +# II) If opentracker runs in a non-open mode, point it to files containing +# all torrent hashes that it will serve (shell option -w) +# +# access.whitelist /etc/opentracker/whitelist.txt +# +# or, if opentracker was compiled to allow blacklisting (shell option -b) +# +# access.blacklist ./blacklist +# +# It is pointless and hence not possible to compile black AND white +# listing, so choose one of those options at compile time. File format +# is straight forward: "\n\n..." +# +# If you do not want to grant anyone access to your stats, enable the +# WANT_RESTRICT_STATS option in Makefile and bless the ip addresses +# allowed to fetch stats here. +# +# access.stats 192.168.0.23 +# +# There is another way of hiding your stats. You can obfuscate the path +# to them. Normally it is located at /stats but you can configure it to +# appear anywhere on your tracker. +# +# access.stats_path stats + +# III) Live sync uses udp multicast packets to keep a cluster of opentrackers +# synchronized. This option tells opentracker which port to listen for +# incoming live sync packets. The ip address tells opentracker, on which +# interface to join the multicast group, those packets will arrive. +# (shell option -i 192.168.0.1 -s 9696), port 9696 is default. +# +# livesync.cluster.listen 192.168.0.1:9696 +# +# Note that two udp sockets will be opened. One on ip address 0.0.0.0 +# port 9696, that will join the multicast group 224.0.42.23 for incoming +# udp packets and one on ip address 192.168.0.1 port 9696 for outgoing +# udp packets. +# +# As of now one and only one ip address must be given, if opentracker +# was built with the WANT_SYNC_LIVE feature. +# + +# IV) Sync between trackers running in a cluster is restricted to packets +# coming from trusted ip addresses. While source ip verification is far +# from perfect, the authors of opentracker trust in the correct +# application of tunnels, filters and LAN setups (shell option -A). +# +# livesync.cluster.node_ip 192.168.0.4 +# livesync.cluster.node_ip 192.168.0.5 +# livesync.cluster.node_ip 192.168.0.6 +# +# This is the admin ip address for old style (HTTP based) asynchronus +# tracker syncing. +# +# batchsync.cluster.admin_ip 10.1.1.1 +# + +# V) Control privilege drop behaviour. +# Put in the directory opentracker will chroot/chdir to. All black/white +# list files must be put in that directory (shell option -d). +# +# +tracker.rootdir /etc/opentracker +# +# Tell opentracker which user to setuid to. +# +tracker.user _opentracker +# + +# VI) opentracker can be told to answer to a "GET / HTTP"-request with a +# redirect to another location (shell option -r). +# +# tracker.redirect_url https://your.tracker.local/ diff --git a/debian/opentracker.service b/debian/opentracker.service new file mode 100644 index 0000000..91a7d54 --- /dev/null +++ b/debian/opentracker.service @@ -0,0 +1,14 @@ +[Unit] +Description=OpenTracker Daemon (IPv4) +After=network.target +Documentation=man:opentracker + +[Service] +User=_opentracker +PrivateTmp=yes +ExecStart=/usr/bin/opentracker -f /etc/opentracker/opentracker.conf +ExecStop=/bin/kill -INT $MAINPID +ExecReload=/bin/kill -HUP $MAINPID + +[Install] +WantedBy=multi-user.target diff --git a/debian/patches/0001-testsuite-send-4-requests-instead-of-infinity.patch b/debian/patches/0001-testsuite-send-4-requests-instead-of-infinity.patch new file mode 100644 index 0000000..4f0e27b --- /dev/null +++ b/debian/patches/0001-testsuite-send-4-requests-instead-of-infinity.patch @@ -0,0 +1,25 @@ +From: Agathe Porte +Date: Tue, 24 May 2022 14:36:47 +0200 +Subject: testsuite: send 4 requests instead of infinity + +For Debian autopkgtest needs, we want to run send a definite amount of +requests instead of an infinite amount. 4 requests should be enough, as +response time can be quite long. + +Forwarded: not-needed +--- + tests/testsuite.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tests/testsuite.sh b/tests/testsuite.sh +index dace2c6..fe480f5 100644 +--- a/tests/testsuite.sh ++++ b/tests/testsuite.sh +@@ -1,6 +1,6 @@ + #!/bin/sh + +-while true; do ++for _ in $(seq 4); do + request_string="GET /announce?info_hash=0123456789012345678\ + %$(printf %02X $(( $RANDOM & 0xf )) )\ + &ip=$(( $RANDOM & 0xf )).$(( $RANDOM & 0xf )).13.16&port=$(( $RANDOM & 0xff )) HTTP/1.0\n" diff --git a/debian/patches/series b/debian/patches/series new file mode 100644 index 0000000..03e09f9 --- /dev/null +++ b/debian/patches/series @@ -0,0 +1 @@ +0001-testsuite-send-4-requests-instead-of-infinity.patch diff --git a/debian/postinst b/debian/postinst new file mode 100644 index 0000000..71f215e --- /dev/null +++ b/debian/postinst @@ -0,0 +1,34 @@ +#!/bin/sh + +set -e + +HOMEDIR=/var/lib/opentracker + +case "$1" in + configure) + if ! getent passwd _opentracker > /dev/null 2>&1 + then + useradd --system --user-group \ + --home-dir "$HOMEDIR" \ + --no-create-home \ + --shel /bin/false \ + --comment "Opentracker bittorrent tracker daemon" \ + _opentracker + fi + + if ! dpkg-statoverride --list "$HOMEDIR" >/dev/null 2>&1; then + dpkg-statoverride --update --add _opentracker _opentracker 0750 "$HOMEDIR" + fi + + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + ;; + + *) + echo "postinst called with unknown argument \`${1}'" >&2 + exit 1 + ;; +esac + +#DEBHELPER# diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..5c5e9be --- /dev/null +++ b/debian/rules @@ -0,0 +1,65 @@ +#!/usr/bin/make -f +# See debhelper(7) (uncomment to enable) +# output every command that modifies files on the build system. +#DH_VERBOSE = 1 + +export DEB_BUILD_MAINT_OPTIONS += hardening=+all + +# see EXAMPLES in dpkg-buildflags(1) and read /usr/share/dpkg/* +DPKG_EXPORT_BUILDFLAGS = 1 +include /usr/share/dpkg/buildflags.mk +CFLAGS+=$(CPPFLAGS) +CXXFLAGS+=$(CPPFLAGS) + +# see ENVIRONMENT in dpkg-buildflags(1) +# package maintainers to append CFLAGS +export DEB_CFLAGS_MAINT_APPEND += -Wall -pedantic + +#FEATURES+=-DWANT_ACCESSLIST_BLACK +#FEATURES+=-DWANT_ACCESSLIST_WHITE +#FEATURES+=-DWANT_IP_FROM_QUERY_STRING +FEATURES+=-DWANT_COMPRESSION_GZIP +#FEATURES+=-DWANT_IP_FROM_PROXY +#FEATURES+=-DWANT_LOG_NUMWANT -DWANT_MODEST_FULLSCRAPES +#FEATURES+=-DWANT_SPOT_WOODPECKER +FEATURES+=-DWANT_SYSLOGS +#FEATURES+=-DWANT_DEV_RANDOM +FEATURES+=-DWANT_RESTRICT_STATS +FEATURES+=-DWANT_NO_AUTO_FREE + +export FEATURES +export LIBOWFAT_LIBRARY=/usr/lib +export PREFIX=/usr + +# main packaging script based on dh7 syntax +%: + dh $@ + +LINKEDFILES = ../*.h ../*.c ../Makefile ../Makefile.* + +# create a shadow directory for setting different build options. +# inspired from the vim source package +opengnsys-opentracker-%: + mkdir -p "$@" + cd "$@" && ln -s $(LINKEDFILES) . + +override_dh_auto_clean: + dh_auto_clean + rm -rf opengnsys-opentracker-ipv4 opengnsys-opentracker-ipv6 + +override_dh_auto_build: opengnsys-opentracker-ipv4 opengnsys-opentracker-ipv6 + STRIP=true FEATURES="$(FEATURES)" dh_auto_build --sourcedirectory=opengnsys-opentracker-ipv4 -- LIBOWFAT_HEADERS=/usr/include/libowfat + + STRIP=true FEATURES="$(FEATURES) -DWANT_V6" dh_auto_build --sourcedirectory=opengnsys-opentracker-ipv6 -- LIBOWFAT_HEADERS=/usr/include/libowfat + + mv opengnsys-opentracker-ipv6/opentracker opengnsys-opentracker-ipv6/opentracker-ipv6 + + dpkg-parsechangelog -l debian/NEWS + +override_dh_auto_install: + # do not call the install target of the upstream makefile, because + # executables are renamed + dh_auto_install -S none --sourcedirectory=opengnsys-opentracker-ipv4 + dh_auto_install -S none --sourcedirectory=opengnsys-opentracker-ipv6 + + rm -rf debian/opengnsys-opentracker-common/usr/bin diff --git a/debian/salsa-ci.yml b/debian/salsa-ci.yml new file mode 100644 index 0000000..181c297 --- /dev/null +++ b/debian/salsa-ci.yml @@ -0,0 +1,4 @@ +include: + - https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/salsa-ci.yml + - https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/pipeline-jobs.yml + 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) diff --git a/debian/source/lintian-overrides b/debian/source/lintian-overrides new file mode 100644 index 0000000..aee23fc --- /dev/null +++ b/debian/source/lintian-overrides @@ -0,0 +1,2 @@ +# upstream has no known bug tracker +upstream-metadata-missing-bug-tracking diff --git a/debian/tests/control b/debian/tests/control new file mode 100644 index 0000000..2319156 --- /dev/null +++ b/debian/tests/control @@ -0,0 +1,4 @@ +Tests: testsuite +Depends: + @, + netcat-openbsd, diff --git a/debian/tests/testsuite b/debian/tests/testsuite new file mode 100755 index 0000000..432bc8f --- /dev/null +++ b/debian/tests/testsuite @@ -0,0 +1,8 @@ +#!/bin/bash + +set -euo pipefail + +cp -a tests $AUTOPKGTEST_TMP +cd $AUTOPKGTEST_TMP + +bash ./tests/testsuite.sh diff --git a/debian/upstream/metadata b/debian/upstream/metadata new file mode 100644 index 0000000..3d5e1b6 --- /dev/null +++ b/debian/upstream/metadata @@ -0,0 +1,2 @@ +Repository: https://erdgeist.org/gitweb/opentracker +Repository-Browse: https://erdgeist.org/gitweb/opentracker/ diff --git a/debian/watch b/debian/watch new file mode 100644 index 0000000..3801786 --- /dev/null +++ b/debian/watch @@ -0,0 +1,5 @@ +version=4 +opts="mode=git, gitmode=full, pgpmode=none, pretty=0.0~git%cd.%h, repack, compression=xz" \ + https://erdgeist.org/gitweb/opentracker \ + HEAD + diff --git a/debian/whitelist.txt b/debian/whitelist.txt new file mode 100644 index 0000000..767488f --- /dev/null +++ b/debian/whitelist.txt @@ -0,0 +1,8 @@ +# By default the tracker is run in "private" mode, using this whitelist. +# +# Add one hash per torrent you want to allow your tracker to announce. +# Example: +# 285862f84278e5e08f3a4f6606d2e768e594d5c3 +# +# To switch to "public" mode, allowing to announce any torrent hash, comment +# the "access.whitelist" option in /etc/opentracker/opentracker.conf