diff --git a/fcwnn.service b/fcwnn.service new file mode 100644 index 0000000..91ad676 --- /dev/null +++ b/fcwnn.service @@ -0,0 +1,13 @@ +[Unit] +ConditionPathExists=/etc/FreeWnn/zh_CN/cserverrc +Description=Free Wnn (mainland) Chinese Server, for input of simplified Chinese + +[Service] +Type=forking +User=wnn +ExecStartPre=/bin/rm -f /tmp/cd_sockV4 +ExecStart=/usr/bin/cserver +ExecStopPost=/bin/rm -f /tmp/cd_sockV4 + +[Install] +WantedBy=multi-user.target diff --git a/fkwnn.service b/fkwnn.service new file mode 100644 index 0000000..d394412 --- /dev/null +++ b/fkwnn.service @@ -0,0 +1,13 @@ +[Unit] +ConditionPathExists=/etc/FreeWnn/ko_KR/kserverrc +Description=Free Wnn Korean Server, for input of Korean + +[Service] +Type=forking +User=wnn +ExecStartPre=/bin/rm -f /tmp/kd_sockV4 +ExecStart=/usr/bin/kserver +ExecStopPost=/bin/rm -f /tmp/kd_sockV4 + +[Install] +WantedBy=multi-user.target diff --git a/ftwnn.service b/ftwnn.service new file mode 100644 index 0000000..24510eb --- /dev/null +++ b/ftwnn.service @@ -0,0 +1,13 @@ +[Unit] +ConditionPathExists=/etc/FreeWnn/zh_TW/tserverrc +Description=Free Wnn Taiwan-Chinese Server, for input of traditional Chinese + +[Service] +Type=forking +User=wnn +ExecStartPre=/bin/rm -f /tmp/td_sockV4 +ExecStart=/usr/bin/tserver +ExecStopPost=/bin/rm -f /tmp/td_sockV4 + +[Install] +WantedBy=multi-user.target diff --git a/fwnn.changes b/fwnn.changes index 2bca265..617be0c 100644 --- a/fwnn.changes +++ b/fwnn.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Thu Mar 7 13:22:01 UTC 2019 - josef.moellers@suse.com + +- Added systemd support: Replaced sysv init files by systemd + service files. + [bsc#1116014,fwnn.service,fcwnn.service,fkwnn.service, + ftwnn.service] + ------------------------------------------------------------------- Thu Nov 23 13:49:55 UTC 2017 - rbrown@suse.com diff --git a/fwnn.service b/fwnn.service new file mode 100644 index 0000000..55696c1 --- /dev/null +++ b/fwnn.service @@ -0,0 +1,13 @@ +[Unit] +ConditionPathExists=/etc/FreeWnn/ja/jserverrc +Description=Free Wnn Kanji Server used for input of Japanese + +[Service] +Type=forking +User=wnn +ExecStartPre=/bin/rm -f /tmp/jd_sockV4 +ExecStart=/usr/bin/jserver +ExecStopPost=/bin/rm -f /tmp/jd_sockV4 + +[Install] +WantedBy=multi-user.target diff --git a/fwnn.spec b/fwnn.spec index 3cc8e8f..6a00259 100644 --- a/fwnn.spec +++ b/fwnn.spec @@ -1,7 +1,7 @@ # # spec file for package fwnn # -# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -16,11 +16,6 @@ # -#Compat macro for new _fillupdir macro introduced in Nov 2017 -%if ! %{defined _fillupdir} - %define _fillupdir /var/adm/fillup-templates -%endif - %define base_version 1.1.1 %define alpha_version a023 Name: fwnn @@ -31,10 +26,10 @@ License: GPL-2.0+ Group: System/I18n/Japanese Url: http://freewnn.sourceforge.jp/ Source: http://iij.dl.osdn.jp/freewnn/63271/FreeWnn-%{base_version}-%{alpha_version}.tar.gz -Source1: rcfwnn -Source2: rcfcwnn -Source3: rcftwnn -Source4: rcfkwnn +Source5: fwnn.service +Source6: fcwnn.service +Source7: fkwnn.service +Source8: ftwnn.service Source99: fwnn-rpmlintrc Patch0: FreeWnn-fsstnd.patch Patch1: FreeWnn-ja.patch @@ -47,9 +42,8 @@ BuildRequires: fdupes BuildRequires: ncurses-devel BuildRequires: tcpd-devel Requires: fwnncom = %{version} -# %{_sbindir}/useradd +# %%{_sbindir}/useradd Requires(pre): shadow -Requires(pre): %insserv_prereq %fillup_prereq Conflicts: wnn6 BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -110,7 +104,6 @@ Requires: fcwnncom = %{version} Requires: fkwnn = %{version} Requires: fwnn = %{version} Requires(pre): shadow -Requires(pre): %insserv_prereq %fillup_prereq Requires(post): fcwnncom %description -n fcwnn @@ -152,7 +145,6 @@ Group: System/I18n/Chinese Requires: fcwnn = %{version} Requires: fcwnncom = %{version} Requires(pre): shadow -Requires(pre): %insserv_prereq %fillup_prereq Requires(post): fcwnncom %description -n ftwnn @@ -163,7 +155,6 @@ Summary: Free kWnn Korean Input System Group: System/I18n/Korean Requires: fwnncom = %{version} Requires(pre): shadow -Requires(pre): %insserv_prereq %fillup_prereq %description -n fkwnn Free kWnn Korean input system. @@ -270,22 +261,16 @@ for i in pubdic.5 usr_dic.5 do mv %{buildroot}/%{_mandir}/man5/$i %{buildroot}/%{_mandir}/ja/man5/ done -#---------------------------------------------------------------------- -# Make sure directories for of boot script installation exist: -mkdir -p %{buildroot}%{_sysconfdir}/init.d -mkdir -p %{buildroot}%{_fillupdir} -mkdir -p %{buildroot}%{_sbindir} -#---------------------------------------------------------------------- -# Install boot scripts: -install -m 755 %{_sourcedir}/rcfwnn %{buildroot}%{_initddir}/fwnn -install -m 755 %{_sourcedir}/rcfcwnn %{buildroot}%{_initddir}/fcwnn -install -m 755 %{_sourcedir}/rcftwnn %{buildroot}%{_initddir}/ftwnn -install -m 755 %{_sourcedir}/rcfkwnn %{buildroot}%{_initddir}/fkwnn -#---------------------------------------------------------------------- -# Make symbolic links -for i in fwnn fcwnn ftwnn fkwnn ; do - ( cd %{buildroot}%{_sbindir}; ln -s -f ../..%{_initddir}/$i rc$i ) -done +install -d %{buildroot}%{_unitdir} +install -m 644 %{SOURCE5} %{buildroot}%{_unitdir} +install -m 644 %{SOURCE6} %{buildroot}%{_unitdir} +install -m 644 %{SOURCE7} %{buildroot}%{_unitdir} +install -m 644 %{SOURCE8} %{buildroot}%{_unitdir} +install -d %{buildroot}%{_sbindir} +ln -s -f service %{buildroot}%{_sbindir}/rcfwnn +ln -s -f service %{buildroot}%{_sbindir}/rcfcwnn +ln -s -f service %{buildroot}%{_sbindir}/rcftwnn +ln -s -f service %{buildroot}%{_sbindir}/rcfkwnn ln -s -f %{_localstatedir}/lib/wnn/ja/dic %{buildroot}%{_sysconfdir}/FreeWnn/ja/dic ln -s -f %{_localstatedir}/lib/wnn/zh_CN/dic %{buildroot}%{_sysconfdir}/FreeWnn/zh_CN/dic ln -s -f %{_localstatedir}/lib/wnn/zh_TW/dic %{buildroot}%{_sysconfdir}/FreeWnn/zh_TW/dic @@ -297,21 +282,22 @@ find %{buildroot} -type f -name "*.a" -delete -print %fdupes -s %{buildroot} %pre -n fwnn +%service_add_pre fwnn.service %{_sbindir}/useradd -r -o -g root -u 66 -s /bin/false -c "Wnn System Account" -d %{_localstatedir}/lib/wnn wnn 2> /dev/null || : %post -n fwnn +%service_add_post fwnn.service # touch all public dictionary files: chroot . usr/bin/wnntouch var/lib/wnn/ja/dic/gerodic/g-jinmei.dic chroot . usr/bin/wnntouch var/lib/wnn/ja/dic/pubdic/*.* -# Create symbolic runlevel links: -%{fillup_and_insserv -y} %preun -n fwnn +%service_del_preun fwnn.service %stop_on_removal fwnn %postun -n fwnn +%service_del_postun fwnn.service %restart_on_update fwnn -%insserv_cleanup %post -n libjd0 -p /sbin/ldconfig %postun -n libjd0 -p /sbin/ldconfig @@ -325,63 +311,69 @@ chroot . usr/bin/wnntouch var/lib/wnn/ja/dic/pubdic/*.* %{_sbindir}/useradd -r -o -g root -u 66 -s /bin/false -c "Wnn System Account" -d %{_localstatedir}/lib/wnn wnn 2> /dev/null || : %pre -n fcwnn +%service_add_pre fcwnn.service %{_sbindir}/useradd -r -o -g root -u 66 -s /bin/false -c "Wnn System Account" -d %{_localstatedir}/lib/wnn wnn 2> /dev/null || : %preun -n fcwnn +%service_del_preun fcwnn.service %stop_on_removal fcwnn %post -n fcwnn +%service_add_post fcwnn.service # touch all public dictionary files: chroot . usr/bin/cwnntouch var/lib/wnn/zh_CN/dic/sys/*.* # Create symbolic run level links: -%fillup_and_insserv %postun -n fcwnn +%service_del_postun fcwnn.service %restart_on_update fcwnn -%insserv_cleanup %post -n libcwnn0 -p /sbin/ldconfig %postun -n libcwnn0 -p /sbin/ldconfig %pre -n ftwnn +%service_add_pre ftwnn.service %{_sbindir}/useradd -r -o -g root -u 66 -s /bin/false -c "Wnn System Account" -d %{_localstatedir}/lib/wnn wnn 2> /dev/null || : %preun -n ftwnn +%service_del_preun ftwnn.service %stop_on_removal ftwnn %post -n ftwnn +%service_add_post ftwnn.service # touch all public dictionary files: chroot . usr/bin/cwnntouch var/lib/wnn/zh_TW/dic/sys/*.* # Create symbolic run level links: -%fillup_and_insserv %postun -n ftwnn +%service_del_postun ftwnn.service %restart_on_update ftwnn -%insserv_cleanup %pre -n fkwnn +%service_add_pre fkwnn.service %{_sbindir}/useradd -r -o -g root -u 66 -s /bin/false -c "Wnn System Account" -d %{_localstatedir}/lib/wnn wnn 2> /dev/null || : %preun -n fkwnn +%service_del_preun fkwnn.service %stop_on_removal fkwnn %post -n fkwnn +%service_add_post fkwnn.service # touch all public dictionary files: chroot . usr/bin/kwnntouch var/lib/wnn/ko_KR/dic/sys/*.* # Create symbolic run level links: -%fillup_and_insserv %postun -n fkwnn +%service_del_postun fkwnn.service %restart_on_update fkwnn -%insserv_cleanup %post -n libkwnn0 -p /sbin/ldconfig %postun -n libkwnn0 -p /sbin/ldconfig %files %defattr(-,root,root) -%config %{_initddir}/fwnn %{_sbindir}/rcfwnn +%{_unitdir}/fwnn.service %{_bindir}/atod %{_bindir}/dtoa %{_bindir}/oldatonewa @@ -464,8 +456,8 @@ chroot . usr/bin/kwnntouch var/lib/wnn/ko_KR/dic/sys/*.* %files -n fcwnn %defattr(-,root,root) -%config %{_initddir}/fcwnn %{_sbindir}/rcfcwnn +%{_unitdir}/fcwnn.service %{_bindir}/cserver %config %{_sysconfdir}/FreeWnn/zh_CN/cixing.data %config %{_sysconfdir}/FreeWnn/zh_CN/cserverrc @@ -520,8 +512,8 @@ chroot . usr/bin/kwnntouch var/lib/wnn/ko_KR/dic/sys/*.* %files -n ftwnn %defattr(-,root,root) -%config %{_initddir}/ftwnn %{_sbindir}/rcftwnn +%{_unitdir}/ftwnn.service %{_bindir}/tserver %config %{_sysconfdir}/FreeWnn/zh_TW/cixing.data %{_sysconfdir}/FreeWnn/zh_TW/dic @@ -551,8 +543,8 @@ chroot . usr/bin/kwnntouch var/lib/wnn/ko_KR/dic/sys/*.* %files -n fkwnn %defattr(-,root,root) -%config %{_initddir}/fkwnn %{_sbindir}/rcfkwnn +%{_unitdir}/fkwnn.service %{_bindir}/kserver %{_bindir}/katod %{_bindir}/katof diff --git a/rcfcwnn b/rcfcwnn deleted file mode 100644 index be80e0d..0000000 --- a/rcfcwnn +++ /dev/null @@ -1,91 +0,0 @@ -#! /bin/sh -# Copyright (c) 1996, 2000 S.u.S.E. GmbH Fuerth, Germany. All rights reserved. -# -# Author: Mike Fabian , 2000 -# -# /etc/init.d/fcwnn -# -### BEGIN INIT INFO -# Provides: fcwnn -# Required-Start: $network $remote_fs $named -# Required-Stop: $network $remote_fs $named -# Default-Start: 3 5 -# Default-Stop: -# Short-Description: Free Wnn (mainland) Chinese Server -# Description: Free Wnn (mainland) Chinese Server, for input of simplified Chinese -### END INIT INFO - -. /etc/rc.status - -FREE_CWNN_BIN=/usr/bin/cserver -test -x $FREE_CWNN_BIN || exit 5 - -# First reset status of this service -rc_reset - -if [ ! -f /etc/FreeWnn/zh_CN/cserverrc ] ; then - echo "can't find /etc/FreeWnn/zh_CN/cserverrc" - # program is not configured - exit 6 -fi - -case "$1" in - start) - echo -n "Starting Free Wnn (mainland) Chinese Server" - if test -e /tmp/cd_sockV4 ; then - rm /tmp/cd_sockV4 - fi - # redirect message - # "startproc: startproc: signal catched /usr/bin/cserver: Terminated - # to /dev/null - startproc -u wnn -q -t 1 $FREE_CWNN_BIN > /dev/null 2>&1 - rc_status -v - ;; - stop) - echo "Shutting down Free Wnn (mainland) Chinese Server" - # don't use 'cwnnkill', because this doesn't kill cserver - # if there are still clients. - killproc -TERM $FREE_CWNN_BIN - rc_status -v - if test -e /tmp/cd_sockV4 ; then - rm /tmp/cd_sockV4 - fi - ;; - try-restart) - $0 status >/dev/null && $0 restart - rc_status - ;; - restart) - $0 stop - $0 start - rc_status - ;; - force-reload) - $0 stop && $0 start - rc_status - ;; - reload) - rc_failed 3 - rc_status -v - ;; - status) - echo -n "Checking for Free Wnn (mainland) Chinese Server: " - checkproc $FREE_CWNN_BIN - rc_status -v - ;; - full-status) - $0 status - rc_status - if test -x /usr/bin/cwnnstat ; then - /usr/bin/cwnnstat - else - echo "Full status not available, can't start \`/usr/bin/cwnnstat'" - fi - ;; - *) - echo "Usage: $0 {start|stop|try-restart|restart|force-reload|reload|status|full-status}" - exit 1 - ;; -esac - -rc_exit diff --git a/rcfkwnn b/rcfkwnn deleted file mode 100644 index 4dac043..0000000 --- a/rcfkwnn +++ /dev/null @@ -1,91 +0,0 @@ -#! /bin/sh -# Copyright (c) 1996, 2000 S.u.S.E. GmbH Fuerth, Germany. All rights reserved. -# -# Author: Mike Fabian , 2000 -# -# /etc/init.d/fkwnn -# -### BEGIN INIT INFO -# Provides: fkwnn -# Required-Start: $network $remote_fs $named -# Required-Stop: $network $remote_fs $named -# Default-Start: 3 5 -# Default-Stop: -# Short-Description: Free Wnn Korean Server -# Description: Free Wnn Korean Server, for input of Korean -### END INIT INFO - -. /etc/rc.status - -FREE_KWNN_BIN=/usr/bin/kserver -test -x $FREE_KWNN_BIN || exit 5 - -# First reset status of this service -rc_reset - -if [ ! -f /etc/FreeWnn/ko_KR/kserverrc ] ; then - echo "can't find /etc/FreeWnn/ko_KR/kserverrc" - # program is not configured - exit 6 -fi - -case "$1" in - start) - echo -n "Starting Free Wnn Korean Server" - if test -e /tmp/kd_sockV4 ; then - rm /tmp/kd_sockV4 - fi - # redirect message - # "startproc: startproc: signal catched /usr/bin/kserver: Terminated - # to /dev/null - startproc -u wnn -q -t 1 $FREE_KWNN_BIN > /dev/null 2>&1 - rc_status -v - ;; - stop) - echo "Shutting down Free Wnn Korean Server" - # don't use 'kwnnkill', because this doesn't kill kserver - # if there are still clients. - killproc -TERM $FREE_KWNN_BIN - rc_status -v - if test -e /tmp/kd_sockV4 ; then - rm /tmp/kd_sockV4 - fi - ;; - try-restart) - $0 status >/dev/null && $0 restart - rc_status - ;; - restart) - $0 stop - $0 start - rc_status - ;; - force-reload) - $0 stop && $0 start - rc_status - ;; - reload) - rc_failed 3 - rc_status -v - ;; - status) - echo -n "Checking for Free Wnn Korean Server: " - checkproc $FREE_KWNN_BIN - rc_status -v - ;; - full-status) - $0 status - rc_status - if test -x /usr/bin/kwnnstat ; then - /usr/bin/kwnnstat - else - echo "Full status not available, can't start \`/usr/bin/kwnnstat'" - fi - ;; - *) - echo "Usage: $0 {start|stop|try-restart|restart|force-reload|reload|status|full-status}" - exit 1 - ;; -esac - -rc_exit diff --git a/rcftwnn b/rcftwnn deleted file mode 100644 index df2f42e..0000000 --- a/rcftwnn +++ /dev/null @@ -1,91 +0,0 @@ -#! /bin/sh -# Copyright (c) 1996, 2000 S.u.S.E. GmbH Fuerth, Germany. All rights reserved. -# -# Author: Mike Fabian , 2000 -# -# /etc/init.d/ftwnn -# -### BEGIN INIT INFO -# Provides: ftwnn -# Required-Start: $network $remote_fs $named -# Required-Stop: $network $remote_fs $named -# Default-Start: 3 5 -# Default-Stop: -# Short-Description: Free Wnn Taiwan-Chinese Server -# Description: Free Wnn Taiwan-Chinese Server, for input of traditional Chinese -### END INIT INFO - -. /etc/rc.status - -FREE_TWNN_BIN=/usr/bin/tserver -test -x $FREE_TWNN_BIN || exit 5 - -# First reset status of this service -rc_reset - -if [ ! -f /etc/FreeWnn/zh_TW/tserverrc ] ; then - echo "can't find /etc/FreeWnn/zh_TW/tserverrc" - # program is not configured - exit 6 -fi - -case "$1" in - start) - echo -n "Starting Free Wnn Taiwan-Chinese Server" - if test -e /tmp/td_sockV4 ; then - rm /tmp/td_sockV4 - fi - # redirect message - # "startproc: startproc: signal catched /usr/bin/tserver: Terminated - # to /dev/null - startproc -u wnn -q -t 1 $FREE_TWNN_BIN > /dev/null 2>&1 - rc_status -v - ;; - stop) - echo "Shutting down Free Wnn Taiwan-Chinese Server" - # don't use 'cwnnkill', because this doesn't kill tserver - # if there are still clients. - killproc -TERM $FREE_TWNN_BIN - rc_status -v - if test -e /tmp/td_sockV4 ; then - rm /tmp/td_sockV4 - fi - ;; - try-restart) - $0 status >/dev/null && $0 restart - rc_status - ;; - restart) - $0 stop - $0 start - rc_status - ;; - force-reload) - $0 stop && $0 start - rc_status - ;; - reload) - rc_failed 3 - rc_status -v - ;; - status) - echo -n "Checking for Free Wnn Taiwan-Chinese Server" - checkproc $FREE_TWNN_BIN - rc_status -v - ;; - full-status) - $0 status - rc_status - if test -x /usr/bin/cwnnstat ; then - /usr/bin/cwnnstat - else - echo "Full status not available, can't start \`/usr/bin/cwnnstat'" - fi - ;; - *) - echo "Usage: $0 {start|stop|try-restart|restart|force-reload|reload|status|full-status}" - exit 1 - ;; -esac - -rc_exit diff --git a/rcfwnn b/rcfwnn deleted file mode 100644 index f15b220..0000000 --- a/rcfwnn +++ /dev/null @@ -1,91 +0,0 @@ -#! /bin/sh -# Copyright (c) 1996, 2000 S.u.S.E. GmbH Fuerth, Germany. All rights reserved. -# -# Author: Mike Fabian , 2000 -# -# /etc/init.d/fwnn -# -### BEGIN INIT INFO -# Provides: fwnn -# Required-Start: $network $remote_fs $named -# Required-Stop: $network $remote_fs $named -# Default-Start: 3 5 -# Default-Stop: -# Short-Description: Free Wnn Kanji Server -# Description: Free Wnn Kanji Server used for input of Japanese -### END INIT INFO - -. /etc/rc.status - -FREE_WNN_BIN=/usr/bin/jserver -test -x $FREE_WNN_BIN || exit 5 - -# First reset status of this service -rc_reset - -if [ ! -f /etc/FreeWnn/ja/jserverrc ] ; then - echo "can't find /etc/FreeWnn/ja/jserverrc" - # program is not configured - exit 6 -fi - -case "$1" in - start) - echo -n "Starting Free Wnn Kanji Server" - if test -e /tmp/jd_sockV4 ; then - rm /tmp/jd_sockV4 - fi - # redirect message - # "startproc: startproc: signal catched /usr/bin/jserver: Terminated - # to /dev/null - startproc -u wnn -q -t 1 $FREE_WNN_BIN > /dev/null 2>&1 - rc_status -v - ;; - stop) - echo "Shutting down Free Wnn Kanji Server" - # don't use 'wnnkill', because this doesn't kill jserver - # if there are still clients. - killproc -TERM $FREE_WNN_BIN - rc_status -v - if test -e /tmp/jd_sockV4 ; then - rm /tmp/jd_sockV4 - fi - ;; - try-restart) - $0 status >/dev/null && $0 restart - rc_status - ;; - restart) - $0 stop - $0 start - rc_status - ;; - force-reload) - $0 stop && $0 start - rc_status - ;; - reload) - rc_failed 3 - rc_status -v - ;; - status) - echo -n "Checking for Free Wnn Kanji Server: " - checkproc $FREE_WNN_BIN - rc_status -v - ;; - full-status) - $0 status - rc_status - if test -x /usr/bin/wnnstat ; then - /usr/bin/wnnstat - else - echo "Full status not available, can't start \`/usr/bin/wnnstat'" - fi - ;; - *) - echo "Usage: $0 {start|stop|try-restart|restart|force-reload|reload|status|full-status}" - exit 1 - ;; -esac - -rc_exit