- Replace autoconf/make build system with CMake (installs to /opt/archie) - Add CPack DEB packaging for Debian Trixie (non-free/net, postinst creates archie user, extracts DB skeleton, sets setuid bits, enables systemd units) - Add Gitea Actions workflow building .deb + binary/source tarballs on tag push - Add portable archie_init.py for non-Debian post-install setup - Port all scripts to Linux: getent passwd, systemctl, tail -n +N, gzip - Add SFTP (libssh2) and FTPS (OpenSSL) scrapers alongside anonftp - Add Flask web frontend (archie-web.service) - Fix filter scripts (exec cat replaces broken sed s///g) - Update all manpages: paths, contacts, add SFTP/FTPS section - Update etc/: enable gzip, add webindex catalog, fix localhost refs - Remove: AIX-2/SunOS-4.1.4/SunOS-5.4 dirs, tcl7.6/, tcl-dp/, tk4.2/, berkdb/, old Makefile.in/pre/post fragments, build.sh, unwrap scripts - Add .gitignore Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
87 lines
3.7 KiB
Bash
Executable File
87 lines
3.7 KiB
Bash
Executable File
#!/bin/bash
|
|
set -e
|
|
|
|
ARCHIE_HOME=/opt/archie
|
|
ARCHIE_USER=archie
|
|
ARCHIE_GROUP=archie
|
|
SYSTEMD_SYSTEM=/lib/systemd/system
|
|
|
|
case "$1" in
|
|
configure)
|
|
# ── user / group ────────────────────────────────────────────────
|
|
if ! getent group "$ARCHIE_GROUP" > /dev/null 2>&1; then
|
|
addgroup --system "$ARCHIE_GROUP"
|
|
fi
|
|
if ! getent passwd "$ARCHIE_USER" > /dev/null 2>&1; then
|
|
adduser --system \
|
|
--home "$ARCHIE_HOME" \
|
|
--no-create-home \
|
|
--ingroup "$ARCHIE_GROUP" \
|
|
--shell /usr/sbin/nologin \
|
|
--disabled-password \
|
|
--gecos "Archie FTP index server" \
|
|
"$ARCHIE_USER"
|
|
fi
|
|
|
|
# ── binary symlinks (mirrors release/base/config/Makefile `links`) ──
|
|
BIN="$ARCHIE_HOME/bin"
|
|
ln -sf telnet-client "$BIN/-telnet-client" 2>/dev/null || true
|
|
ln -sf arserver "$BIN/arexchange" 2>/dev/null || true
|
|
ln -sf arserver "$BIN/arretrieve" 2>/dev/null || true
|
|
ln -sf update_anonftp "$BIN/update_webindex" 2>/dev/null || true
|
|
|
|
# ── /pfs symlink — Prospero dirsrv expects /pfs to exist ────────
|
|
if [ ! -e /pfs ]; then
|
|
ln -sf "$ARCHIE_HOME/pfs" /pfs
|
|
fi
|
|
|
|
# ── initial database skeleton ────────────────────────────────────
|
|
# db.tar.init contains the empty NDBM files archie needs to start
|
|
if [ ! -f "$ARCHIE_HOME/db/host_db/host-db.dir" ]; then
|
|
tar xf "$ARCHIE_HOME/tmp/db.tar.init" -C "$ARCHIE_HOME"
|
|
fi
|
|
|
|
# ── ownership ────────────────────────────────────────────────────
|
|
chown -R "$ARCHIE_USER:$ARCHIE_GROUP" "$ARCHIE_HOME"
|
|
chmod 750 "$ARCHIE_HOME"
|
|
|
|
# ── setuid binaries ──────────────────────────────────────────────
|
|
# telnet-client: needs setuid root to bind privileged ports
|
|
chown root:root "$BIN/telnet-client"
|
|
chmod 4111 "$BIN/telnet-client"
|
|
|
|
# pstart: setuid+setgid root so any user can start/restart dirsrv
|
|
chown root:root "$BIN/pstart"
|
|
chmod 6111 "$BIN/pstart"
|
|
|
|
# cgi-client: setuid archie so the web server can access the DB
|
|
chown "$ARCHIE_USER:$ARCHIE_GROUP" "$ARCHIE_HOME/cgi/bin/cgi-client"
|
|
chmod 4755 "$ARCHIE_HOME/cgi/bin/cgi-client"
|
|
|
|
# ── permissions from release/base/config/Makefile ────────────────
|
|
chmod 662 "$ARCHIE_HOME/logs/email.log"
|
|
chmod 1777 "$ARCHIE_HOME/tmp"
|
|
chmod 1777 "$ARCHIE_HOME/db/tmp" 2>/dev/null || true
|
|
chmod o+rx "$ARCHIE_HOME/db"
|
|
|
|
# ── systemd units ────────────────────────────────────────────────
|
|
if [ -d "$SYSTEMD_SYSTEM" ]; then
|
|
for unit in "$ARCHIE_HOME/lib/systemd/system"/archie-*.service \
|
|
"$ARCHIE_HOME/lib/systemd/system"/archie-*.socket \
|
|
"$ARCHIE_HOME/lib/systemd/system"/archie-*.timer; do
|
|
[ -f "$unit" ] || continue
|
|
ln -sf "$unit" "$SYSTEMD_SYSTEM/$(basename "$unit")"
|
|
done
|
|
fi
|
|
if [ -d /run/systemd/system ]; then
|
|
systemctl daemon-reload
|
|
systemctl enable archie-dirsrv.service || true
|
|
systemctl enable archie-arserver.socket || true
|
|
systemctl enable archie-arcontrol.timer || true
|
|
systemctl enable archie-web.service || true
|
|
fi
|
|
;;
|
|
esac
|
|
|
|
exit 0
|