initial import

This commit is contained in:
2025-06-22 20:39:04 -05:00
commit f8a70886f0
3428 changed files with 302546 additions and 0 deletions

42
darkhttpd/PKGBUILD Normal file
View File

@@ -0,0 +1,42 @@
# Maintainer: Jesus E. <heckyel@riseup.net>
pkgname=darkhttpd
pkgver=1.16
pkgrel=1
pkgdesc="A small and secure static webserver"
arch=('i686' 'x86_64')
url='https://unix4lyfe.org/darkhttpd/'
license=('Expat')
backup=('etc/conf.d/mimetypes')
install='darkhttpd.install'
source=("${pkgname}-${pkgver}.tar.gz::https://github.com/emikulic/darkhttpd/archive/v${pkgver}.tar.gz"
"darkhttpd.initd"
"darkhttpd.confd"
"darkhttpd.run")
sha512sums=('05abf8144d5a14ff455e2878eed4fddaca54d3fa6576b6a01d6547bcca94a0222d02742b80532519aba5202dd7df2d816e1dd057816506005894b42f570a4fe3'
'1ceea6362aea2aacfb6714d815b45edafba6681e34d47f79fc0d30ebca450745a6ff22f61eb7cdb6adabacbc0a7573e702ffdca387fd32657059c83a0e0a8cd5'
'79ecdbc751e8b5497a1afee294cf0addb4261f041a58a382e7fb51dd698dd99625a369173542c905e1e4eac7c68dfa1d8d778f4777ebe74d5031817a6ec437ad'
'29a8afde7ffdc7131b5e83fc60f98613febb475a086960552ca7fb386adca15eb6cfb8fcc84fc374299d918b0fc5648f58e9d5fa840f79f58a836f4cf61987dd')
build() {
cd "$srcdir/$pkgname-$pkgver"
make
}
package() {
cd "$srcdir/$pkgname-$pkgver"
# install darkhttpd
install -Dm755 "$srcdir/$pkgname-$pkgver/darkhttpd" "$pkgdir/usr/bin/darkhttpd"
# install service files
install -Dm0644 "${srcdir}/$pkgname.confd" "${pkgdir}/etc/conf.d/$pkgname"
install -Dm0755 "${srcdir}/$pkgname.initd" "${pkgdir}/etc/init.d/$pkgname"
install -Dm0755 "${srcdir}/$pkgname.run" "${pkgdir}/etc/sv/$pkgname/run"
touch "$pkgdir"/etc/conf.d/mimetypes
# install license
install -d "$pkgdir/usr/share/licenses/$pkgname"
sed -n '1,/^$/p' darkhttpd.c > "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

12
darkhttpd/darkhttpd.confd Normal file
View File

@@ -0,0 +1,12 @@
# darkhttpd web server config
#
# document_root="/var/www/localhost/htdocs"
logdir="/var/log/$SVCNAME"
# addr=127.0.0.1
# port=8080
run_as_user=darkhttpd
run_as_group=www-data
run_in_chroot=yes
# extra arguments
# darkhttpd_args=""

32
darkhttpd/darkhttpd.initd Normal file
View File

@@ -0,0 +1,32 @@
#! /sbin/openrc-run
supervisor=supervise-daemon
name="darkhttpd web server"
description="Simple, single-threaded, static content webserver"
pidfile="/run/darkhttpd.pid"
command="/usr/bin/darkhttpd"
command_args="${document_root:-/var/www/localhost/htdocs} ${darkhttpd_args}"
optional_arg() {
if [ -n "$2" ]; then
command_args="$command_args $1 $2"
fi
}
start_pre() {
if [ -n "$logdir" ]; then
checkpath --directory --owner darkhttpd "${logdir}"
command_args="$command_args --log ${logdir}/access.log"
fi
optional_arg --addr "$addr"
optional_arg --port "$port"
optional_arg --uid "$run_as_user"
optional_arg --gid "$run_as_group"
optional_arg --mimetypes "$mimetypes"
if yesno "${run_in_chroot:-no}"; then
command_args="${command_args} --chroot"
fi
}

View File

@@ -0,0 +1,28 @@
post_install() {
# create group and user
getent group www-data &>/dev/null || groupadd -g 82 www-data >/dev/null
if ! getent group darkhttpd &>/dev/null; then
groupadd -r darkhttpd >/dev/null
fi
if ! getent passwd darkhttpd &>/dev/null; then
useradd -r -c "darkhttpd user" -d /var/www/localhost/htdocs -g darkhttpd -s /bin/nologin darkhttpd >/dev/null
usermod -aG www-data darkhttpd
fi
# create initial directory
mkdir -p /var/www/localhost/htdocs
}
post_upgrade() {
post_install
}
post_remove() {
# delete group and user
if getent passwd darkhttpd &>/dev/null; then
userdel darkhttpd >/dev/null
fi
if getent group darkhttpd &>/dev/null; then
groupdel darkhttpd >/dev/null
fi
}

4
darkhttpd/darkhttpd.run Normal file
View File

@@ -0,0 +1,4 @@
#!/bin/sh
[ -r conf ] && . ./conf
: ${WWWDIR:=/var/www/localhost/htdocs}
exec darkhttpd "${WWWDIR}" --chroot --uid darkhttpd --gid darkhttpd $OPTS 2>&1