diff options
author | Cezary M. Kruk <c.kruk@bigfoot.com> | 2014-11-29 01:18:16 +0700 |
---|---|---|
committer | Willy Sudiarto Raharjo <willysr@slackbuilds.org> | 2014-11-29 01:18:16 +0700 |
commit | d4c3076cb09b2c0366a29d9c9bbbc655424dcfca (patch) | |
tree | 9f386bc5476911cbc69fe60ebd58b2847b5b2f28 /misc/stardict-tools/sd | |
parent | 4aa4962c4694b65952ef5717b483780bad0bf47a (diff) |
misc/stardict-tools: Added (tool for stardict).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'misc/stardict-tools/sd')
-rw-r--r-- | misc/stardict-tools/sd | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/misc/stardict-tools/sd b/misc/stardict-tools/sd new file mode 100644 index 0000000000000..c5592b2b71ae1 --- /dev/null +++ b/misc/stardict-tools/sd @@ -0,0 +1,57 @@ +#!/bin/sh + +# sd: the dictionaries collections manager for StarDict + +# +# RUN THE BELOW COMMAND ONCE AS ROOT +# + +# chgrp users /usr/share/stardict ; chmod 775 /usr/share/stardict ; exit + +# +# RUN THE ABOVE COMMAND ONCE AS ROOT +# + +if [ "$1" == "" ] +then + cd /usr/share/stardict/ + ls -l | grep '\->' | sed 's/.* dic \->/dic ->/' + ls | grep '^dic\.' +elif [ "$1" == "?" ] +then + cd /usr/share/stardict/ + for d in dic.* + do + echo + ls -l | grep $d | sed 's/.* dic/dic/' + ls -1 /usr/share/stardict/$d + done +elif [ "$2" == "?" ] +then + if [ -e /usr/share/stardict/dic.$1 ] + then + ls -1 /usr/share/stardict/dic.$1 + else + echo "There is no /usr/share/stardict/dic.$1." + fi +elif [ -e /usr/share/stardict/dic.$1 ] +then + if [ "$(ps ax | grep 'stardict' | grep -v 'grep')" != "" ] + then + killall stardict + fi + cd /usr/share/stardict/ + rm dic + ln -s dic.$1 dic + cd + if [ ! -e ~/.stardict/stardict.cfg.$1 ] + then + cp ~/.stardict/stardict.cfg.template ~/.stardict/stardict.cfg.$1 + fi + cp ~/.stardict/stardict.cfg.$1 ~/.stardict/stardict.cfg + ls -l /usr/share/stardict/ | grep '\->' | sed 's/.* dic \->/dic ->/' + ls -1 /usr/share/stardict/dic.$1 +else + echo "There is no /usr/share/stardict/dic.$1." +fi + |