diff --git a/package/misc/dictd/dictd.conf b/package/misc/dictd/dictd.conf new file mode 100644 index 000000000..35f20adf3 --- /dev/null +++ b/package/misc/dictd/dictd.conf @@ -0,0 +1,24 @@ +# --- ROCK-COPYRIGHT-NOTE-BEGIN --- +# +# This copyright note is auto-generated by ./scripts/Create-CopyPatch. +# Please add additional copyright information _after_ the line containing +# the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by +# the ./scripts/Create-CopyPatch script. Do not edit this copyright text! +# +# ROCK Linux: rock-src/package/ccls/dictd/dictd.conf +# ROCK Linux is Copyright (C) 1998 - 2004 Clifford Wolf +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. A copy of the GNU General Public +# License can be found at Documentation/COPYING. +# +# Many people helped and are helping developing ROCK Linux. Please +# have a look at http://www.rocklinux.org/ and the Documentation/TEAM +# file for details. +# +# --- ROCK-COPYRIGHT-NOTE-END --- + +hook_add postmake 3 "install_init dictd $confdir/dictd.init" +hook_add postmake 4 "install -m 644 $confdir/mod_dictd.sh $root/etc/stone.d" diff --git a/package/misc/dictd/dictd.desc b/package/misc/dictd/dictd.desc new file mode 100644 index 000000000..3c4aa4548 --- /dev/null +++ b/package/misc/dictd/dictd.desc @@ -0,0 +1,45 @@ +[COPY] --- ROCK-COPYRIGHT-NOTE-BEGIN --- +[COPY] +[COPY] This copyright note is auto-generated by ./scripts/Create-CopyPatch. +[COPY] Please add additional copyright information _after_ the line containing +[COPY] the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by +[COPY] the ./scripts/Create-CopyPatch script. Do not edit this copyright text! +[COPY] +[COPY] ROCK Linux: rock-src/package/ccls/dictd/dictd.desc +[COPY] ROCK Linux is Copyright (C) 1998 - 2004 Clifford Wolf +[COPY] +[COPY] This program is free software; you can redistribute it and/or modify +[COPY] it under the terms of the GNU General Public License as published by +[COPY] the Free Software Foundation; either version 2 of the License, or +[COPY] (at your option) any later version. A copy of the GNU General Public +[COPY] License can be found at Documentation/COPYING. +[COPY] +[COPY] Many people helped and are helping developing ROCK Linux. Please +[COPY] have a look at http://www.rocklinux.org/ and the Documentation/TEAM +[COPY] file for details. +[COPY] +[COPY] --- ROCK-COPYRIGHT-NOTE-END --- + +[I] RFC-2229 compliant dictionary server. + +[T] Dictd implements the Dictionary Server Protocol (DICT). This is a TCP +[T] transaction based query/response protocol that allows a client to access +[T] dictionary definitions from a set of natural language dictionary +[T] databases. Many bilingual databases are available from the freedict +[T] project. + + +[U] http://www.dict.org/ +[U] http://sourceforge.net/projects/dict/ + +[A] Dict Development Group +[M] Michael Bunk + +[C] extra/server + +[L] GPL +[S] Stable +[V] 1.9.13 +[P] X -----5---9 662.000 + +[D] 1125611898 dictd-1.9.13.tar.gz http://dl.sourceforge.net/sourceforge/dict/ diff --git a/package/misc/dictd/dictd.init b/package/misc/dictd/dictd.init new file mode 100644 index 000000000..76cf444db --- /dev/null +++ b/package/misc/dictd/dictd.init @@ -0,0 +1,50 @@ +# --- ROCK-COPYRIGHT-NOTE-BEGIN --- +# +# This copyright note is auto-generated by ./scripts/Create-CopyPatch. +# Please add additional copyright information _after_ the line containing +# the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by +# the ./scripts/Create-CopyPatch script. Do not edit this copyright text! +# +# ROCK Linux: rock-src/package/ccls/dictd/dictd.init +# ROCK Linux is Copyright (C) 1998 - 2004 Clifford Wolf +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. A copy of the GNU General Public +# License can be found at Documentation/COPYING. +# +# Many people helped and are helping developing ROCK Linux. Please +# have a look at http://www.rocklinux.org/ and the Documentation/TEAM +# file for details. +# +# --- ROCK-COPYRIGHT-NOTE-END --- +# + +# +# ROCK Linux /etc/rc.d/init.d/dictd +# +# Desc: rfc 2229 compliant dictionary server +# Runlevel: 90 rcX +# + +main_begin + + block_begin(start, `Starting dict server (dictd).') + check(`D_prefix/sbin/dictd --locale en_US.utf8') + block_end + + block_begin(stop, `Stopping dict server (dictd).') + check(`killall -15 dictd') + block_end + + block_begin(restart, `Restarting dict server (dictd).') + check(`$0 stop && $0 start') + block_end + + block_begin(status, `Status for dictd') + check(`ps auxw|grep dictd') + block_end + +main_end + diff --git a/package/misc/dictd/mod_dictd.sh b/package/misc/dictd/mod_dictd.sh new file mode 100644 index 000000000..f38eb1bd4 --- /dev/null +++ b/package/misc/dictd/mod_dictd.sh @@ -0,0 +1,115 @@ +# --- ROCK-COPYRIGHT-NOTE-BEGIN --- +# +# This copyright note is auto-generated by ./scripts/Create-CopyPatch. +# Please add additional copyright information _after_ the line containing +# the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by +# the ./scripts/Create-CopyPatch script. Do not edit this copyright text! +# +# ROCK Linux: rock-src/package/ccls/dictd/mod_dictd.sh +# ROCK Linux is Copyright (C) 1998 - 2004 Clifford Wolf +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. A copy of the GNU General Public +# License can be found at Documentation/COPYING. +# +# Many people helped and are helping developing ROCK Linux. Please +# have a look at http://www.rocklinux.org/ and the Documentation/TEAM +# file for details. +# +# --- ROCK-COPYRIGHT-NOTE-END --- +# + +# +# [MAIN] 80 dictd Configuration for dictionary server + + +conf=/etc/dictd.conf + +list_dictionaries () { + ds="" + for i in $( ls /usr/share/dictd/*.index ) + do + ds="$ds `basename $i .index`" + done +} + +select_dict() { + if grep "database[[:space:]]\+\"$1\"" $conf 2>&1 >/dev/null + then + # delete entry if it is not for select all + if [ "$2" != "1" ] ; then + perl -i -00 -p -e"s/database\s+\"$1\"\s+\{.+\}//s" $conf + fi + else + # set entry if it is not in unselect all mode + if [ "$2" != "0" ] ; then + cat <>$conf +database "$1" +{ + data "/usr/share/dictd/$1.dict.dz" + index "/usr/share/dictd/$1.index" +} +MSG + fi + fi +} + +select_dictionaries() { + while + cmd="gui_menu dictd 'Select the dictionaries which" + cmd="$cmd will be served by dictd.'" + + list_dictionaries + if [ -z "$ds" ] ; then gui_message \ + "Stone can not find any dictionary. Please install one!" + return; fi + + for dic in $ds + do + if grep "database[[:space:]]\+\"$dic\"" $conf 2>&1 >/dev/null + then + dics=$(printf "%-10sOK" "$dic") + else + dics=$(printf "%-10s--" "$dic") + fi + cmd="$cmd '$dics' 'select_dict \"$dic\"'" + done + eval $cmd + do : ; done +} + +all_dictionaries() { + list_dictionaries + for dic in $ds + do + select_dict "$dic" 1 + done +} + +deselect_all() { + list_dictionaries + for dic in $ds + do + select_dict "$dic" 0 + done +} + +main() { + while + + cmd="gui_menu dictd 'Configuration for dictionary server' " + list_dictionaries + if [ -z "$ds" ] ; then gui_message \ + "There is no dictionary installed. Please install one." + return ; fi + + cmd="$cmd 'Select dictionaries' 'select_dictionaries'" + cmd="$cmd 'Select all installed dictionaries' 'all_dictionaries'" + cmd="$cmd 'Deselect all dictionaries' 'deselect_all'" + cmd="$cmd 'Edit $conf' 'gui_edit DICTD $conf'" + eval $cmd + do : ; done +} +