Skip to the text
KDOS
Menu
kdos.dev KDOS from Scratch KDOS 0.2 · 4dd4a10 · 2026-11-30 Contents Index

189.1. minidlna-1.3.3

ReadyMedia — a DLNA media server for the televisions and players on a LAN

The build-state snapshot was taken from 1.3.3-1; this recipe is 1.3.3-2, so the size, time and contents below describe the earlier build.

Version 1.3.3, release 2
Shelf servers — Daemons that serve other machines: remote shell, web, mail, XMPP, IRC, CalDAV/CardDAV, SMB and DLNA
Phase 42_graphics (Graphics Stack), 163 of 189 in build order
Licence GPL-2.0-only AND BSD-3-Clause
Homepage https://sourceforge.net/projects/minidlna/
Build time 1.0 SBU
Installed size 385.3 KiB in 7 files
Recipe ports/core/servers/minidlna/kpkgbuild

About

MiniDLNA (ReadyMedia) is a DLNA/UPnP media server: it indexes the music, pictures and video in the directories its configuration names, and serves them to televisions, consoles and players on the local network. The port ships its own start script, /etc/init.d/84_minidlna.sh, which starts minidlnad under supervision as the unprivileged minidlna account and skips the service until /etc/minidlna.conf exists and is not empty; the upstream example is installed as /usr/share/doc/minidlna/minidlna.conf.example. Other machines reach it only once the dlna firewall name is opened; see Opening a service and firewall.

Sources

Dependencies

Depends on: ffmpeg, libjpeg-turbo, libexif, libid3tag, flac, libogg, libvorbis, sqlite, zlib, gettext, autoconf, automake, libtool.

Required by: no port names it.

Patches

build.sh applies these; kpkg applies nothing by itself.

Installation

From the repository root, inside the build container, this is the line kdosbuild runs for the port:

script/chroot/exec.sh bash -c 'source script/phases/42_graphics/phase.env && kpkg install minidlna'

What kpkg does

kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/servers/minidlna.

1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.

cd /ports/core/servers/minidlna
echo '39026c6d4a139b9180192d1c37225aa3376fdf4f1a74d7debbdbb693d996afa4  minidlna-1.3.3.tar.gz' | sha256sum -c -

2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.

SRC_ROOT=/var/cache/kpkg/work/minidlna
SRC=$SRC_ROOT/minidlna-1.3.3
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf minidlna-1.3.3.tar.gz -C "$SRC" --strip-components=1

Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.

3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:

patch -p1 -i "$PORT_SRC/ffmpeg7.patch"
patch -p1 -i "$PORT_SRC/libav-fix.patch"
autoreconf -fi

export CFLAGS="$CFLAGS -fcommon"
./configure --prefix=/usr --sysconfdir=/etc \
	ac_cv_lib_avahi_client_avahi_threaded_poll_new=no \
	--with-db-path=/var/lib/minidlna \
	--with-log-path=/var/log/minidlna \
	--with-os-name=KDOS --with-os-url=https://kdos.dev/ \
	--disable-nls --disable-tivo --disable-netgear --disable-readynas
make
make DESTDIR=$PKG install

install -Dm644 minidlna.conf.5 "$PKG/usr/share/man/man5/minidlna.conf.5"
install -Dm644 minidlnad.8 "$PKG/usr/share/man/man8/minidlnad.8"
install -Dm644 minidlna.conf "$PKG/usr/share/doc/minidlna/minidlna.conf.example"
install -dm755 "$PKG/var/lib/minidlna" "$PKG/var/log/minidlna"

install -d "$PKG/etc/init.d"
cat > "$PKG/etc/init.d/84_minidlna.sh" <<'KDOS_SH'
#!/bin/bash
. /etc/init.d/service_helper

NAME="minidlna"
DAEMON="/usr/sbin/minidlnad"
CONF="/etc/minidlna.conf"

case "$1" in
    start)
        [ ! -x "$DAEMON" ] && { echo "[SKIP] $NAME: $DAEMON not found"; exit 0; }
        if [ ! -s "$CONF" ]; then
            echo "[SKIP] $NAME: no $CONF (/usr/share/doc/minidlna has the template)"
            exit 0
        fi
        if ! getent passwd minidlna >/dev/null; then
            echo "[SKIP] $NAME: no minidlna account (the port's postinstall makes it)"
            exit 0
        fi
        echo "[KDOS] Starting $NAME..."
        supervise "$NAME" "$DAEMON" -S -u minidlna -f "$CONF"
        ;;
    stop)   stop_service "$NAME" ;;
    status) check_status "$NAME" ;;
    *)      echo "Usage: $0 {start|stop|status}"; exit 1 ;;
esac
KDOS_SH
chmod 755 "$PKG/etc/init.d/84_minidlna.sh"

The switches, and why each is set:

The common switches of each build system are explained in the Flag glossary.

postinstall.sh runs on the installed system after the package is adopted:

# Everything is written under PKG_ROOT, the root kpkgadd is installing into:
# --root and an A/B update install into a tree that is not the running one, and
# an account made in / instead would be missing from the system that needs it.
#
# The guard reads PKG_ROOT's files: getent answers for the running root, not
# the tree being installed, and would let useradd run against an account the
# target already has.
root="${PKG_ROOT:-/}"
grep -q '^minidlna:' "$root/etc/group" 2>/dev/null || groupadd -R "$root" -r minidlna
grep -q '^minidlna:' "$root/etc/passwd" 2>/dev/null || \
	useradd -R "$root" -r -g minidlna -d /var/lib/minidlna -s /sbin/nologin minidlna

# chown resolves a name against the running root's passwd, so the ids are read
# out of PKG_ROOT's. The database and the log are written after the drop.
while IFS=: read -r n _ uid gid _; do
	[ "$n" = minidlna ] || continue
	chown "$uid:$gid" "$root/var/lib/minidlna" "$root/var/log/minidlna"
done < "$root/etc/passwd"

4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/minidlna, prunes what the image does not ship, lints the tree and rolls it reproducibly:

tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
    --mtime=@$SOURCE_DATE_EPOCH \
    --use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
    -cf minidlna-1.3.3-2.tar.xz -C "$PKG" .

5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/minidlna, and runs the triggers its paths call for.

Contents

Installed programs: minidlnad.

Installed directories: /usr/share/doc/minidlna, /usr/share/licenses/minidlna, /var/lib/minidlna, /var/log/minidlna.

Short descriptions

minidlnad MiniDLNA DLNA/UPnP-AV Server

Notes

autoreconf -fi runs after both patches because libav-fix.patch edits Makefile.am; without it the shipped Makefile.in would still carry the reference. That is why autoconf, automake and libtool are in depends.

postinstall.sh makes the minidlna group and account inside $PKG_ROOT, then gives /var/lib/minidlna and /var/log/minidlna to it by the numeric ids it reads from that root’s /etc/passwd, so an install into a root that is not the running system gives the directories to the right account. The start script runs minidlnad -S -u minidlna, so the daemon writes its database after dropping to that account; see postinstall.sh and System accounts.