summaryrefslogtreecommitdiff
path: root/~lukeshu/parabolaweb-git/parabolaweb.install
blob: 0eaaf84c9b8289aec48e01039fe68ad368ac0901 (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
# These will make it install into /http/srv/web
_install_dir='/srv/http'
_gitname='web'

_gitroot='https://projects.parabolagnulinux.org/parabolaweb.git'
_gitbranch='master'

msg() {
  echo $@
}

_main() {
  set -e
  if [ ! -d "$_install_dir" ]; then
    mkdir "$_install_dir"
  fi
  cd "$_install_dir"

  msg "Connecting to GIT server...."

  if [ -d ${_gitname} ] ; then
    cd ${_gitname}
    git pull ${_gitroot}
    msg "The local files are updated."
  else
    git clone ${_gitroot} ${_gitname}
    cd ${_gitname}
  fi
  git checkout ${_gitbranch}

  msg "GIT checkout done or server timeout"

  msg "Checking configuration...."

  if [ ! -f local_settings.py ]; then
    cp local_settings.py.example local_settings.py.tmp
    $EDITOR local_settings.py.tmp
    mv local_settings.py.tmp local_settings.py
    msg "Creating database...."
    ./manage.py syncdb
  fi
  
  find . -name '*.pyc' -delete
  ./manage.py migrate
  ./manage.py loaddata */fixtures/*.json
}

# arg 1:  the new package version
post_install() {
  _main
}

# arg 1:  the new package version
# arg 2:  the old package version
post_upgrade() {
  _main
}

# vim:set ts=2 sw=2 et: