#!/bin/sh echo "You have to do 5 things before using dserver via inetd." echo "1. Add 'ndtp 2010/tcp' to /etc/services." echo "2. Add 'ndtp stream tcp nowait root /usr/local/lib/dserver dserver'" echo " to /etc/inetd.conf" echo "3. Add startup configration of mule-client to site-start.el." echo "4. Restart inetd by 'kill -HUP `cat /var/run/inetd.pid`'." echo "5. Mount cdrom (or copy files) to PREFIX_DIR/share/dict/cdrom/." # Hack /etc/services echo echo "Updating /etc/services"; cp /etc/services /etc/services.bak; (grep -v ndtp /etc/services.bak ; echo "ndtp 2010/tcp # Network Dictionary Transfer Protocol") > /tmp/services echo "Do you like to update /etc/services automatically? (y/n) [y]" ; read ans; case x${ans} in xn*|xN*) echo "Do you like to change /etc/services file by yourself? (y/n) [y]" ; read choice ; case x${choice} in xn*|xN*) echo "Okay, do nothing.";; *) echo "Edit /etc/services file by yourself (Press Return)"; read dummy; vi -c /ndtp /tmp/services; cp /tmp/services /etc/services; rm /tmp/services ;; esac ;; *) echo "original file is saved in /etc/services.bak" ; cp /tmp/services /etc/services; rm /tmp/services ;; esac # Hack /etc/inetd.conf echo echo "Updating /etc/inetd.conf"; cp /etc/inetd.conf /etc/inetd.conf.bak; (grep -v ndtp /etc/inetd.conf.bak ; echo "ndtp stream tcp nowait root /usr/local/lib/dserver/dserver dserver") > /tmp/inetd.conf echo "Do you like to update /etc/inetd.conf automatically? (y/n) [y]" ; read ans; case x${ans} in xn*|xN*) echo "Do you like to change /etc/inetd.conf file by yourself? (y/n) [y]" ; read choice ; case x${choice} in xn*|xN*) echo "Okay, do nothing.";; *) echo "Edit /etc/inetd.conf file by yourself (Press Return)"; read dummy; vi -c /ndtp /tmp/inetd.conf; cp /tmp/inetd.conf /etc/inetd.conf; rm /tmp/inetd.conf ;; esac ;; *) echo "original file is saved in /etc/inetd.conf.bak" ; cp /tmp/inetd.conf /etc/inetd.conf; rm /tmp/inetd.conf ;; esac echo "Do you want to restart inetd right now? (y/n) [y]" ; read ans; case x${ans} in xn*|xN*) echo "Remember to restart inetd (or reboot)." ;; *) echo "Restart inetd." kill -HUP `cat /var/run/inetd.pid` ;; esac echo "Now startup configuration is done." echo "Remember to mount cdrom to PREFIX_DIR/share/dict/cdrom."