diff options
author | Hiroki Sato <hrs@FreeBSD.org> | 2005-12-07 10:46:20 +0000 |
---|---|---|
committer | Hiroki Sato <hrs@FreeBSD.org> | 2005-12-07 10:46:20 +0000 |
commit | fcd17611d6b375d48b45c9050eee38d1e4641648 (patch) | |
tree | f6e34e6fe82960a4a1d9d916db87da356b8ec1e3 /japanese/FreeWnn-lib/files | |
parent | - Update to 0.9.6 (diff) |
- Update to 1.1.1-a021.
- Use rc.subr(8) for startup scripts.
- Remove unnecessary patch files.
Diffstat (limited to 'japanese/FreeWnn-lib/files')
-rw-r--r-- | japanese/FreeWnn-lib/files/pkg-install.in | 195 |
1 files changed, 195 insertions, 0 deletions
diff --git a/japanese/FreeWnn-lib/files/pkg-install.in b/japanese/FreeWnn-lib/files/pkg-install.in new file mode 100644 index 000000000000..7fe5d4e67a6a --- /dev/null +++ b/japanese/FreeWnn-lib/files/pkg-install.in @@ -0,0 +1,195 @@ +#!/bin/sh +# $FreeBSD$ +# 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 +} + +mk_startup_script() { + _wnnname=$1 + _wnnserver=$2 + _wnn_socket=$3 + _scriptfile=${PKG_PREFIX}/etc/rc.d/${_wnnname}.sh + + echo "Installing ${_scriptfile} startup file."; + cat << EOF > ${_scriptfile} +#!/bin/sh +# +# PROVIDE: ${_wnnname} +# REQUIRE: LOGIN +# + +. %%RC_SUBR%% + +name=${_wnnname} +rcvar=\`set_rcvar\` +command=${_wnnserver} +procname=${_wnnserver} + +load_rc_config \${name} + +start_precmd() +{ + rm -f ${_wnn_socket} +} + +stop_postcmd() +{ + rm -f ${_wnn_socket} +} + +run_rc_command "\$1" +EOF + chmod 0555 ${_scriptfile} + +} + +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 [ -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!" + check_pw + pw useradd wnn -u 69 -g 7 -h - -d /nonexistent \ + -s /nonexistent -c Wnn || exit + fi + ;; + +POST-INSTALL) + + case $1 in + ja-FreeWnn-*) + 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" + usr_dirs=${PKG_PREFIX}/lib/wnn/ja_JP/dic/usr + wnnserver=${PKG_PREFIX}/bin/Wnn4/jserver + wnntouch=${PKG_PREFIX}/bin/Wnn4/wnntouch + wnnstat=${PKG_PREFIX}/bin/Wnn4/wnnstat + wnnkill=${PKG_PREFIX}/bin/Wnn4/wnnkill + wnnname=wnn + wnn_socket=/tmp/jd_sockV4 + wnn_lang=ja_JP + mk_startup_script ${wnnname} ${wnnserver} ${wnn_socket} + ;; + zh-FreeWnn-*) + 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 + wnntouch=${PKG_PREFIX}/bin/cWnn4/cwnntouch + wnnstat=${PKG_PREFIX}/bin/cWnn4/cwnnstat + wnnkill=${PKG_PREFIX}/bin/cWnn4/cwnnkill + wnnname=cwnn + wnn_socket=/tmp/cd_sockV4 + wnn_lang=zh_CN + mk_startup_script ${wnnname} ${wnnserver} ${wnn_socket} + + wnnserver2=${PKG_PREFIX}/bin/cWnn4/tserver + wnn_lang2=zh_TW + wnnname2=twnn + wnn_socket2=/tmp/td_sockV4 + mk_startup_script ${wnnname} ${wnnserver} ${wnn_socket} + ;; + ko-FreeWnn-*) + 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 + wnntouch=${PKG_PREFIX}/bin/kWnn4/kwnntouch + wnnstat=${PKG_PREFIX}/bin/kWnn4/kwnnstat + wnnkill=${PKG_PREFIX}/bin/kWnn4/kwnnkill + wnnname=kwnn + wnn_socket=/tmp/kd_sockV4 + wnn_lang=ko_KR + mk_startup_script ${wnnname} ${wnnserver} ${wnn_socket} + ;; + esac + + chown wnn $wnnserver + 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 |