summaryrefslogtreecommitdiffstats
path: root/misc/stardict-tools/sd
diff options
context:
space:
mode:
Diffstat (limited to 'misc/stardict-tools/sd')
-rw-r--r--misc/stardict-tools/sd57
1 files changed, 57 insertions, 0 deletions
diff --git a/misc/stardict-tools/sd b/misc/stardict-tools/sd
new file mode 100644
index 0000000000..c5592b2b71
--- /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
+