added innd and friends

This commit is contained in:
kitzman 2021-11-15 01:34:18 +02:00
parent e065803b47
commit 06a32c652f
Signed by: kitzman
GPG Key ID: 83289D84AA7C9A54
9 changed files with 193 additions and 2 deletions

108
images/inn/APKBUILD Normal file
View File

@ -0,0 +1,108 @@
# Contributor: kitzman <kitzman @ disroot.org>
# Maintainer: kitzman <kitzman @ disroot.org>
pkgname=inn
pkgver=2.6.4
pkgrel=3
pkgdesc="Complete open source Usenet system. De facto standard for handling news routing, news spool and serving the spool to customers."
subpackages="$pkgname-doc"
url="https://www.isc.org/othersoftware/"
arch='all'
license="custom:INN"
depends="openssl perl-mime-tools"
makedepends="make bison perl-dev python3 python3-dev openssl-dev gcc exim libsasl cyrus-sasl-dev"
optdepends="python3 libsasl"
options="emptydirs zipman suid !check"
install=inn.post-install
validpgpkeys="E784364E8DDE7BB370FBD9EAD15D313882004173"
source="https://ftp.isc.org/isc/inn/inn-$pkgver.tar.gz inn.tmpfiles inn.sysusers"
sha512sums="
0b1e4add9fe1f2a423f372adbce9622ffe943c75865427f30b18f5a5b8c2dae158d5bfa4d611631cb993757523bc858ca6ad907463bd5f91c60a851359a70c57 inn-2.6.4.tar.gz
5abedea21ef2631248f4c48b31e346ae5ea5ec6db191ac496a55b5a3e28f8e644bf5c23a2d4fc4957b3eefcc988d8973d46d890c1b0275b14e5f1c33207efc94 inn.tmpfiles
38f3748b3b95cf9eb25834af39adb500a48ac76082987b58cc66dcef32140ed19f45539c617feca59d5938a65be5168f4b614ee626ebf89fa67a73bafa7550d8 inn.sysusers"
prepare() {
cd "$srcdir"/inn-$pkgver
# Override unreproducible hostname
sed -i 's/HOSTNAME=`hostname 2> \/dev\/null || uname -n`/HOSTNAME=alpine/' configure
}
build() {
cd "$srcdir"/inn-$pkgver
# CFLAGS+=' -fcommon' # https://wiki.gentoo.org/wiki/Gcc_10_porting_notes/fno_common
PYTHON=/usr/bin/python3 ./configure --prefix=/usr \
--includedir=/usr/include/inn \
--sbindir=/usr/sbin \
--with-libtool \
--with-gnu-id \
--with-db-dir=/var/db/inn \
--sysconfdir=/etc/inn \
--with-spool-dir=/var/spool/news \
--with-log-dir=/var/log/inn \
--with-run-dir=/var/run/inn \
--with-tmp-dir=/var/spool/inn/tmp \
--enable-largefiles \
--with-openssl=/usr \
--with-perl \
--with-python \
--with-sendmail=/usr/bin/msmtp \
--with-sasl=/usr \
--with-news-user=9 \
--with-news-group=13
# See https://wiki.archlinux.org/index.php/DeveloperWiki:UID_/_GID_Database
test -f include/config.h
cat >>include/config.h <<EOF
#undef RUNASUSER
#define RUNASUSER "news"
#undef RUNASGROUP
#define RUNASGROUP "news"
EOF
make
}
package() {
cd "$srcdir"/inn-$pkgver
export LD_LIBRARY_PATH=.:"$pkgdir"/usr/lib:$LD_LIBRARY_PATH
make DESTDIR="$pkgdir" install
cd "$pkgdir"/usr/lib
for i in lib*.a; do
gcc -shared -o ${i%%.a}.so.2.0.0 $i
for j in 2.0 2; do
ln -s ${i%%a}so.2.0.0 ${i%%a}so.$j
done
done
touch "$pkgdir"/var/db/inn/history
touch "$pkgdir"/var/db/inn/history.dir
touch "$pkgdir"/var/db/inn/history.hash
touch "$pkgdir"/var/db/inn/history.index
mkdir -p "$pkgdir"/usr/share/inn/
mv "$pkgdir"/usr/http/* "$pkgdir"/usr/share/inn/
mv "$pkgdir"/usr/bin/archive "$pkgdir"/usr/bin/archive.inn
mkdir -p "$pkgdir"/usr/share/doc/inn "$pkgdir"/usr/share/inn/
mv "$pkgdir"/usr/share/man/man3/list.3 "$pkgdir"/usr/share/man/man3/list-inn.3
mv "$pkgdir"/usr/doc/* "$pkgdir"/usr/share/doc/inn/
rm -rf "$pkgdir"/usr/http "$pkgdir"/var/run "$pkgdir"/usr/doc
install -D -m0644 "$srcdir"/inn-$pkgver/LICENSE "$pkgdir"/usr/share/licenses/inn/LICENSE
chown root:root "$pkgdir"/usr/bin/innbind
chmod 05555 "$pkgdir"/usr/bin/innbind
install -Dm0644 "$srcdir"/inn.sysusers "$pkgdir"/usr/lib/sysusers.d/inn.conf
install -Dm0644 "$srcdir"/inn.tmpfiles "$pkgdir"/usr/lib/tmpfiles.d/inn.conf
mkdir -p "$pkgdir"/var/spool/news
mkdir -p "$pkgdir"/var/log/news
mkdir -p "$pkgdir"/var/db/inn
chown 9:13 -R "$pkgdir"/var/spool/news 2>&- >&-
chown 9:13 "$pkgdir"/var/log/news 2>&- >&-
chown 9:13 -R "$pkgdir"/var/db/inn 2>&- >&-
}

38
images/inn/Dockerfile Normal file
View File

@ -0,0 +1,38 @@
FROM alpine:3.14
RUN apk update
RUN apk upgrade
RUN apk add coreutils shadow sudo
RUN apk add ca-certificates ca-certificates-bundle
RUN update-ca-certificates
RUN apk add alpine-sdk
RUN useradd -m -G wheel,users,abuild abuild-user
RUN sed '$a%wheel ALL=(ALL) NOPASSWD: ALL' -i /etc/sudoers
USER abuild-user
RUN mkdir -p /home/abuild-user/staging/inn
WORKDIR /home/abuild-user/staging/inn
COPY APKBUILD .
COPY inn.* .
RUN abuild-keygen -a -i -n
RUN abuild -r
RUN sudo apk add --allow-untrusted /home/abuild-user/packages/staging/x86_64/inn*.apk
USER root
RUN sed 's|%wheel ALL=(ALL) NOPASSWD: ALL||g' -i /etc/sudoers
USER news
WORKDIR /tmp
COPY innd.sh .
ENTRYPOINT ["innd.sh"]

View File

@ -0,0 +1,15 @@
#!/bin/sh
/usr/bin/makedbz -i -o 2>&- >&-
mkdir -p /var/log/news 2>&- >&-
echo ""
echo "->"
echo "-> If this is a first-time installation, a minimal active file and"
echo "-> history database have been installed. Do not forget to update"
echo "-> your cron entries and configure INN. See INSTALL for more"
echo "-> information."
echo "->"
echo "-> The default user:group for inn is news:news"
echo "->"
echo ""

3
images/inn/inn.sysusers Normal file
View File

@ -0,0 +1,3 @@
g news 13 -
u news 9 - /var/spool/news
m news news

1
images/inn/inn.tmpfiles Normal file
View File

@ -0,0 +1 @@
d /run/inn 0755 news news -

13
images/inn/innd.sh Executable file
View File

@ -0,0 +1,13 @@
#!/bin/sh
if [ ! -z "$INND_FIRST_RUN" ]; then
makehistory
fi
/usr/bin/rc.news
sleep 3s
innd_pid=$(cat /var/run/inn/innd.pid)
tail -f --pid=$innd_pid /dev/null

View File

@ -0,0 +1,13 @@
IMAGE="inn:0.1"
NNTP_PORT=563
MOUNT_ARGS="-v /var/spool/news:/var/spool/news"
MOUNT_ARGS="-v /var/spool/inn:/var/spool/inn ${MOUNT_ARGS}"
MOUNT_ARGS="-v /var/db/inn:/var/db/inn ${MOUNT_ARGS}"
MOUNT_ARGS="-v /var/lib/inn/etc:/etc/inn ${MOUNT_ARGS}"
NETWORK_ARGS="-p $NNTP_PORT:$NNTP_PORT"
USER_ARGS=""
CUSTOM_ARGS=""

View File

@ -13,7 +13,7 @@ apk upgrade
echo "" > /etc/motd
groupadd abuild
useradd -G wheel users abuild
useradd -G -m wheel,users abuild
apk add ca-certificates ca-certificates-bundle
apk add syslog-ng logrotate bash

View File

@ -30,7 +30,7 @@ if [ -z $(cat $subuid_file | awk -F: "{if (\$1 == \"$me\") {print;} }") ]; then
$me
fi
if [ -z $(cat $subgid_file | awk -F: "{if (\$1 == \"$me\") {print;} }")) ]; then
if [ -z $(cat $subgid_file | awk -F: "{if (\$1 == \"$me\") {print;} }") ]; then
usermod -w \
$(($me_gid * base_count + min_id))-$(($me_gid * base_count + min_id + base_count - 1)) \
$me