Debian Codegraph @

buildhelpers/dict_restart_helper.sh

raw symbols SCIP
1 #!/bin/shscip-shell filesystem . . `/bin/sh`.
2 #vim:set expandtab sts=4 ts=4 sw=4:
3 # This script updates the dictd database and restarts dictd. It'll also try to
4 # figure out whether dictd is installed in the first place and what the correct
5 # way of restart is (upstart / systemd /init).
6 set -e
7
8 isDictInstalledscip-shell shell freedict-tools 0.7.0-2 isDictInstalled().() {
9 if testscip-shell system . . test. -f /usr/sbin/dictdscip-shell filesystem . . `/usr/sbin/dictd`. || command -v dictd > /dev/nullscip-shell filesystem . . `/dev/null`. || [scip-shell system . . `[`. -f /sbin/dictdscip-shell filesystem . . `/sbin/dictd`. ]
10 then
11 return 0
12 else
13 echoscip-shell system . . echo. "The dictd server hasn't been found on this system."
14 if command -v apt-get > /dev/nullscip-shell filesystem . . `/dev/null`.
15 then
16 echoscip-shell system . . echo. 'Type `apt-get install dictd` before re-executing this script.'
17 elif command -v pacman > /dev/nullscip-shell filesystem . . `/dev/null`.
18 then
19 echoscip-shell system . . echo. 'Type `pacman -Syu dictd` before re-executing this script.'
20 elif command -v yum > /dev/nullscip-shell filesystem . . `/dev/null`.
21 then
22 echoscip-shell system . . echo. 'Type `yum install dictd` before re-executing this script.'
23 else
24 echoscip-shell system . . echo. "Please install the dictd server before proceeding."
25 fi
26 exit 20
27 fi
28 }
29
30
31 restart_dictd_serverscip-shell shell freedict-tools 0.7.0-2 restart_dictd_server().() {
32 echoscip-shell system . . echo. "Restarting dictd..."
33 if command -v service > /dev/nullscip-shell filesystem . . `/dev/null`.
34 then
35 servicescip-shell system . . service. dictd restart
36 elif command -v systemctl > /dev/nullscip-shell filesystem . . `/dev/null`.
37 then
38 systemctl restart dictd
39 elif testscip-shell system . . test. -f /etc/init.d/dictdscip-shell filesystem . . `/etc/init.d/dictd`.
40 then
41 /etc/init.d/dictdscip-shell filesystem . . `/etc/init.d/dictd`. restart stop
42 /etc/init.d/dictdscip-shell filesystem . . `/etc/init.d/dictd`. restart start
43 else
44 echoscip-shell system . . echo. "Error, could not detect init system. DICT SERVER HAS NOT BEEN RESTARTED!"
45 fi
46 }
47
48 update_dictd_databasescip-shell shell freedict-tools 0.7.0-2 update_dictd_database().() {
49 dictdconfig -w
50 }
51
52
53 ################################################################################
54
55 # abort if dictd is not installed
56 isDictInstalledscip-shell shell freedict-tools 0.7.0-2 isDictInstalled().
57
58 update_dictd_databasescip-shell shell freedict-tools 0.7.0-2 update_dictd_database().
59 restart_dictd_serverscip-shell shell freedict-tools 0.7.0-2 restart_dictd_server().
60 exit 0;
61