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 genshi==0.6 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 sact.epoch \
  35. shyaml
  36. ## Install pychart... from our repo as :
  37. ## download link in PyPi is dead,
  38. ## and gna.org was down recently
  39. (
  40. scp "$GIT_BASE/archives/PyChart-1.39.tar.gz" /tmp &&
  41. cd /tmp && tar xvzf PyChart*.tar.gz &&
  42. cd PyChart* &&
  43. python setup.py install
  44. )
  45. ## Install OOOP... from our git repo as:
  46. ## we have some bug correction and custom features
  47. if ! [ -d "/opt/apps/ooop" ]; then
  48. (
  49. cd /opt/apps &&
  50. git clone $GIT_CLONE_OPTIONS "$GIT_BASE/0k/ooop.git" &&
  51. cd /opt/apps/ooop &&
  52. git checkout 0k/prod/master &&
  53. ## beurk
  54. ln -sf /opt/apps/ooop/ooop.py /srv/virtualenv/default/lib/python2.7/ooop.py
  55. )
  56. fi
  57. ##
  58. ## Install 0k-oe
  59. ##
  60. (
  61. cd /opt/apps &&
  62. git clone $GIT_CLONE_OPTIONS "$GIT_BASE"/0k/0k-oe.git &&
  63. cd /opt/apps/0k-oe &&
  64. git checkout "$GIT_CHECKOUT_REF" &&
  65. git sub setup
  66. )
  67. adduser --system --home=/var/lib/openerp --group openerp
  68. ## XXXvlab: warning password in charm !!
  69. cp -i etc/openerp-server.conf /etc/
  70. cp -i etc/init.d/openerp-server /etc/init.d/
  71. chown openerp /etc/openerp-server.conf
  72. chmod 600 /etc/openerp-server.conf
  73. chown openerp /etc/init.d/openerp-server
  74. update-rc.d openerp-server defaults
  75. mkdir /var/log/openerp
  76. touch /var/log/openerp/openerp-server.log
  77. chown openerp /var/log/openerp -R
  78. ## Install add-ons
  79. ## make a better way for installing add-ons
  80. #addons_path=/opt/apps/openobject-addons/0k
  81. #if ! [ -d "$addons_path" ]; then
  82. # mkdir -p $addons_path
  83. # for addons in $(/var/git/list-addons 0k/dev/master | grep ^0k); do
  84. # git clone -s /var/git/$addons /opt/apps/openobject-addons/${addons%.git}
  85. # (cd /opt/apps/openobject-addons/${addons%.git}
  86. # git checkout 6.1/0k/prod/master ||
  87. # git checkout 0k/prod/master ||
  88. # git checkout 0k/dev/master ||
  89. # git checkout 6.1/simplee/prod/master ||
  90. # git checkout simplee/prod/master ||
  91. # git checkout simplee/dev/master ||
  92. # git checkout master
  93. # )
  94. # done
  95. #else
  96. # echo 'WARNING: skipping modules installation as directory was already existent !'
  97. #fi
  98. ## Install werkzeug from github last version
  99. ## because last PyPi version is 8.4 and we need the 9.0+
  100. (
  101. cd /tmp &&
  102. git clone https://github.com/mitsuhiko/werkzeug.git &&
  103. cd werkzeug &&
  104. python setup.py install
  105. )
  106. ##
  107. ## Linking with external filestore !
  108. ##
  109. (
  110. cd /opt/apps/0k-oe/openobject-server/openerp &&
  111. ln -sf /var/openerp-filestore filestore &&
  112. cd /var/openerp-filestore &&
  113. chown openerp .
  114. )