. . Make this port act more like a standard FreeBSD port:

. Don't install everything in ${PREFIX}/dgd instead place the
    executables, docs and configuration in the standard places and
    place the mudlib in DATADIR.
  . Don't use the packing list as a list of things to install.
  . Fix up the configuration file to point to the install locations.
  . Add a sample rc script which can be used to start and stop dgd
    with this mudlib (need a 5.x RCng version as well).
  . Create a user to run the dgd service as (this is the same user
    as used by the net/dgd port).
  . More standard Makefile.
  . Add a post-extract target which removes the need for do-build.
  . Add a do-configure target and remove the obsolete configure script.
. Remove devel from CATEGORIES, it really doesn't belong.  This port
  should really just be in games, but thats another story.
. Catch up dependencies with changes to net/dgd.
This commit is contained in:
Greg Lewis 2003-08-29 18:40:03 +00:00
parent f88f85d65e
commit 617878070a
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=87998
7 changed files with 807 additions and 714 deletions

View file

@ -7,37 +7,63 @@
PORTNAME= dgd-lpmud
PORTVERSION= 2.4.5
CATEGORIES= net devel games
PORTREVISION= 1
CATEGORIES= net games
MASTER_SITES= ftp://ftp.lysator.liu.se/pub/lpmud/drivers/dgd/lpc/ \
${MASTER_SITE_LOCAL:S|%SUBDIR%|glewis/dgd|}
DISTFILES= 2.4.5-for-1.1.tgz
DISTNAME= 2.4.5-for-1.1
EXTRACT_SUFX= .tgz
MAINTAINER= glewis@FreeBSD.org
COMMENT= LPmud mudlib, for use with DGD
RUN_DEPENDS= ${LOCALBASE}/sbin/dgd:${PORTSDIR}/net/dgd
NO_PACKAGE= "depends on DGD, which is NO_CDROM"
RESTRICTED= "no monetary gain, tarball OK for CDROM"
RUN_DEPENDS= ${PREFIX}/dgd/bin/driver:${PORTSDIR}/net/dgd
DIST_SUBDIR= dgd
WRKSRC= ${WRKDIR}/mud
PLIST_SUB+= EXTRA:=""
USE_REINPLACE= yes
do-build:
@cd ${WRKDIR}/mud/bin; make
CPIO?= /usr/bin/cpio
post-extract:
@${CP} ${FILESDIR}/oconv.c ${WRKSRC}/
@${CP} ${FILESDIR}/Makefile.bin ${WRKSRC}/Makefile
do-configure:
${REINPLACE_CMD} -e "s:%%DATADIR%%:${DATADIR}:" ${WRKSRC}/lpmud.dgd
do-install:
@${TAR} -C ${WRKSRC} -cf - `${GREP} '^[a-z]' ${PLIST} | ${CUT} -f2- -d'/'` \
| ${TAR} -C ${PREFIX}/dgd -xpf -
@${INSTALL_DATA} ${WRKSRC}/lpmud-2.4.5/ACCESS.ALLOW \
${PREFIX}/dgd/lpmud-2.4.5/ACCESS.ALLOW.example
@${INSTALL_DATA} ${WRKSRC}/lpmud-2.4.5/ACCESS.DENY \
${PREFIX}/dgd/lpmud-2.4.5/ACCESS.DENY.example
@${MKDIR} ${PREFIX}/dgd/lpmud-2.4.5/log
@${MKDIR} ${PREFIX}/dgd/lpmud-2.4.5/open
@${MKDIR} ${PREFIX}/dgd/lpmud-2.4.5/players/lars/lars
@${MKDIR} ${PREFIX}/dgd/lpmud-2.4.5/room/post_dir
@${MKDIR} ${PREFIX}/dgd/tmp
${INSTALL_PROGRAM} ${WRKSRC}/hname ${PREFIX}/bin/lpmud-hname
${INSTALL_PROGRAM} ${WRKSRC}/oconv ${PREFIX}/bin/lpmud-oconv
${MKDIR} ${PREFIX}/etc/${PORTNAME}
${INSTALL_DATA} ${WRKSRC}/lpmud.dgd ${PREFIX}/etc/${PORTNAME}/
${MKDIR} ${DATADIR}/lpmud
cd ${WRKSRC}/2.4.5 && ${FIND} . \
| ${CPIO} -pdmu -R ${SHAREOWN}:${SHAREGRP} ${DATADIR}/lpmud
# Install an RC script for dgd-lpmud
${CAT} ${FILESDIR}/dgd-lpmud.sh | ${SED} -e "s:%%PREFIX%%:${PREFIX}:" \
-e "s:%%DATADIR%%:${DATADIR}:" > \
${PREFIX}/etc/rc.d/dgd-lpmud.sh.sample
${CHMOD} a+x ${PREFIX}/etc/rc.d/dgd-lpmud.sh.sample
${MV} ${DATADIR}/lpmud/ACCESS.ALLOW \
${DATADIR}/lpmud/ACCESS.ALLOW.example
${MV} ${DATADIR}/lpmud/ACCESS.DENY \
${DATADIR}/lpmud/ACCESS.DENY.example
.if !defined(NOPORTDOCS)
${MKDIR} ${DOCSDIR}
${INSTALL_DATA} ${WRKSRC}/README ${DOCSDIR}
.endif
post-install:
# Need a temporary directory for certain files
${MKDIR} ${DATADIR}/tmp
# Link in the dgd docs
${LN} -sf ${PREFIX}/share/doc/dgd/kfun ${DATADIR}/lpmud/doc
# Run package install script
${SETENV} PKG_PREFIX=${PREFIX} ${SH} ${PKGDIR}/pkg-install ${PKGNAME} \
POST-INSTALL
.include <bsd.port.mk>

View file

@ -0,0 +1,33 @@
#!/bin/sh
# $FreeBSD$
DGD_CONF=%%PREFIX%%/etc/dgd-lpmud/lpmud.dgd
DGD_USER=mud
DGD=%%PREFIX%%/sbin/dgd
DGD_HNAME=%%PREFIX%%/bin/lpmud-hname
DGD_HNAME_PORT=6047
DGD_HNAME_PASSWD=HNAMEPASS
DGD_LOG=%%DATADIR%%/lpmud/log/lpmud.log
DGD_PID=/var/run/dgd-lpmud.pid
case "$1" in
start)
if [ -x "${DGD}" ]; then
su ${DGD_USER} -c "${DGD_HNAME} ${DGD_HNAME_PORT} ${DGD_HNAME_PASSWD}" > /dev/null 2>&1 &
sleep 1
su ${DGD_USER} -c "${DGD} ${DGD_CONF}" >> "${DGD_LOG}" 2>&1 &
echo $(($!+1)) > "${DGD_PID}"
echo -n ' dgd-lpmud'
fi
;;
stop)
kill -TERM `cat "${DGD_PID}"` && rm -f "${DGD_PID}"
killall -TERM lpmud-hname
;;
*)
echo ""
echo "Usage: `basename $0` { start | stop }"
echo ""
exit 64
;;
esac

View file

@ -1,46 +1,17 @@
$FreeBSD$
*** rundgd.old Thu Jan 16 03:13:15 1997
--- rundgd Thu Jan 16 03:28:42 1997
***************
*** 1,10 ****
#!/bin/sh
passwd=HNAMEPASS
while true
do
! mv 2.4.5/lpmud.log 2.4.5/lpmud.log.old
! date > 2.4.5/lpmud.log
! hname 6047 $passwd &
! driver lpmud.dgd >> 2.4.5/lpmud.log 2>&1
done > /dev/null 2>&1
--- 1,11 ----
#!/bin/sh
+ dgd=%%PREFIX%%/dgd
+ cd $dgd/lpmud-2.4.5
passwd=HNAMEPASS
while true
do
! mv lpmud.log lpmud.log.old
! date > lpmud.log
! $dgd/bin/hname 2000 $passwd &
! $dgd/bin/driver $dgd/lpmud.dgd >> lpmud.log 2>&1
done > /dev/null 2>&1
*** lpmud.dgd.old Thu Jan 16 03:10:34 1997
--- lpmud.dgd Thu Jan 16 03:13:00 1997
***************
*** 1,6 ****
telnet_port = 2000; /* telnet port number */
binary_port = 1999; /* binary port number */
! directory = "/usr/local/mud/2.4.5";/* base directory (MUST be absolute) */
users = 40; /* max # of users */
editors = 41; /* max # of editor sessions */
ed_tmpfile = "../tmp/ed"; /* proto editor tmpfile */
--- 1,6 ----
telnet_port = 2000; /* telnet port number */
binary_port = 1999; /* binary port number */
! directory = "%%PREFIX%%/dgd/lpmud-2.4.5";/* base directory (MUST be absolute) */
users = 40; /* max # of users */
editors = 41; /* max # of editor sessions */
ed_tmpfile = "../tmp/ed"; /* proto editor tmpfile */
--- lpmud.dgd.orig Thu Dec 12 17:57:25 1996
+++ lpmud.dgd Thu Aug 28 14:52:40 2003
@@ -1,10 +1,10 @@
telnet_port = 2000; /* telnet port number */
binary_port = 1999; /* binary port number */
-directory = "/usr/local/mud/2.4.5";/* base directory (MUST be absolute) */
+directory = "%%DATADIR%%/lpmud";/* base directory (MUST be absolute) */
users = 40; /* max # of users */
editors = 41; /* max # of editor sessions */
ed_tmpfile = "../tmp/ed"; /* proto editor tmpfile */
-swap_file = "../tmp/swap"; /* swap file */
+swap_file = "../tmp/dgd-lpmud.swap";/* swap file */
swap_size = 20960; /* # sectors in swap file */
cache_size = 100; /* # sectors in swap cache */
sector_size = 1024; /* swap sector size */

View file

@ -0,0 +1,15 @@
#!/bin/sh
# $FreeBSD$
#
if [ "$2" != "POST-DEINSTALL" ]; then
exit 0
fi
USER=mud
if pw usershow "${USER}" 2>/dev/null 1>&2; then
echo "To delete MUD user permanently, use 'pw userdel \"${USER}\"'"
fi
exit 0

49
net/dgd-lpmud/pkg-install Normal file
View file

@ -0,0 +1,49 @@
#!/bin/sh
# $FreeBSD$
if [ "$2" = "PRE-INSTALL" ]; then
exit 0
fi
PATH=/bin:/sbin:/usr/bin:/usr/sbin
USER=mud
GROUP=${USER}
UID=91
GID=${UID}
if [ -z "${DATADIR}" ]; then
DATADIR=${PKG_PREFIX}/share/dgd-lpmud
fi
if [ ! -d "${DATADIR}" ]; then
echo -n "Attempting to create ${DATADIR} ..."
mkdir -p "${DATADIR}"
echo "done"
fi
if pw groupshow "${GROUP}" 2>/dev/null; then
echo "Using existing group \"${GROUP}\"."
else
if pw groupadd "${GROUP}" -g ${GID}; then
echo "Added group \"${GROUP}\"."
else
echo "Adding group \"${GROUP}\" failed..."
exit 1
fi
fi
if pw usershow "${USER}" 2>/dev/null; then
echo "Using existing user \"${USER}\"."
else
if pw useradd "${USER}" -u ${UID} -g "${GROUP}" -h - \
-s "/bin/sh" -d "${DATADIR}" -c "MUD Owner"
then
echo "Added user \"${USER}\"."
else
echo "Adding user \"${USER}\" failed..."
exit 1
fi
fi
chown -R "${USER}:${GROUP}" "${DATADIR}"

File diff suppressed because it is too large Load diff

View file

@ -1,18 +0,0 @@
#!/bin/sh
#
# $FreeBSD$
cd ${WRKDIR}/mud
mv 2.4.5 lpmud-2.4.5
mv rundgd runlpmud
ln -s ${PREFIX}/dgd/doc/kfun lpmud-2.4.5/doc
mkdir -p tmp bin; mv hname.c bin
cp ${FILESDIR}/oconv.c bin
cp ${FILESDIR}/Makefile.bin bin/Makefile
FILES_PREFIX="lpmud.dgd runlpmud"
for f in $FILES_PREFIX; do
mv ${WRKSRC}/${f} ${WRKSRC}/$f.bak && sed <${WRKSRC}/${f}.bak \
s+%%PREFIX%%+${PREFIX}+g >${WRKSRC}/${f}
done