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

108.9. ngircd-28

An IRC server small enough for one room — chat on a LAN with no internet

Version 28, release 1
Shelf servers — Daemons that serve other machines: remote shell, web, mail, XMPP, IRC, CalDAV/CardDAV, SMB and DLNA
Phase 41_system (System), 947 of 1047 in build order
Licence GPL-2.0-or-later
Homepage https://ngircd.barton.de/
Build time 0.2 SBU
Installed size 681.8 KiB in 29 files
Recipe ports/core/servers/ngircd/kpkgbuild

About

ngIRCd is a small IRC server, enough for a room of machines on one network to chat with no internet behind them. The package installs the server, its manual pages and the sample configuration, and an init script, 79_ngircd, that runs it under the supervisor as its own ngircd account. Nothing runs until the administrator writes /etc/ngircd.conf: the script is skipped until that file exists and is not empty (see Services). The server listens on TCP 6667, and on 6697 for TLS once the configuration names it; the irc firewall name opens both to other machines.

Sources

Dependencies

Depends on: openssl, zlib, util-linux.

Required by: no port names it.

Optional, off in KDOS

These switches in build.sh turn off a feature whose library is a port here. The recipe may turn each off on purpose, or because the library was not yet a port when the recipe was written; this list cannot tell which.

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/41_system/phase.env && kpkg install ngircd'

What kpkg does

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

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/ngircd
echo 'b48ba320a931d445ae335c47f88a9406a20f5c71c623bee5f7755d0522d435ee  ngircd-28.tar.xz' | 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/ngircd
SRC=$SRC_ROOT/ngircd-28
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf ngircd-28.tar.xz -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:

./configure --prefix=/usr --sysconfdir=/etc \
	--with-openssl --without-gnutls \
	--with-zlib --with-iconv \
	--without-ident --without-tcp-wrappers --without-pam \
	--with-syslog --with-epoll --enable-ipv6
make
make DESTDIR=$PKG install

rm -f "$PKG/etc/ngircd.conf"

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

NAME="ngircd"
DAEMON="/usr/sbin/ngircd"
CONF="/etc/ngircd.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/ngircd/sample-ngircd.conf is the template)"
            exit 0
        fi
        if ! getent passwd ngircd >/dev/null; then
            echo "[SKIP] $NAME: no ngircd account (the port's postinstall makes it)"
            exit 0
        fi
        echo "[KDOS] Starting $NAME..."
        supervise "$NAME" setpriv --reuid=ngircd --regid=ngircd \
            --init-groups "$DAEMON" -n -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/79_ngircd.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 '^ngircd:' "$root/etc/group" 2>/dev/null || groupadd -R "$root" -r ngircd
grep -q '^ngircd:' "$root/etc/passwd" 2>/dev/null || \
	useradd -R "$root" -r -g ngircd -d /nonexistent -s /sbin/nologin ngircd

# The guard leaves an existing account as it is, so the home is set apart
# from it: a tree that already has the account takes /nonexistent too. usermod
# exits 0 without writing when the home is already /nonexistent.
usermod -R "$root" -d /nonexistent ngircd

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/ngircd, 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 ngircd-28-1.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/ngircd, and runs the triggers its paths call for.

Contents

Installed programs: ngircd.

Installed directories: /usr/share/doc/ngircd, /usr/share/licenses/ngircd.

Short descriptions

ngircd the "next generation" IRC daemon

Notes

make install copies the sample configuration to /etc/ngircd.conf when none is there, and build.sh deletes that copy from the package. The init script starts the server whenever that file exists, so shipping it would run an IRC server on every machine that installs the package. The sample stays at /usr/share/doc/ngircd/sample-ngircd.conf, and copying it into place is the decision to run one.

The init script starts ngircd -n -f /etc/ngircd.conf through setpriv, which drops to the ngircd account before the server starts: -n keeps it in the foreground where the supervisor watches it, and ServerUID in the configuration is not needed. Neither port needs privilege to bind. The account is made by postinstall.sh under PKG_ROOT, the root the package is being installed into, so an install into another tree, such as the inactive A/B slot, gets the account in that tree. Its home is /nonexistent: the server keeps no files of its own. The hook sets the home with usermod after the creation check, so a tree that already had an ngircd account with another home is given /nonexistent as well.