1994-11-25 18:23:01 +00:00
|
|
|
#!/bin/sh
|
1997-09-19 09:34:33 +00:00
|
|
|
# an installation script for Wnn4.2
|
|
|
|
|
|
|
|
check_pw()
|
|
|
|
{
|
|
|
|
if which -s pw; then
|
|
|
|
:
|
|
|
|
else
|
|
|
|
cat <<EOF
|
|
|
|
|
|
|
|
This system looks like a pre-2.2 version of FreeBSD. We see that it
|
|
|
|
is missing the "pw" utility. We need this utility. Please get and
|
|
|
|
install it, and try again. You can get the source from:
|
|
|
|
|
|
|
|
ftp://ftp.freebsd.org/pub/FreeBSD/FreeBSD-current/src/usr.sbin/pw.tar.gz
|
|
|
|
|
|
|
|
EOF
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
ask() {
|
|
|
|
local question default answer
|
|
|
|
|
|
|
|
question=$1
|
|
|
|
default=$2
|
|
|
|
if [ -z "${PACKAGE_BUILDING}" ]; then
|
|
|
|
read -p "${question} (y/n) [${default}]? " answer
|
|
|
|
fi
|
|
|
|
if [ x${answer} = x ]; then
|
|
|
|
answer=${default}
|
|
|
|
fi
|
|
|
|
echo ${answer}
|
|
|
|
}
|
|
|
|
|
|
|
|
yesno() {
|
|
|
|
local dflt question answer
|
|
|
|
|
|
|
|
question=$1
|
|
|
|
dflt=$2
|
|
|
|
while :; do
|
|
|
|
answer=$(ask "${question}" "${dflt}")
|
|
|
|
case "${answer}" in
|
|
|
|
[Yy]*) return 0;;
|
|
|
|
[Nn]*) return 1;;
|
|
|
|
esac
|
|
|
|
echo "Please answer yes or no."
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
case $2 in
|
|
|
|
PRE-INSTALL)
|
|
|
|
|
|
|
|
## Hack /etc/master.passwd ##
|
|
|
|
# check
|
|
|
|
id_69=`id -u 69 2> /dev/null`
|
|
|
|
id_wnn=`id -u wnn 2> /dev/null`
|
|
|
|
if [ X"$id_wnn" != X ];then
|
|
|
|
exit 0
|
|
|
|
elif [ X"$id_69" != X ]; then
|
1997-09-23 02:18:00 +00:00
|
|
|
cat <<EOF
|
1997-09-19 09:34:33 +00:00
|
|
|
|
|
|
|
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
|
|
This system already has an account whose name is not 'wnn' and ID
|
|
|
|
number is 69.
|
|
|
|
|
|
|
|
'`id 69`'
|
|
|
|
|
|
|
|
For Wnn4.2 in this port or package, ID number of 'wnn' has to be 69.
|
|
|
|
Please try again after you delete the account.
|
|
|
|
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
|
|
EOF
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# add an account 'wnn' to this system
|
|
|
|
echo ""
|
|
|
|
echo "You need an account 'wnn' whose ID number is 69"
|
1999-04-22 15:58:54 +00:00
|
|
|
if [ -z "${BATCH}" ]; then
|
|
|
|
if yesno "Would you like to create it automatically?" y; then
|
|
|
|
# We need a command 'pw(8)'
|
|
|
|
check_pw
|
|
|
|
pw useradd wnn -u 69 -g 7 -h - -d /nonexistent \
|
|
|
|
-s /nonexistent -c Wnn || exit
|
|
|
|
else
|
|
|
|
echo "Please create it, and try again."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo "Create it automatically!"
|
1997-09-19 09:34:33 +00:00
|
|
|
check_pw
|
|
|
|
pw useradd wnn -u 69 -g 7 -h - -d /nonexistent \
|
1999-04-22 15:58:54 +00:00
|
|
|
-s /nonexistent -c Wnn || exit
|
1997-09-19 09:34:33 +00:00
|
|
|
fi
|
1997-09-10 06:52:02 +00:00
|
|
|
;;
|
1997-09-19 09:34:33 +00:00
|
|
|
|
|
|
|
POST-INSTALL)
|
|
|
|
|
|
|
|
case $1 in
|
2000-09-12 17:08:29 +00:00
|
|
|
ja-FreeWnn-*)
|
1999-08-19 00:40:21 +00:00
|
|
|
sys_dirs="${PKG_PREFIX}/lib/wnn/ja_JP/dic/pubdic ${PKG_PREFIX}/lib/wnn/ja_JP/dic/wnncons ${PKG_PREFIX}/lib/wnn/ja_JP/dic/gerodic"
|
1997-09-19 09:34:33 +00:00
|
|
|
usr_dirs=${PKG_PREFIX}/lib/wnn/ja_JP/dic/usr
|
|
|
|
wnnserver=${PKG_PREFIX}/bin/Wnn4/jserver
|
1999-02-10 14:32:00 +00:00
|
|
|
wnntouch=${PKG_PREFIX}/bin/Wnn4/wnntouch
|
|
|
|
wnnstat=${PKG_PREFIX}/bin/Wnn4/wnnstat
|
1997-09-19 09:34:33 +00:00
|
|
|
wnnname=Wnn
|
1999-02-10 14:32:00 +00:00
|
|
|
wnn_socket=/tmp/jd_sockV4
|
|
|
|
wnn_lang=ja_JP
|
1997-09-19 09:34:33 +00:00
|
|
|
;;
|
2000-09-12 17:08:29 +00:00
|
|
|
zh-FreeWnn-*)
|
1997-09-19 09:34:33 +00:00
|
|
|
sys_dirs="${PKG_PREFIX}/lib/wnn/zh_CN/dic/sys ${PKG_PREFIX}/lib/wnn/zh_TW/dic/sys"
|
|
|
|
usr_dirs="${PKG_PREFIX}/lib/wnn/zh_CN/dic/usr ${PKG_PREFIX}/lib/wnn/zh_TW/dic/usr"
|
|
|
|
wnnserver=${PKG_PREFIX}/bin/cWnn4/cserver
|
1999-02-10 14:32:00 +00:00
|
|
|
wnntouch=${PKG_PREFIX}/bin/cWnn4/cwnntouch
|
|
|
|
wnnstat=${PKG_PREFIX}/bin/cWnn4/cwnnstat
|
1997-09-19 09:34:33 +00:00
|
|
|
wnnname=cWnn
|
1999-02-10 14:32:00 +00:00
|
|
|
wnn_socket=/tmp/cd_sockV4
|
|
|
|
wnn_lang=zh_CN
|
1997-09-19 09:34:33 +00:00
|
|
|
;;
|
2000-09-12 17:08:29 +00:00
|
|
|
ko-FreeWnn-*)
|
1997-09-19 09:34:33 +00:00
|
|
|
sys_dirs="${PKG_PREFIX}/lib/wnn/ko_KR/dic/sys"
|
|
|
|
usr_dirs=${PKG_PREFIX}/lib/wnn/ko_KR/dic/usr
|
|
|
|
wnnserver=${PKG_PREFIX}/bin/kWnn4/kserver
|
1999-02-10 14:32:00 +00:00
|
|
|
wnntouch=${PKG_PREFIX}/bin/kWnn4/kwnntouch
|
|
|
|
wnnstat=${PKG_PREFIX}/bin/kWnn4/kwnnstat
|
1997-09-19 09:34:33 +00:00
|
|
|
wnnname=kWnn
|
1999-02-10 14:32:00 +00:00
|
|
|
wnn_socket=/tmp/kd_sockV4
|
|
|
|
wnn_lang=ko_KR
|
1997-09-19 09:34:33 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
1999-03-05 08:06:26 +00:00
|
|
|
chown wnn $wnnserver
|
1997-09-19 09:34:33 +00:00
|
|
|
for dir in $sys_dirs; do
|
|
|
|
$wnntouch $dir/*
|
|
|
|
done
|
|
|
|
for dir in $usr_dirs; do
|
|
|
|
if [ ! -d $dir ]; then
|
|
|
|
mkdir -p $dir
|
|
|
|
fi
|
|
|
|
chown wnn $dir
|
|
|
|
done
|
|
|
|
|
|
|
|
## create a startup script ##
|
|
|
|
startup_script=${PKG_PREFIX}/etc/rc.d/${wnnname}.sh
|
|
|
|
if [ ! -f ${startup_script} ]; then
|
|
|
|
echo "Installing ${startup_script} startup file.";
|
|
|
|
echo '#!/bin/sh' > ${startup_script};
|
2000-09-12 17:08:29 +00:00
|
|
|
echo "wnn=${wnnserver}" >> ${startup_script};
|
|
|
|
echo 'if [ -x $wnn ]; then' >> ${startup_script};
|
|
|
|
echo " ${wnnstat} -L ${wnn_lang} localhost > /dev/null 2>&1" >> ${startup_script};
|
|
|
|
echo ' if [ $? = 255 ]; then' >> ${startup_script};
|
|
|
|
echo " rm -f ${wnn_socket}" >> ${startup_script};
|
|
|
|
echo " echo -n ' ${wnnname}'" >> ${startup_script};
|
|
|
|
echo ' $wnn' >> ${startup_script};
|
1999-02-10 14:32:00 +00:00
|
|
|
echo " fi" >> ${startup_script};
|
2000-09-12 17:08:29 +00:00
|
|
|
echo "fi" >> ${startup_script};
|
1999-02-10 14:32:00 +00:00
|
|
|
if [ $1 = zh-Wnn-4.2 ]; then
|
|
|
|
wnnserver=${PKG_PREFIX}/bin/cWnn4/tserver
|
|
|
|
wnn_lang=zh_TW
|
|
|
|
wnn_socket=/tmp/td_sockV4
|
2000-09-12 17:08:29 +00:00
|
|
|
echo "wnn=${wnnserver}" >> ${startup_script};
|
|
|
|
echo 'if [ -x $wnn ]; then' >> ${startup_script};
|
|
|
|
echo " ${wnnstat} -L ${wnn_lang} localhost > /dev/null 2>&1" >> ${startup_script};
|
|
|
|
echo ' if [ $? = 255 ]; then' >> ${startup_script};
|
|
|
|
echo " rm -f ${wnn_socket}" >> ${startup_script};
|
|
|
|
echo " echo -n ' ${wnnname}'" >> ${startup_script};
|
|
|
|
echo ' $wnn' >> ${startup_script};
|
1999-02-10 14:32:00 +00:00
|
|
|
echo " fi" >> ${startup_script};
|
2000-09-12 17:08:29 +00:00
|
|
|
echo "fi" >> ${startup_script};
|
1999-02-10 14:32:00 +00:00
|
|
|
fi
|
1997-09-19 09:34:33 +00:00
|
|
|
chmod 755 ${startup_script};
|
|
|
|
chown bin.bin ${startup_script};
|
|
|
|
fi
|
1997-09-10 06:52:02 +00:00
|
|
|
;;
|
|
|
|
esac
|