Files
archie/scripts/archie.shell
Mario Fetka 1e4baef047 Port Archie 3.5 to Linux/CMake, add Debian packaging and CI
- 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>
2026-06-22 23:05:12 +02:00

116 lines
2.8 KiB
Bash
Executable File

#!/bin/sh
# This script written by Jim Martin, Rutgers University (jim@rutgers.edu)
#
# Modified by Alan Emtage, Bunyip Information Systems (bajan@bunyip.com)
# Modified by Luc Boulianne, Bunyip Information Systems (lucb@bunyip.com)
# Modified by Andreas Liebe for Solaris <liebe@hrz.th-darmstadt.de>
# Modified by Lee McLoughlin for Solaris 2.3 and for security <lmjm@doc.ic.ac.uk>
# DONT let the user interrupt me to try and get a shell
trap "kill -HUP 0" 1 2 3 15
#
# Set the maximum number of interactive sessions here
#
max=10
# define this to specify a file to print before going into telnet-client
# this is useful if dirsrv looses the MOTD.
motd=$HOME/etc/motd
# Set the nice level (priority) here. It must be >= 0
#
nicelevel=0
# define this if you want to warn the user about reaching the wrong
# host. You will also need to update the message below.
host=`uname -n`
prog=$0
fatal()
{
echo ""
echo "${prog}: $1"
exit 1
}
get_home()
{
if [ $# -ne 1 ] ; then
fatal "get_home: bad number of arguments"
fi
if p=$(getent passwd "$1") ; then
echo "$p" | awk -F: '{print $6}'
else
fatal "get_home: can't find home directory for $1"
fi
}
HOME=`get_home ${LOGNAME:-\`whoami\`}`
#stty new crt erase "^?" kill "^u" echo intr "^c"
#stty crt erase "^?" kill "^u" echo intr "^c"
stty erase "^?" kill "^u" echo intr "^c"
case "$fixing" in
'') ;;
*)
echo "working on archie - please try again later or try one of:"
cat $HOME/etc/serverlist
echo The current time is `date`
sleep 5
exit 0
esac
# # Tailor this if required.
# case "$host" in
# '') ;;
# phoenix.*)
# ;;
# *)
# echo "You must be running old nameserver software"
# echo "archie.doc.ic.ac.uk should now get you to:"
# echo " phoenix.doc.ic.ac.uk [146.169.2.10]"
# echo "please check with your local administrators about this"
# sleep 6
# exit 0
# ;;
# esac
# Count active telnet-client sessions via systemd or ps
if command -v systemctl >/dev/null 2>&1 ; then
sofar=$(systemctl list-units 'archie-arserver@*.service' --no-legend 2>/dev/null | wc -l)
else
sofar=$(ps aux | grep '[t]elnet-client' | wc -l)
fi
#
# The message that you want displayed should be set here after the
# ALL ARCHIE SESSIONS IN USE message and before the _end_
#
if [ $sofar -gt $max ]; then
cat <<_end_
ALL ARCHIE SESSIONS IN USE
I'm sorry. This archie server is currently at the limit of its
interactive login sessions. Please use another archie server or try again
later.
-archie administration
_end_
echo "So far $sofar > $max (max)"
cat $HOME/etc/serverlist
echo The current time is `date`
sleep 5
exit 0
fi
case "$motd" in
'') ;;
*)
if [ -r $motd ]; then
cat $motd
fi
;;
esac
exec nice -$nicelevel $HOME/bin/telnet-client -s