1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-04 22:33:27 +00:00
freebsd-ports/japanese/dserver/files/setup.sh.standalone

84 lines
2.4 KiB
Plaintext
Raw Normal View History

#!/bin/sh
echo "You have to do 4 things before using dserver."
echo "1. Add 'ndtp 2010/tcp' to /etc/services."
echo "2. Add startup command of dserver to PREFIX_DIR/etc/rc.d/"
echo "3. Add startup configration of mule-client to site-start.el."
echo "4. 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
# Add startup shell script to PREFIX_DIR/etc/rc.d
echo
echo "Adding startup shell script to PREFIX_DIR/etc/rc.d/"
echo "Do you like to add startup shell script automatically? (y/n) [y]" ;
(echo "#!/bin/sh" ;
echo "# dserver - dictionary server" ;
echo "case \"\$1\" in" ;
echo "start)" ;
echo " if [ -x PREFIX_DIR/lib/dserver/dserver ] ; then" ;
echo " PREFIX_DIR/lib/dserver/dserver &" ;
echo " echo -n ' dserver'" ;
echo " fi" ;
echo " ;;" ;
echo "stop)" ;
echo " ;;" ;
echo "*)" ;
echo " echo \"Usage: `basename $0` {start|stop}\" >&2" ;
echo " exit 64" ;
echo " ;;" ;
echo "esac" ;
echo "" ;
echo "exit 0") > /tmp/dserver.sh
read ans;
case x${ans} in
xn*|xN*)
echo "Do you like to edit PREFIX_DIR/etc/rc.d/dserver.sh file by yourself? (y/n) [y]" ;
read choice ;
case x${choice} in
xn*|xN*)
echo "Okay, do nothing."
echo "rm /tmp/dserver.sh"
;;
*)
echo "Edit dserver.sh file by yourself (Press Return)";
read dummy;
vi /tmp/dserver.sh;
cp /tmp/dserver.sh PREFIX_DIR/etc/rc.d/
chmod 755 PREFIX_DIR/etc/rc.d/dserver.sh
rm /tmp/dserver.sh
;;
esac
;;
*)
cp /tmp/dserver.sh PREFIX_DIR/etc/rc.d/
chmod 755 PREFIX_DIR/etc/rc.d/dserver.sh
rm /tmp/dserver.sh
echo "dserver.sh is added to PREFIX_DIR/etc/rc.d/"
esac
echo "Now startup configuration is done."
echo "Remember to mount cdrom to PREFIX_DIR/share/dict/cdrom."