2 # an installation script for ebnetd
8 local question default answer
13 if [ -z "${PACKAGE_BUILDING}" -a x${BATCH} = xno ]; then
14 read -p "${question} (y/n) [${default}]? " answer
15 [ "${answer}" ] && default=${answer}
21 local question default
27 case `ask "${question}" ${default}` in
31 echo "Please answer yes or no."
41 sed 's/#.*//' ${file} | grep -qw ${entry}
52 if check ${file} ${item}; then
62 local oldfile newfile entry port comment
69 if check ${file} ${entry}; then
71 elif sed 's/#.*//' ${file} | grep -qw ${port} ; then
74 tmpfile=`mktemp -q /tmp/${basename}.XXXXXX`
76 echo "Can't create temp file" 1>&2
81 sed 's,^\([^#]*[ ]'${port}'\),\1 '${entry}, ${tmpfile} > ${file}
86 echo "${entry} ${port} #${comment}" >> ${file}
90 [ "$2" = POST-INSTALL ] || exit 0
93 # Add entries for EBNETD (`ebnet' and `ndtp') to /etc/services.
97 entrylist='ebnet ndtp'
100 comment_ebnet='EBNET Protocol'
103 comment_ndtp='Network Dictionary Transfer Protocol'
105 echo "************************************************************************"
106 if checkall ${file} ${entrylist}; then
107 echo "This system has already all entries for EBNETD in ${file}."
109 echo "This system doesn't have some of entries for EBNETD in ${file}."
110 if yesno " Would you like to add them automatically?" y; then
111 cp -f ${file} ${back}
112 echo " The original file is saved as ${back}."
113 add ${file} ${entry_ebnet} ${port_ebnet} ${comment_ebnet}
114 add ${file} ${entry_ndtp} ${port_ndtp} ${comment_ndtp}
117 echo "************************************************************************"