openbsd-ports/japanese/Wnn/pkg/INSTALL
1998-11-22 00:13:44 +00:00

107 lines
2.4 KiB
Plaintext
Executable File

#!/bin/sh
# an installation script for Wnn4.2
ask() {
local question default answer
question=$1
default=$2
if [ -z "${PACKAGE_BUILDING}" ]; then
read "${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
cat <<EOF
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
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"
if yesno "Would you like to create it automatically?" y; then
gid=`id -g bin`
chpass -a "wnn:*:69:${gid}::::Wnn server:/root:/sbin/nologin"
else
echo "Please create it, and try again."
exit 1
fi
;;
POST-INSTALL)
case $1 in
ja-Wnn-4.2)
sys_dirs="${PKG_PREFIX}/lib/wnn/ja_JP/dic/pubdic ${PKG_PREFIX}/lib/wnn/ja_JP/dic/wnncons"
usr_dirs=${PKG_PREFIX}/lib/wnn/ja_JP/dic/usr
wnntouch=${PKG_PREFIX}/bin/Wnn4/wnntouch
wnnserver=${PKG_PREFIX}/bin/Wnn4/jserver
wnnname=Wnn
;;
zh-Wnn-4.2)
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"
wnntouch=${PKG_PREFIX}/bin/cWnn4/cwnntouch
wnnserver=${PKG_PREFIX}/bin/cWnn4/cserver
wnnname=cWnn
;;
ko-Wnn-4.2)
sys_dirs="${PKG_PREFIX}/lib/wnn/ko_KR/dic/sys"
usr_dirs=${PKG_PREFIX}/lib/wnn/ko_KR/dic/usr
wnntouch=${PKG_PREFIX}/bin/kWnn4/kwnntouch
wnnserver=${PKG_PREFIX}/bin/kWnn4/kserver
wnnname=kWnn
;;
esac
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
;;
esac