diff options
Diffstat (limited to 'japanese/FreeWnn-server/pkg-install')
-rw-r--r-- | japanese/FreeWnn-server/pkg-install | 76 |
1 files changed, 49 insertions, 27 deletions
diff --git a/japanese/FreeWnn-server/pkg-install b/japanese/FreeWnn-server/pkg-install index 6d9decb4539d..05e26c3c6c44 100644 --- a/japanese/FreeWnn-server/pkg-install +++ b/japanese/FreeWnn-server/pkg-install @@ -48,6 +48,37 @@ yesno() { done } +mk_startup_script() { + echo "Installing ${startup_script} startup file."; + cat << EOF > ${startup_script} +#!/bin/sh +wnnserver=${wnnserver} +case "\$1" in +start) + if [ -x $wnnserver ]; then + ${wnnstat} -L ${wnn_lang} localhost > /dev/null 2>&1 + if [ \$? = 255 ]; then + rm -f ${wnn_socket} + echo -n ' ${wnnname}' + $wnnserver > /dev/null + fi + fi + ;; +stop) + ${wnnkill} -L ${wnn_lang} localhost + ;; +*) + echo "Usage: \`basename \$0\` {start|stop}" >&2 + exit 64 + ;; +esac + +exit 0 + +EOF + +} + case $2 in PRE-INSTALL) @@ -103,6 +134,7 @@ POST-INSTALL) 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 @@ -113,6 +145,7 @@ POST-INSTALL) 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 @@ -123,6 +156,7 @@ POST-INSTALL) 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 @@ -143,33 +177,21 @@ POST-INSTALL) ## 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}; - 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}; - echo " fi" >> ${startup_script}; - echo "fi" >> ${startup_script}; - if [ $1 = zh-Wnn-4.2 ]; then - wnnserver=${PKG_PREFIX}/bin/cWnn4/tserver - wnn_lang=zh_TW - wnn_socket=/tmp/td_sockV4 - 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}; - echo " fi" >> ${startup_script}; - echo "fi" >> ${startup_script}; - fi - chmod 755 ${startup_script}; - chown bin:bin ${startup_script}; + mk_startup_script + chmod 755 ${startup_script}; + chown bin:bin ${startup_script}; + case "$1" in + zh-FreeWnn-*) + wnnname=tWnn + startup_script=${PKG_PREFIX}/etc/rc.d/${wnnname}.sh + wnnserver=${PKG_PREFIX}/bin/cWnn4/tserver + wnn_lang=zh_TW + wnn_socket=/tmp/td_sockV4 + mk_startup_script + chmod 755 ${startup_script}; + chown bin:bin ${startup_script}; + ;; + esac fi ;; esac |