From 5e3953bc7db3864c86648fb3b2669ddf4a9b2a42 Mon Sep 17 00:00:00 2001 From: bill-auger Date: Tue, 27 Apr 2021 16:29:45 -0400 Subject: [gophernicus]: add package --- pcr-testing/gophernicus/PKGBUILD | 64 ++++++++++++++++++++++ pcr-testing/gophernicus/fix-make-log-typo.patch | 13 +++++ .../gophernicus/preserve-existing-gophermap.patch | 15 +++++ .../remove-DESTDIR-from-initscripts.patch | 32 +++++++++++ .../xinetd-respect-custom-server-root.patch | 34 ++++++++++++ 5 files changed, 158 insertions(+) create mode 100644 pcr-testing/gophernicus/PKGBUILD create mode 100644 pcr-testing/gophernicus/fix-make-log-typo.patch create mode 100644 pcr-testing/gophernicus/preserve-existing-gophermap.patch create mode 100644 pcr-testing/gophernicus/remove-DESTDIR-from-initscripts.patch create mode 100644 pcr-testing/gophernicus/xinetd-respect-custom-server-root.patch diff --git a/pcr-testing/gophernicus/PKGBUILD b/pcr-testing/gophernicus/PKGBUILD new file mode 100644 index 000000000..d869e4b76 --- /dev/null +++ b/pcr-testing/gophernicus/PKGBUILD @@ -0,0 +1,64 @@ +# Maintainer: botplus +# Contributor: bill-auger + + +pkgname=gophernicus +pkgver=3.1.1 +pkgrel=1 +pkgdesc="Modern, full-featured (and hopefully) secure gopher daemon" +arch=('armv7h' 'i686' 'x86_64') +url="https://github.com/gophernicus/gophernicus" +license=('BSD2') + +backup=(etc/xinetd.d/gophernicus + srv/gopher/gophermap) + +depends=('libwrap' 'xinetd') +optdepends=("xinetd-openrc: openrc init-script") +source=(${pkgname}-${pkgver}.tar.gz::https://github.com/gophernicus/gophernicus/releases/download/${pkgver}/${pkgname}-${pkgver}.tar.gz + xinetd-respect-custom-server-root.patch + remove-DESTDIR-from-initscripts.patch + fix-make-log-typo.patch + preserve-existing-gophermap.patch) + +b2sums=('74610071fab7ee6defc7e128c92f8775d00c42e6b3e806993d9468676e904388bd54cb101f25dad0e281e67090cfdcaf21728eab7821fa1cbd9ea09201d93acb' + 'da46d9010d3b7485aa092c3557c707473ac465451f7e09d32e52409bdefba0633900f198cb8aadc8a05e55274b70ef72cfc2bda4fe22b254c738aa078b0f8280' + '575bf3480b79c5381f2d08c029e96ebb7eee224e19effe294b95feb1f11f8536a53c12b4850df1263b609a776de350acb0cc17783547b841a631aa7643b3f468' + '56fedcb3d687b935a4d6d254f511b7fc9c2171190ec4eb00724fab82c93c424c2c373a8881818daba55bee9a381213b45c9a79fde13419a5f817a7bfd065f60c' + 'd6bc23c85168e235430eaf3c70edb62c2ee729c891aab15492b637d43fa752310a7f67cc9c194b3d174d46a6ce8a692bb685178874b8ea01086b12a4746f6fb4') + + +prepare() +{ + cd "${srcdir}"/${pkgname}-${pkgver} + + # allow server root under /srv/ with xinetd + patch -Np1 < "${srcdir}"/xinetd-respect-custom-server-root.patch + + # remove DESTDIR path from installed init scripts + patch -Np1 < "${srcdir}"/remove-DESTDIR-from-initscripts.patch + + # fix typo in make log (does not affect the binary package) + patch -Np1 < "${srcdir}"/fix-make-log-typo.patch + + # fix think-o in ./configure (does not affect the binary package) + patch -Np1 < "${srcdir}"/preserve-existing-gophermap.patch +} + +build() +{ + cd "${srcdir}"/${pkgname}-${pkgver} + + ./configure --prefix=/usr \ + --sbindir=/usr/bin \ + --listener=xinetd \ + --gopherroot=/srv/gopher + make +} + +package() +{ + cd "${srcdir}"/${pkgname}-${pkgver} + + make DESTDIR="${pkgdir}" install +} diff --git a/pcr-testing/gophernicus/fix-make-log-typo.patch b/pcr-testing/gophernicus/fix-make-log-typo.patch new file mode 100644 index 000000000..4cf75dd40 --- /dev/null +++ b/pcr-testing/gophernicus/fix-make-log-typo.patch @@ -0,0 +1,13 @@ +diff --git a/Makefile.in b/Makefile.in +index 3ab1bd1..5468d92 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -109,7 +109,7 @@ install-msg-xinetd: + echo "accessed." + echo "On systemd distributions:" + echo " systemctl restart xinetd" +- echo "You can configure arguments, including the hostname, in $(INETD)." ++ echo "You can configure arguments, including the hostname, in $(XINETD)." + echo + + install-msg-systemd: diff --git a/pcr-testing/gophernicus/preserve-existing-gophermap.patch b/pcr-testing/gophernicus/preserve-existing-gophermap.patch new file mode 100644 index 000000000..544339113 --- /dev/null +++ b/pcr-testing/gophernicus/preserve-existing-gophermap.patch @@ -0,0 +1,15 @@ +diff --git a/configure b/configure +index d54dc29..067affe 100755 +--- a/configure ++++ b/configure +@@ -280,9 +280,9 @@ printf "\\n" + # Don't replace an existing root + printf "checking for existing gopher root... " + if [ -d "${GOPHERROOT}" ] || [ -f "${GOPHERROOT}/gophermap" ]; then +- INSTALL_ROOT="install-root" + printf "yes" + else ++ INSTALL_ROOT="install-root" + printf "no" + fi + printf "\\n" diff --git a/pcr-testing/gophernicus/remove-DESTDIR-from-initscripts.patch b/pcr-testing/gophernicus/remove-DESTDIR-from-initscripts.patch new file mode 100644 index 000000000..96eec6d12 --- /dev/null +++ b/pcr-testing/gophernicus/remove-DESTDIR-from-initscripts.patch @@ -0,0 +1,32 @@ +diff --git a/Makefile.in b/Makefile.in +index 5468d92..d047c7a 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -145,15 +145,15 @@ install-root: + $(INSTALL) -m 644 $(MAP).sample $(DESTDIR)$(ROOT)/gophermap + + install-inetd-update: install-root +- update-inetd --add "$$(sed -e "s:@BINARY_PATH@:$(DESTDIR)$(SBINDIR)/$(BINARY):g" -e "s/@OPTIONS@/$(INETOPT)/g" init/inetlin.in)" ++ update-inetd --add "$$(sed -e "s:@BINARY_PATH@:$(SBINDIR)/$(BINARY):g" -e "s/@OPTIONS@/$(INETOPT)/g" init/inetlin.in)" + update-inetd --enable gopher + + install-inetd-manual: install-root +- sed -e "s:@BINARY_PATH@:$(DESTDIR)$(SBINDIR)/$(BINARY):g" -e "s/@OPTIONS@/$(INETOPT)/g" init/inetlin.in >> $(DESTDIR)$(INETD) ++ sed -e "s:@BINARY_PATH@:$(SBINDIR)/$(BINARY):g" -e "s/@OPTIONS@/$(INETOPT)/g" init/inetlin.in >> $(DESTDIR)$(INETD) + + install-xinetd: install-root + $(INSTALL) -d -m 755 $(DESTDIR)/etc/xinetd.d +- sed -i -e "s:@BINARY@:$(DESTDIR)$(SBINDIR)/$(BINARY):g" init/$(NAME).xinetd ++ sed -i -e "s:@BINARY@:$(SBINDIR)/$(BINARY):g" init/$(NAME).xinetd + $(INSTALL) -m 644 -T init/$(NAME).xinetd $(DESTDIR)$(XINETD) + + install-osx: install-root +@@ -172,7 +172,7 @@ install-systemd: install-root + $(INSTALL) -m 644 -T init/$(NAME).env $(DESTDIR)$(DEFAULT)/$(NAME) + $(INSTALL) -d -m 755 $(DESTDIR)$(SYSTEMD) + $(INSTALL) -m 644 -t $(DESTDIR)$(SYSTEMD) init/$(NAME).socket +- sed -i -e "s:@BINARY@:$(DESTDIR)$(SBINDIR)/$(BINARY):g" init/$(NAME)\@.service ++ sed -i -e "s:@BINARY@:$(SBINDIR)/$(BINARY):g" init/$(NAME)\@.service + $(INSTALL) -m 644 -t $(DESTDIR)$(SYSTEMD) init/$(NAME)\@.service + + uninstall: @UNINSTALL_INETD_UPDATE@ @UNINSTALL_INETD_MANUAL@ @UNINSTALL_XINETD@ @UNINSTALL_OSX@ @UNINSTALL_SYSTEMD@ diff --git a/pcr-testing/gophernicus/xinetd-respect-custom-server-root.patch b/pcr-testing/gophernicus/xinetd-respect-custom-server-root.patch new file mode 100644 index 000000000..b0106639b --- /dev/null +++ b/pcr-testing/gophernicus/xinetd-respect-custom-server-root.patch @@ -0,0 +1,34 @@ +diff --git a/configure b/configure +index 067affe..c78a9f6 100755 +--- a/configure ++++ b/configure +@@ -340,12 +340,14 @@ sed -i -e "s:@XINETD_CONF@:${XINETD_CONF}:" Makefile + + printf "done\\n" + +-# Also sub in $HOSTNAME to the various init systems (whether or not we really +-# use them, its just easier) ++# Also sub in $GOPHERROOT and $HOSTNAME to the various init systems ++# (whether or not we really use them, its just easier) + for f in gophernicus.env haiku_snippet org.gophernicus.server.plist \ + gophernicus.xinetd; do + printf "creating init/${f}... " +- sed -e "s:@HOSTNAME@:${HOSTNAME}:" "init/${f}.in" > "init/${f}" ++ cp init/${f}{.in,} ++ sed -i -e "s:@GOPHERROOT@:${GOPHERROOT}:" init/${f} ++ sed -i -e "s:@HOSTNAME@:${HOSTNAME}:" init/${f} + printf "done\\n" + done + +diff --git a/init/gophernicus.xinetd.in b/init/gophernicus.xinetd.in +index 4f2c921..a052375 100644 +--- a/init/gophernicus.xinetd.in ++++ b/init/gophernicus.xinetd.in +@@ -6,6 +6,6 @@ service gopher + wait = no + user = nobody + server = @BINARY@ +- server_args = -r/var/gopher -h@HOSTNAME@ ++ server_args = -r@GOPHERROOT@ -h@HOSTNAME@ + disable = no + } -- cgit v1.2.2