pkg-descr

This EBNETD distribution contains three server commands: ebnetd, ndtpd
and ebhttpd. They are servers for accessing CD-ROM book on remote host
via TCP/IP.

ebnetd: ebnetd is a server of EBNET protocol which is designed to
communicate with EB Library. For more details about EB
Library, see http://www.sra.co.jp/m-kasahr/eb/.

ndtpd: ndtpd is an NDTP (Network Dictionary Transfer Protocol)
server. The first implementation of the NDTP esrver is
`dserver'. ndtpd has upper compatibility with dserver-2.2.

ebhttpd: ebhttpd is a WWW (World Wide Web) server. It supprts HTTP/1.0
and HTTP/1.1 (Hypertext Transfer Protocol version 1.0 and 1.1).

The servers support CD-ROM books of EB, EBG, EBXA, EBXA-C, S-EBXA and
EPWING formats. The servers can run as a standalone daemons by
default, but can also run as children of `inetd'.

In addition, you must follow the licenses of your CD-ROM books. Though
EBNETD is free software, your books may not be free. Don't open your
books to unlicensed hosts nor users.

Author: Motoyuki Kasahara
WWW: http://www.sra.co.jp/people/m-kasahr/ebnetd/

pkg-install

#!/bin/sh -
# an installation script for ebnetd

BATCH=${BATCH:=no}
basename=`basename $0`

ask() {
local question default answer

question=$1
default=$2

if [ -z "${PACKAGE_BUILDING}" -a x${BATCH} = xno ]; then
read -p "${question} (y/n) [${default}]? " answer
[ "${answer}" ] && default=${answer}
fi
echo ${default}
}

yesno() {
local question default

question=$1
default=$2

while :; do
case `ask "${question}" ${default}` in
[Yy]*) return 0;;
[Nn]*) return 1;;
esac
echo "Please answer yes or no."
done
}

check() {
local file entry

file=$1
entry=$2

sed 's/#.*//' ${file} | grep -qw ${entry}
}

checkall() {
local file list item

file=$1
shift
list=$*

for item in $list; do
if check ${file} ${item}; then
:
else
return 1
fi
done
return 0
}

add() {
local oldfile newfile entry port comment

file=$1
entry=$2
port=$3
comment=$4

if check ${file} ${entry}; then
:
elif sed 's/#.*//' ${file} | grep -qw ${port} ; then
oldumask=`umask`
umask 0077
tmpfile=`mktemp -q /tmp/${basename}.XXXXXX`
if [ $? -ne 0 ]; then
echo "Can't create temp file" 1>&2
exit 1
fi
cp $file $tmpfile
trap '' 1 2 15
sed 's,^\([^#]*[ ]'${port}'\),\1 '${entry}, ${tmpfile} > ${file}
trap 1 2 15
rm $tmpfile
umask $oldumask
else
echo "${entry} ${port} #${comment}" >> ${file}
fi
}

[ "$2" = POST-INSTALL ] || exit 0

#
# Add entries for EBNETD (`ebnet' and `ndtp') to /etc/services.
#
file=/etc/services
back=${file}.bak
entrylist='ebnet ndtp'
entry_ebnet=ebnet
port_ebnet=22010/tcp
comment_ebnet='EBNET Protocol'
entry_ndtp=ndtp
port_ndtp=2010/tcp
comment_ndtp='Network Dictionary Transfer Protocol'

echo "************************************************************************"
if checkall ${file} ${entrylist}; then
echo "This system has already all entries for EBNETD in ${file}."
else
echo "This system doesn't have some of entries for EBNETD in ${file}."
if yesno " Would you like to add them automatically?" y; then
cp -f ${file} ${back}
echo " The original file is saved as ${back}."
add ${file} ${entry_ebnet} ${port_ebnet} ${comment_ebnet}
add ${file} ${entry_ndtp} ${port_ndtp} ${comment_ndtp}
fi
fi
echo "************************************************************************"

exit 0

pkg-message

**********************************************************************
You'll need manual configurations to actually activate EBNETD servers.

Step 0(optional):
If you want to setup private syslog, edit /etc/syslog.conf.

Step 1:
Copy a sample configuration file `ebnetd.conf.sample' to `ebnetd.conf'
in `${PREFIX}/etc' directory, and edit it. Consult the "Configuration
File" section of info file.

Step 2a:
To start EBNETD servers as standalone daemons, add the following lines
to /etc/rc.conf:
ebhttpd_enable (bool): Set to "NO" by default.
Set it to "YES" to enable ebhttpd.
ebhttpd_flags (str): Set to "" by default.
Extra flags passed to start ebhttpd.
ebnetd_enable (bool): Set to "NO" by default.
Set it to "YES" to enable ebnetd.
ebnetd_flags (str): Set to "" by default.
Extra flags passed to start ebnetd.
ndtpd_enable (bool): Set to "NO" by default.
Set it to "YES" to enable ndtpd.
ndtpd_flags (str): Set to "" by default.
Extra flags passed to start ndtpd.

Step 2b:
To start EBNETD servers as child processes of 'inetd', edit
/etc/inetd.conf. Consult the "Run `xxxx' as a child of `inetd'"
sections of info file.
**********************************************************************

pkg-plist

@comment $FreeBSD: ports/japanese/ebnetd/pkg-plist,v 1.10 2006/05/22 11:33:31 jmelo Exp $
etc/ebnetd.conf.sample
etc/rc.d/ebnetd.sh
libexec/ebhtstat
libexec/ebnstat
libexec/ndtpstat
sbin/ebhtcheck
sbin/ebhtcontrol
sbin/ebhttpd
sbin/ebncheck
sbin/ebncontrol
sbin/ebndaily
sbin/ebnetd
sbin/ebnupgrade
sbin/ndtpcheck
sbin/ndtpcontrol
sbin/ndtpd
@exec /bin/mkdir -m 0755 -p /var/run/ebnetd
@dirrmtry /var/run/ebnetd