slackbuilds_ponce/misc/stardict-tools/sd

58 lines
1.2 KiB
Text
Raw Normal View History

#!/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