summaryrefslogtreecommitdiffstats
path: root/adei/scripts/adei-branch.sh
blob: 315355224621cddacb09645a3fc78d2f14e311a8 (plain)
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#! /bin/bash

function branch {
    url="$1"
    bzr branch "$url"
}

if [ ! -d /adei/src -o ! -d /adei/tmp -o ! -d /adei/sys -o ! -d /adei/cfg  ]; then
    echo "Incorrect volume configration, we expect /adei folder with populated docker volumes"
    exit 1
fi 

LOCK_FILE=.lock

#(
#    flock -x 10
#    if [ ! -f /adei/sys/adei.cron.sh ]; then
#        cp -a /opt/configs/*.cron.sh /adei/sys
#    fi
#) 10> /adei/sys/$LOCK_FILE


(
  flock -x 10
  flock -x 11


  if [ ! -f /adei/cfg/config.actual.php ]; then 
    cp -a /opt/configs/config.*.php /adei/cfg/
  fi

  if [ ! -f /adei/src/VERSION ]; then
    bzr branch -r $ADEI_REVISION --use-existing-dir http://darksoft.org/bzr/adei/trunk/ /adei/src
    (
        cd /adei/src
        make

        [ -d tmp ] && rm tmp
        ln -s ../tmp tmp
	chmod 0777 /adei/tmp

        # Additional setups are clonned based on the environment for adei container creation
        # but can be easily added in future. We cache all non-excluded setups. The .exclude
        # file is removed afterwards from all 

        ln -s ../cfg/config.actual.php config.actual.php
        ln -s ../cfg/config.override.php config.override.php
    )
  fi

  (
    cd /adei/src
    for setup in $ADEI_ENABLED_SETUPS $ADEI_SETUP; do
        if [[ ! -a setups/$setup ]]; then
	    if [[ ! -a /adei/cfg/$setup ]]; then
	        (
		    cd /adei/cfg/
		    branch "http://darksoft.org/bzr/adei/setups/$setup"
                )
	    fi
	    ln -s ../../cfg/$setup setups/$setup
        fi
    done
  )
) 10> /adei/cfg/$LOCK_FILE 11> /adei/src/$LOCK_FILE