You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

147 lines
3.8 KiB

  1. #!/bin/bash
  2. set -eux # -x for verbose logging to juju debug-log
  3. #PASSWD=
  4. GIT_BASE=${GIT_BASE:-"git.0k.io:/var/git"}
  5. GIT_CLONE_OPTIONS=""
  6. GIT_CHECKOUT_REF="7.0/0k/dev/master" ## can be a branch, a tag or a commit SHA1
  7. apt-get install sudo libxml2-dev libxslt-dev libpq-dev libyaml-dev \
  8. zlib1g-dev libfreetype6-dev \
  9. libjpeg-dev libmysqlclient-dev -y --force-yes
  10. set +eux
  11. source /srv/virtualenv/default/bin/activate
  12. set -eux
  13. ## install deps for PIL compilations
  14. ## from http://www.sandersnewmedia.com/why/2012/04/16/installing-pil-virtualenv-ubuntu-1204
  15. if ! [ -e "/usr/lib/libjpeg.so" ]; then
  16. apt-get build-dep python-imaging -y --force-yes
  17. ln -s /usr/lib/`uname -i`-linux-gnu/libfreetype.so /usr/lib/
  18. ln -s /usr/lib/`uname -i`-linux-gnu/libjpeg.so /usr/lib/
  19. ln -s /usr/lib/`uname -i`-linux-gnu/libz.so /usr/lib/
  20. fi
  21. ## Installing PIL with our archive is safer.
  22. #pip install pil
  23. (
  24. cd /tmp &&
  25. scp "$GIT_BASE"/archives/PIL-1.1.7.tar.gz . &&
  26. tar xvzf PIL-1.1.7.tar.gz &&
  27. cd PIL-1.1.7 &&
  28. python setup.py install
  29. )
  30. pip install lxml pyparsing==1.5.7 psycopg2 pyyaml reportlab mako \
  31. pywebdav==0.9.4 feedparser caldav pytz pydot \
  32. python-dateutil==1.5 cherrypy==3.1.2 formencode==1.2.2 \
  33. babel simplejson==2.0.9 python-openid mysql-python vatnumber \
  34. mock unittest2 fudge docutils jinja2 gdata
  35. ## Install pychart... from our repo as :
  36. ## download link in PyPi is dead,
  37. ## and gna.org was down recently
  38. (
  39. scp "$GIT_BASE/archives/PyChart-1.39.tar.gz" /tmp &&
  40. cd /tmp && tar xvzf PyChart*.tar.gz &&
  41. cd PyChart* &&
  42. python setup.py install
  43. )
  44. ## Install OOOP... from our git repo as:
  45. ## we have some bug correction and custom features
  46. if ! [ -d "/opt/apps/ooop" ]; then
  47. (
  48. cd /opt/apps &&
  49. git clone $GIT_CLONE_OPTIONS "$GIT_BASE/0k/ooop.git" &&
  50. cd /opt/apps/ooop &&
  51. git checkout 0k/prod/master &&
  52. ## beurk
  53. ln -sf /opt/apps/ooop/ooop.py /srv/virtualenv/default/lib/python2.7/ooop.py
  54. )
  55. fi
  56. ##
  57. ## Install 0k-oe
  58. ##
  59. (
  60. cd /opt/apps &&
  61. git clone $GIT_CLONE_OPTIONS "$GIT_BASE"/0k/0k-oe.git &&
  62. cd /opt/apps/0k-oe &&
  63. git checkout "$GIT_CHECKOUT_REF" &&
  64. git sub setup
  65. )
  66. adduser --system --home=/var/lib/openerp --group openerp
  67. ## XXXvlab: warning password in charm !!
  68. cp -i etc/openerp-server.conf /etc/
  69. cp -i etc/init.d/openerp-server /etc/init.d/
  70. chown openerp /etc/openerp-server.conf
  71. chmod 600 /etc/openerp-server.conf
  72. chown openerp /etc/init.d/openerp-server
  73. update-rc.d openerp-server defaults
  74. mkdir /var/log/openerp
  75. touch /var/log/openerp/openerp-server.log
  76. chown openerp /var/log/openerp -R
  77. ## Install add-ons
  78. ## make a better way for installing add-ons
  79. #addons_path=/opt/apps/openobject-addons/0k
  80. #if ! [ -d "$addons_path" ]; then
  81. # mkdir -p $addons_path
  82. # for addons in $(/var/git/list-addons 0k/dev/master | grep ^0k); do
  83. # git clone -s /var/git/$addons /opt/apps/openobject-addons/${addons%.git}
  84. # (cd /opt/apps/openobject-addons/${addons%.git}
  85. # git checkout 6.1/0k/prod/master ||
  86. # git checkout 0k/prod/master ||
  87. # git checkout 0k/dev/master ||
  88. # git checkout 6.1/simplee/prod/master ||
  89. # git checkout simplee/prod/master ||
  90. # git checkout simplee/dev/master ||
  91. # git checkout master
  92. # )
  93. # done
  94. #else
  95. # echo 'WARNING: skipping modules installation as directory was already existent !'
  96. #fi
  97. ## Install werkzeug from github last version
  98. ## because last PyPi version is 8.4 and we need the 9.0+
  99. (
  100. cd /tmp &&
  101. git clone https://github.com/mitsuhiko/werkzeug.git &&
  102. cd werkzeug &&
  103. python setup.py install
  104. )
  105. ##
  106. ## Linking with external filestore !
  107. ##
  108. (
  109. cd /opt/apps/0k-oe/openobject-server/openerp &&
  110. ln -sf /var/openerp-filestore filestore &&
  111. cd /var/openerp-filestore &&
  112. chown openerp .
  113. )