summaryrefslogtreecommitdiff
path: root/japanese/dserver/files/setup.sh.inetd
blob: 43e9aaff3bcb34ab93b44d6d11982da3e1e68fef (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#!/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/dict/dserver/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

# Hack PREFIX_DIR/lib/mule/site-lisp/site-start.el
rm -f /tmp/hack-site-start.el
echo "(defun hack-site-start ()" >> /tmp/hack-site-start.el
echo "  (interactive)" >> /tmp/hack-site-start.el
echo "  (message \"Updating site-start.el.  \")" >> /tmp/hack-site-start.el
echo "  (let* ((args command-line-args-left)" >> /tmp/hack-site-start.el
echo "	 (fname (expand-file-name (nth 0 args)))" >> /tmp/hack-site-start.el
echo "	 (dir (nth 1 args)))" >> /tmp/hack-site-start.el
echo "    (setq command-line-args-left (cdr (cdr command-line-args-left)))" >> /tmp/hack-site-start.el
echo "    (set-buffer (get-buffer-create \" *x*\"))" >> /tmp/hack-site-start.el
echo "    (erase-buffer)" >> /tmp/hack-site-start.el
echo "    (if (file-exists-p fname)" >> /tmp/hack-site-start.el
echo "	(insert-file-contents fname))" >> /tmp/hack-site-start.el
echo "    (goto-char (point-min))" >> /tmp/hack-site-start.el
echo "    (if (search-forward \";;; diclookup-mule: Online dictionary\" nil t)" >> /tmp/hack-site-start.el
echo "	(message \"No changes made.\")" >> /tmp/hack-site-start.el
echo "      (goto-char (point-max))" >> /tmp/hack-site-start.el
echo "      (insert \"\n;;; diclookup-mule: Online dictionary\n\")" >> /tmp/hack-site-start.el
echo "      (insert \"(autoload 'online-dictionary \\\"diclookup-mule\\\" \")" >> /tmp/hack-site-start.el
echo "      (insert \"\\\"Online dictionary.\\\" t nil)\n\")" >> /tmp/hack-site-start.el
echo "      (insert \"(autoload 'od:lookup-pattern-edit \\\"diclookup-mule\\\" \")" >> /tmp/hack-site-start.el
echo "      (insert \"\\\"Look up a word.\\\" t nil)\n\")" >> /tmp/hack-site-start.el
echo "      (insert \"(setq od-chujiten-flag t)	; diclookup-mule\n\")" >> /tmp/hack-site-start.el
echo "      (insert \"(setq od-dictfile-list '(\\\"od-chujiten\\\" \\\"od-kojien\\\" \\\"od-readers\\\" \\\"od-crown\\\")) \")" >> /tmp/hack-site-start.el
echo "      (insert \"; diclookup-mule\n\")" >> /tmp/hack-site-start.el
echo "      (insert \"(setq dserver-server-list '(\\\"localhost\\\")) ; diclookup-mule\n\")" >> /tmp/hack-site-start.el
echo "      (insert \"(setq od-frame-geometry \\\"+0-0\\\" od-hide-frame \")" >> /tmp/hack-site-start.el
echo "      (insert \"'make-invisible) ; diclookup-mule\n\")" >> /tmp/hack-site-start.el
echo "      (insert \"(add-hook 'od-really-quit-hook 'od-delete-frame) \")" >> /tmp/hack-site-start.el
echo "      (insert \"; diclookup-mule\n\")" >> /tmp/hack-site-start.el
echo "      (insert \"(define-key-after menu-bar-file-menu [dictionary] \")" >> /tmp/hack-site-start.el
echo "      (insert \"; diclookup-mule\n\")" >> /tmp/hack-site-start.el
echo "      (insert \"	'(\\\"Online Dictionary\\\" . online-dictionary) 'calendar) \")" >> /tmp/hack-site-start.el
echo "      (insert \"; diclookup-mule\n\")" >> /tmp/hack-site-start.el
echo "      (write-file fname))))" >> /tmp/hack-site-start.el

# Hack site-start.el
echo
echo "Updating PREFIX_DIR/lib/mule/site-lisp/site-start.el"; 
cp PREFIX_DIR/lib/mule/site-lisp/site-start.el PREFIX_DIR/lib/mule/site-lisp/site-start.el.bak

echo "Do you like to update site-start.el automatically? (y/n) [y]" ;
read ans;
case x${ans} in
	xn*|xN*)
	echo "Do you like to change site-start.el file by yourself?(y/n) [y]" ;
	read choice ;
	case x${choice} in 
		xn*|xN*)
		echo "Okay, Do nothing." 
		rm -f PREFIX_DIR/lib/mule/site-lisp/site-start.el.bak ;;
		*)
		 mule -batch -q -l /tmp/hack-site-start.el -f hack-site-start \
			PREFIX_DIR/lib/mule/site-lisp/site-start.el ;
		echo "Edit site-start.el file by yourself (Press Return)";
		read dummy; 
		vi -c /diclookup PREFIX_DIR/lib/mule/site-lisp/site-start.el ;
		echo "original file is saved in PREFIX_DIR/lib/mule/site-lisp/site-start.el.bak";;
		esac;;
	*) 
	 mule -batch -q -l /tmp/hack-site-start.el -f hack-site-start \
		PREFIX_DIR/lib/mule/site-lisp/site-start.el ;
	echo "original file is saved in PREFIX_DIR/lib/mule/site-lisp/site-start.el.bak" ;;
esac
rm -f /tmp/hack-site-start.el

echo "Now startup configuration is done."
echo "Remember to mount cdrom to PREFIX_DIR/dict/dserver/cdrom."