Commit 8e9c9d70faec534efc780675b1f54cf18e04220c
Exists in
master
and in
28 other branches
Merge commit 'refs/merge-requests/326' of git://gitorious.org/noosfero/noosfero …
…into merge-requests/326
Showing
3 changed files
with
29 additions
and
0 deletions
Show diff stats
... | ... | @@ -0,0 +1,21 @@ |
1 | +#!/usr/bin/ruby | |
2 | + | |
3 | +require 'yaml' | |
4 | + | |
5 | +DBCONFIG = ARGV.first || '/etc/database/database.yml' | |
6 | + | |
7 | +$dbconfig = {} | |
8 | + | |
9 | +checks = [ | |
10 | + lambda { File.exists?(DBCONFIG) }, | |
11 | + lambda { $dbconfig = YAML.load_file(DBCONFIG) }, | |
12 | + lambda { $dbconfig['production'] }, | |
13 | + lambda { $dbconfig['production']['adapter'] }, | |
14 | + lambda { $dbconfig['production']['database'] }, | |
15 | +] | |
16 | + | |
17 | +if checks.all?(&:call) | |
18 | + exit 0 | |
19 | +else | |
20 | + exit 1 | |
21 | +end | ... | ... |
debian/noosfero.install
etc/init.d/noosfero
... | ... | @@ -44,6 +44,13 @@ if [ -z "$NOOSFERO_DIR" ] || [ -z "$NOOSFERO_USER" ]; then |
44 | 44 | exit 0 |
45 | 45 | fi |
46 | 46 | |
47 | +if test -x /usr/sbin/noosfero-check-dbconfig ; then | |
48 | + if ! noosfero-check-dbconfig; then | |
49 | + echo "Noosfero database access not configured, service disabled." | |
50 | + exit 0 | |
51 | + fi | |
52 | +fi | |
53 | + | |
47 | 54 | ###################### |
48 | 55 | |
49 | 56 | main_script() { | ... | ... |