File: set-env-diaspora.sh

package info (click to toggle)
diaspora-installer 0.7.6.1+debian1
  • links: PTS, VCS
  • area: contrib
  • in suites: bullseye, buster, sid
  • size: 456 kB
  • sloc: sh: 895; makefile: 8
file content (43 lines) | stat: -rwxr-xr-x 1,300 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#! /bin/sh

# Read configuration from file
. /etc/diaspora/diaspora-common.conf
if test -f ${diaspora_conf}; then
  echo "Using ${diaspora_conf}..."
  
  if ! grep BUNDLE_WITH ${diaspora_conf} >/dev/null; then
    echo "Older versions did not set BUNDLE_WITH variable"
    echo "Setting BUNDLE_WITH variable in ${diaspora_conf}..."
  
  if [ $(grep DB ${diaspora_conf} |cut -d= -f2) = "postgres" ]; then
      echo export BUNDLE_WITH=postgresql >> ${diaspora_conf}
    else
      echo export BUNDLE_WITH=mysql >> ${diaspora_conf}
    fi
  fi
    
  if ! grep DB_NAME ${diaspora_conf} ; then
    echo "Older versions did not set DB_NAME variable"
    echo "Setting DB_NAME variable in ${diaspora_conf}..."
    echo export DB_NAME=diaspora_production >> ${diaspora_conf}
  fi

  # source diaspora variables	
  . ${diaspora_conf}
else
  echo "Using ${diaspora_conf_private}..."
  if ! grep RAILS_ENV ${diaspora_conf_private}; then
    echo export RAILS_ENV=production >> ${diaspora_conf_private}
  fi

  if ! grep DB ${diaspora_conf_private}; then
    echo export DB=postgres >> ${diaspora_conf_private}
  fi
	
  if ! grep BUNDLE_WITH ${diaspora_conf_private}; then
    echo export BUNDLE_WITH=postgresql >> ${diaspora_conf_private}
  fi
	
  # source diaspora variables	
  . ${diaspora_conf_private}
fi