From 4ff0313e933086c2d0ed30cb7ea3d4bdac3f48ce Mon Sep 17 00:00:00 2001 From: kitzman Date: Tue, 16 Nov 2021 03:10:18 +0200 Subject: [PATCH] added lieferhund --- README.md | 7 +- images/lieferhund/APKBUILD.sinntp | 44 ++++++++++ images/lieferhund/Dockerfile | 83 +++++++++++++++++++ .../lieferhund_init/container.lieferhund.conf | 8 ++ 4 files changed, 141 insertions(+), 1 deletion(-) create mode 100644 images/lieferhund/APKBUILD.sinntp create mode 100644 images/lieferhund/Dockerfile create mode 100644 scripts/lieferhund_init/container.lieferhund.conf diff --git a/README.md b/README.md index d9a2c38..1a4b585 100644 --- a/README.md +++ b/README.md @@ -41,4 +41,9 @@ The APKBUILD will be sent to the aports repo... one day™. ## Lieferhund + sinntp scripts -Coming soon ™. +My news processor. Currently can only read RSS and Atom. I scripted it to send +the news to an NNTP server (one line command with sinntp - and the news item +has the same structure as an email, so you can just use the interpolator). + +**NOTE**: It has to compile GnuTLS - because the Alpine package does not provide +Guile bindings, which are a prerequisite for running Lieferhund. diff --git a/images/lieferhund/APKBUILD.sinntp b/images/lieferhund/APKBUILD.sinntp new file mode 100644 index 0000000..2d6d1c6 --- /dev/null +++ b/images/lieferhund/APKBUILD.sinntp @@ -0,0 +1,44 @@ +# Contributor: kitzman +# Maintainer: kitzman +pkgname=sinntp +pkgver=1.6 +pkgrel=0 +pkgdesc="NNTP utilities" +provides="" +replaces="" +url="https://github.com/jwilk/sinntp" +arch="noarch" +license="GPLv2" +depends="python3" +checkdepends="python3-dev" +makedepends="gzip" +subpackages="" +source="https://github.com/jwilk/sinntp/releases/download/1.6/sinntp-1.6.tar.gz" +builddir="$srcdir/$_pkgname-$pkgver" +options="!check" + +sha512sums=" +44276960bda9ed532559af369eee3afa53a6b1638ec2089bffe229be4816d91cda98b8ae1d5f48d4774139e8776b52ae48cd6188d4d644a749ba70782dc94fe3 sinntp-1.6.tar.gz +" + +package() { + sources="$srcdir/$pkgname-$pkgver" + + mkdir -p "$pkgdir"/usr/bin + mkdir -p "$pkgdir"/usr/share/sinntp + mkdir -p "$pkgdir"/usr/share/man/man1 + + cp "$sources"/doc/manpages/* "$pkgdir"/usr/share/man/man1/. + + find "$pkgdir"/usr/share/man/man1 -exec gzip {} \; + + cp "$sources"/sinntp "$pkgdir"/usr/share/sinntp/. + cp "$sources"/plugins.py "$pkgdir"/usr/share/sinntp/. + cp "$sources"/utils.py "$pkgdir"/usr/share/sinntp/. + + ln -s /usr/share/sinntp/sinntp "$pkgdir"/usr/bin/sinntp + cp "$sources"/nntp-push "$pkgdir"/usr/bin/. + cp "$sources"/nntp-pull "$pkgdir"/usr/bin/. + cp "$sources"/nntp-list "$pkgdir"/usr/bin/. + cp "$sources"/nntp-get "$pkgdir"/usr/bin/. +} diff --git a/images/lieferhund/Dockerfile b/images/lieferhund/Dockerfile new file mode 100644 index 0000000..9105a7f --- /dev/null +++ b/images/lieferhund/Dockerfile @@ -0,0 +1,83 @@ +FROM alpine:3.14 + +RUN apk update +RUN apk upgrade + +# APKBUILD env sinntp package +RUN apk add coreutils shadow sudo +RUN apk add ca-certificates ca-certificates-bundle +RUN update-ca-certificates +RUN apk add alpine-sdk + +RUN apk add git build-base automake autoconf texinfo +RUN apk add guile guile-libs guile-dev + +RUN useradd -m -G wheel,users,abuild abuild-user + +RUN sed '$a%wheel ALL=(ALL) NOPASSWD: ALL' -i /etc/sudoers + +USER abuild-user + +# sinntp package +RUN mkdir -p /home/abuild-user/staging/sinntp + +WORKDIR /home/abuild-user/staging/sinntp + +COPY APKBUILD.sinntp APKBUILD + +RUN abuild-keygen -a -i -n +RUN abuild -r +RUN sudo apk add --allow-untrusted /home/abuild-user/packages/staging/x86_64/sinntp*.apk + +# gnutls package + +RUN mkdir -p /home/abuild-user/staging/gnutls + +WORKDIR /home/abuild-user/staging/gnutls + +RUN curl -LO https://git.alpinelinux.org/aports/plain/main/gnutls/APKBUILD +RUN curl -LO https://git.alpinelinux.org/aports/plain/main/gnutls/tests-crq.patch +RUN curl -LO https://git.alpinelinux.org/aports/plain/main/gnutls/tests-certtool.patch + +RUN sed 's|$pkgname-dbg||g' -i APKBUILD +RUN sed 's|disable-guile|enable-guile|g' -i APKBUILD +RUN sed 's|makedepends="|makedepends="texinfo guile guile-dev guile-libs |g' -i APKBUILD +RUN sed '10aoptions="!strip !check"' -i APKBUILD + +RUN abuild -r +RUN sudo apk add --allow-untrusted /home/abuild-user/packages/staging/x86_64/gnutls*.apk + +USER root + +RUN sed 's|%wheel ALL=(ALL) NOPASSWD: ALL||g' -i /etc/sudoers + +# Lieferhund itself + +ENV LH_TAG af0aa6b + +RUN git clone https://git.disroot.org/kitzman/lieferhund /tmp/lieferhund + +WORKDIR /tmp/lieferhund +RUN git checkout $LH_TAG + +RUN autoreconf -vfi +RUN ./configure +RUN make +RUN make check +RUN make install + +WORKDIR /home/lieferhund +RUN rm -rf /tmp/lieferhund + +RUN mkdir -p /usr/lib/news +RUN chown news:news /usr/lib/news + +USER news + +RUN cd $HOME + +ENTRYPOINT ["lieferwelpe.scm", \ + "-c", "/var/lib/lieferhund/config.scm", \ + "-b", "/var/lib/lieferhund/db.scm", \ + "-t", "1h"] + diff --git a/scripts/lieferhund_init/container.lieferhund.conf b/scripts/lieferhund_init/container.lieferhund.conf new file mode 100644 index 0000000..6aec824 --- /dev/null +++ b/scripts/lieferhund_init/container.lieferhund.conf @@ -0,0 +1,8 @@ +IMAGE="lieferhund:0.1" + +MOUNT_ARGS="-v /var/lib/lieferhund:/var/lib/lieferhund" + +NETWORK_ARGS="" +USER_ARGS="" + +CUSTOM_ARGS="" \ No newline at end of file