|
@ -1,6 +1,6 @@ |
|
|
#!/bin/bash |
|
|
#!/bin/bash |
|
|
|
|
|
|
|
|
set -eux # -x for verbose logging to juju debug-log |
|
|
|
|
|
|
|
|
set -ex # -x for verbose logging to juju debug-log |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## |
|
|
## |
|
@ -22,71 +22,113 @@ GIT_0K_SUB_CLONE_OPTIONS=${GIT_0K_SUB_CLONE_OPTIONS:-""} |
|
|
GIT_0K_CHECKOUT_REF=${GIT_0K_CHECKOUT_REF:-"8.0/0k/dev/master"} |
|
|
GIT_0K_CHECKOUT_REF=${GIT_0K_CHECKOUT_REF:-"8.0/0k/dev/master"} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
release=$(lsb_release -c -s) |
|
|
|
|
|
|
|
|
RELEASE=${RELEASE:-} |
|
|
|
|
|
|
|
|
|
|
|
test -z "$RELEASE" && RELEASE=$(lsb_release -c -s) |
|
|
|
|
|
|
|
|
## |
|
|
## |
|
|
## Code |
|
|
## Code |
|
|
## |
|
|
## |
|
|
|
|
|
|
|
|
apt-get install sudo libxml2-dev libxslt-dev libpq-dev libyaml-dev \ |
|
|
|
|
|
zlib1g-dev libfreetype6-dev \ |
|
|
|
|
|
libsasl2-dev \ |
|
|
|
|
|
libjpeg-dev libmysqlclient-dev -y --force-yes |
|
|
|
|
|
|
|
|
|
|
|
set +eux |
|
|
|
|
|
source /srv/virtualenv/default/bin/activate |
|
|
|
|
|
set -eux |
|
|
|
|
|
|
|
|
if [ -z "$NO_VIRTUALENV" ]; then |
|
|
|
|
|
set +ex |
|
|
|
|
|
source /srv/virtualenv/default/bin/activate |
|
|
|
|
|
set -ex |
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if [ "$NO_VIRTUALENV" ]; then |
|
|
|
|
|
|
|
|
|
|
|
apt-get install -y --no-install-recommends python-geoip python-gevent \ |
|
|
|
|
|
python-ldap python-lxml python-markupsafe python-pil python-pip \ |
|
|
|
|
|
python-psutil python-psycopg2 python-pychart python-pydot python-pil \ |
|
|
|
|
|
python-reportlab python-simplejson python-yaml wget wkhtmltopdf \ |
|
|
|
|
|
python-mysqldb |
|
|
|
|
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
|
|
|
|
## |
|
|
|
|
|
## Installing PIL |
|
|
|
|
|
## |
|
|
|
|
|
|
|
|
## install deps for PIL compilations |
|
|
|
|
|
## from http://www.sandersnewmedia.com/why/2012/04/16/installing-pil-virtualenv-ubuntu-1204 |
|
|
|
|
|
|
|
|
## install deps for PIL compilations |
|
|
|
|
|
## from http://www.sandersnewmedia.com/why/2012/04/16/installing-pil-virtualenv-ubuntu-1204 |
|
|
|
|
|
|
|
|
if ! [ -e "/usr/lib/libjpeg.so" ]; then |
|
|
|
|
|
if [ "$release" == "trusty" ]; then |
|
|
|
|
|
|
|
|
DEV="libxml2-dev libxslt-dev libpq-dev libyaml-dev |
|
|
|
|
|
zlib1g-dev libfreetype6-dev |
|
|
|
|
|
libsasl2-dev libjpeg-dev libmysqlclient-dev" |
|
|
|
|
|
|
|
|
|
|
|
LIB="libxslt1.1 libpq5 libjpeg8 libtiff5 libmysqlclient18" |
|
|
|
|
|
|
|
|
|
|
|
apt-get install $DEV $LIB \ |
|
|
|
|
|
-y --force-yes --no-install-recommends |
|
|
|
|
|
|
|
|
|
|
|
if ! [ -e "/usr/lib/libjpeg.so" ]; then |
|
|
|
|
|
if [ "$RELEASE" == "trusty" ]; then |
|
|
## for some reason /etc/apt/sources.list can be WITHOUT deb-src lines |
|
|
## for some reason /etc/apt/sources.list can be WITHOUT deb-src lines |
|
|
apt-cache policy python-imaging | tail -n 1 | \ |
|
|
|
|
|
while read code url distrib arch type; do |
|
|
|
|
|
|
|
|
apt-cache policy python-imaging | tail -n 1 | \ |
|
|
|
|
|
while read code url distrib arch type; do |
|
|
echo deb-src $url $(echo "$distrib" | tr "/" " "); |
|
|
echo deb-src $url $(echo "$distrib" | tr "/" " "); |
|
|
done >> /etc/apt/sources.list && |
|
|
done >> /etc/apt/sources.list && |
|
|
apt-get update |
|
|
|
|
|
fi |
|
|
|
|
|
if ! [ -d "/usr/include/freetype2/freetype" ]; then |
|
|
|
|
|
(cd /usr/include/freetype2 && |
|
|
|
|
|
ln -sf . freetype) |
|
|
|
|
|
|
|
|
apt-get update |
|
|
|
|
|
fi |
|
|
|
|
|
if ! [ -d "/usr/include/freetype2/freetype" ]; then |
|
|
|
|
|
(cd /usr/include/freetype2 && |
|
|
|
|
|
ln -sf . freetype) |
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
apt-get build-dep python-imaging -y --force-yes && |
|
|
|
|
|
ln -s /usr/lib/`uname -i`-linux-gnu/libfreetype.so /usr/lib/ && |
|
|
|
|
|
ln -s /usr/lib/`uname -i`-linux-gnu/libjpeg.so /usr/lib/ && |
|
|
|
|
|
ln -s /usr/lib/`uname -i`-linux-gnu/libz.so /usr/lib/ |
|
|
|
|
|
|
|
|
fi |
|
|
fi |
|
|
|
|
|
|
|
|
apt-get build-dep python-imaging -y --force-yes && |
|
|
|
|
|
ln -s /usr/lib/`uname -i`-linux-gnu/libfreetype.so /usr/lib/ && |
|
|
|
|
|
ln -s /usr/lib/`uname -i`-linux-gnu/libjpeg.so /usr/lib/ && |
|
|
|
|
|
ln -s /usr/lib/`uname -i`-linux-gnu/libz.so /usr/lib/ |
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
## Installing PIL with our archive is safer. |
|
|
|
|
|
#pip install pil |
|
|
|
|
|
( |
|
|
|
|
|
cd /tmp && |
|
|
|
|
|
scp "$GIT_0K_BASE"/archives/PIL-1.1.7.tar.gz . && |
|
|
|
|
|
tar xvzf PIL-1.1.7.tar.gz && |
|
|
|
|
|
cd PIL-1.1.7 && |
|
|
|
|
|
python setup.py install |
|
|
|
|
|
|
|
|
|
|
|
cd /tmp |
|
|
|
|
|
rm -rf /tmp/PIL-1.1.7 |
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
## Installing PIL with our archive is safer. |
|
|
|
|
|
#pip install pil |
|
|
|
|
|
( |
|
|
|
|
|
cd /tmp && |
|
|
|
|
|
scp "$GIT_0K_BASE"/archives/PIL-1.1.7.tar.gz . && |
|
|
|
|
|
tar xvzf PIL-1.1.7.tar.gz && |
|
|
|
|
|
cd PIL-1.1.7 && |
|
|
|
|
|
python setup.py install |
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
pip install sact.epoch shyaml mock mysql-python |
|
|
|
|
|
|
|
|
## Install pychart... from our repo as : |
|
|
|
|
|
## download link in PyPi is dead, |
|
|
|
|
|
## and gna.org was down recently |
|
|
|
|
|
( |
|
|
|
|
|
scp "$GIT_0K_BASE/archives/PyChart-1.39.tar.gz" /tmp && |
|
|
|
|
|
cd /tmp && tar xvzf PyChart*.tar.gz && |
|
|
|
|
|
cd PyChart* && |
|
|
|
|
|
python setup.py install && |
|
|
|
|
|
cd /tmp && |
|
|
|
|
|
rm -rf /tmp/PyChart* |
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
## Install pychart... from our repo as : |
|
|
|
|
|
## download link in PyPi is dead, |
|
|
|
|
|
## and gna.org was down recently |
|
|
|
|
|
( |
|
|
|
|
|
scp "$GIT_0K_BASE/archives/PyChart-1.39.tar.gz" /tmp && |
|
|
|
|
|
cd /tmp && tar xvzf PyChart*.tar.gz && |
|
|
|
|
|
cd PyChart* && |
|
|
|
|
|
python setup.py install |
|
|
|
|
|
|
|
|
## should be in connectors requirements. |
|
|
|
|
|
pip install mysql-python |
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pip install sact.epoch shyaml |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Install OOOP... from our git repo as: |
|
|
## Install OOOP... from our git repo as: |
|
|
## we have some bug correction and custom features |
|
|
## we have some bug correction and custom features |
|
|
|
|
|
PYTHON_LIB_DEST=/usr/lib/python2.7 |
|
|
|
|
|
if [ -z "$NO_VIRTUALENV" ]; then |
|
|
|
|
|
PYTHON_LIB_DEST=/srv/virtualenv/default/lib/python2.7 |
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
mkdir -p /opt/apps |
|
|
if ! [ -d "/opt/apps/ooop" ]; then |
|
|
if ! [ -d "/opt/apps/ooop" ]; then |
|
|
( |
|
|
( |
|
|
cd /opt/apps && |
|
|
cd /opt/apps && |
|
@ -95,7 +137,8 @@ if ! [ -d "/opt/apps/ooop" ]; then |
|
|
git checkout 0k/prod/master && |
|
|
git checkout 0k/prod/master && |
|
|
|
|
|
|
|
|
## beurk |
|
|
## beurk |
|
|
ln -sf /opt/apps/ooop/ooop.py /srv/virtualenv/default/lib/python2.7/ooop.py |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ln -sf /opt/apps/ooop/ooop.py $PYTHON_LIB_DEST/ooop.py |
|
|
) |
|
|
) |
|
|
fi |
|
|
fi |
|
|
|
|
|
|
|
@ -109,42 +152,86 @@ if ! [ -d "/opt/apps/aeroolib" ]; then |
|
|
git checkout master && |
|
|
git checkout master && |
|
|
|
|
|
|
|
|
## beurk |
|
|
## beurk |
|
|
ln -sf /opt/apps/aeroolib/aeroolib/aeroolib /srv/virtualenv/default/lib/python2.7/aeroolib |
|
|
|
|
|
|
|
|
ln -sf /opt/apps/aeroolib/aeroolib/aeroolib $PYTHON_LIB_DEST/aeroolib |
|
|
) |
|
|
) |
|
|
fi |
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
## Install werkzeug from github last version |
|
|
|
|
|
## because last PyPi version is 8.4 and we need the 9.0+ |
|
|
|
|
|
|
|
|
|
|
|
( |
|
|
|
|
|
cd /tmp && |
|
|
|
|
|
git clone https://github.com/mitsuhiko/werkzeug.git && |
|
|
|
|
|
cd werkzeug && |
|
|
|
|
|
python setup.py install && |
|
|
|
|
|
cd /tmp && |
|
|
|
|
|
rm -rf werkzeug |
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## |
|
|
## |
|
|
## Install 0k-oe |
|
|
## Install 0k-oe |
|
|
## |
|
|
## |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
AVOID_INSTALL= |
|
|
|
|
|
if [ "$NO_VIRTUALENV" ]; then |
|
|
|
|
|
## These are provided in the system already |
|
|
|
|
|
AVOID_INSTALL="psycopg2 pil lxml gevent python-ldap MarkupSafe |
|
|
|
|
|
psutil http://download.gna.org/pychart/PyChart-1.39.tar.gz |
|
|
|
|
|
pydot reportlab simplejson PyYAML" |
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
( |
|
|
( |
|
|
cd /opt/apps && |
|
|
|
|
|
git sub clone $GIT_0K_CLONE_OPTIONS $GIT_0K_SUB_CLONE_OPTIONS -b "$GIT_0K_CHECKOUT_REF" \ |
|
|
|
|
|
"$GIT_0K_BASE"/0k/0k-oe && |
|
|
|
|
|
|
|
|
cd /opt/apps || exit 1 |
|
|
|
|
|
if [ "$ODOO_CP_FROM_DIR" ]; then |
|
|
|
|
|
cp -a "$ODOO_CP_FROM_DIR" "/opt/apps/0k-oe" |
|
|
|
|
|
else |
|
|
|
|
|
git sub clone $GIT_0K_CLONE_OPTIONS $GIT_0K_SUB_CLONE_OPTIONS -b "$GIT_0K_CHECKOUT_REF" \ |
|
|
|
|
|
"$GIT_0K_BASE"/0k/0k-oe |
|
|
|
|
|
fi && |
|
|
cd 0k-oe && |
|
|
cd 0k-oe && |
|
|
pip install -r odoo/requirements.txt && |
|
|
|
|
|
|
|
|
( |
|
|
|
|
|
[ -e odoo/requirements.txt ] && cat odoo/requirements.txt |
|
|
for req in addons/*/requirements.txt; do |
|
|
for req in addons/*/requirements.txt; do |
|
|
if [ -r "$req" ]; then |
|
|
if [ -r "$req" ]; then |
|
|
pip install -r "$req" |
|
|
|
|
|
|
|
|
cat "$req" |
|
|
fi |
|
|
fi |
|
|
done |
|
|
done |
|
|
|
|
|
) | sort -u > /tmp/requirements.txt |
|
|
|
|
|
for pack in $AVOID_INSTALL; do |
|
|
|
|
|
sed -ri "s%^($pack.*)$%#\1%g" /tmp/requirements.txt |
|
|
|
|
|
done |
|
|
|
|
|
pip install -r /tmp/requirements.txt || exit 1 |
|
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
rm /tmp/requirements.txt |
|
|
|
|
|
|
|
|
|
|
|
) || exit 1 |
|
|
|
|
|
## System user |
|
|
|
|
|
|
|
|
adduser --system --home=/var/lib/openerp --group openerp |
|
|
adduser --system --home=/var/lib/openerp --group openerp |
|
|
|
|
|
|
|
|
## XXXvlab: warning password in charm !! |
|
|
|
|
|
cp -i etc/openerp-server.conf /etc/ |
|
|
|
|
|
sed -ri "s/%%PASSWORD%%/$OPENERP_PASSWORD/g" /etc/openerp-server.conf |
|
|
|
|
|
|
|
|
|
|
|
cp -i etc/init.d/openerp-server /etc/init.d/ |
|
|
|
|
|
|
|
|
## /etc/init.d |
|
|
|
|
|
|
|
|
|
|
|
if [ -z "$DOCKER" ]; then |
|
|
|
|
|
cp -i etc/init.d/openerp-server /etc/init.d/ |
|
|
|
|
|
chown openerp /etc/init.d/openerp-server |
|
|
|
|
|
update-rc.d openerp-server defaults |
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## /etc/openerp-server.conf |
|
|
|
|
|
|
|
|
|
|
|
cp -i etc/openerp-server.conf /etc/ |
|
|
|
|
|
sed -ri "s/%%PASSWORD%%/$OPENERP_PASSWORD/g" /etc/openerp-server.conf |
|
|
chown openerp /etc/openerp-server.conf |
|
|
chown openerp /etc/openerp-server.conf |
|
|
chmod 600 /etc/openerp-server.conf |
|
|
chmod 600 /etc/openerp-server.conf |
|
|
chown openerp /etc/init.d/openerp-server |
|
|
|
|
|
|
|
|
|
|
|
update-rc.d openerp-server defaults |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Log dir |
|
|
|
|
|
|
|
|
mkdir -p /var/log/openerp |
|
|
mkdir -p /var/log/openerp |
|
|
touch /var/log/openerp/openerp-server.log |
|
|
touch /var/log/openerp/openerp-server.log |
|
@ -152,39 +239,6 @@ chown openerp /var/log/openerp -R |
|
|
|
|
|
|
|
|
cp -i etc/default/openerp-server /etc/default/openerp-server |
|
|
cp -i etc/default/openerp-server /etc/default/openerp-server |
|
|
|
|
|
|
|
|
## Install add-ons |
|
|
|
|
|
## make a better way for installing add-ons |
|
|
|
|
|
|
|
|
|
|
|
#addons_path=/opt/apps/openobject-addons/0k |
|
|
|
|
|
#if ! [ -d "$addons_path" ]; then |
|
|
|
|
|
# mkdir -p $addons_path |
|
|
|
|
|
# for addons in $(/var/git/list-addons 0k/dev/master | grep ^0k); do |
|
|
|
|
|
# git clone -s /var/git/$addons /opt/apps/openobject-addons/${addons%.git} |
|
|
|
|
|
# (cd /opt/apps/openobject-addons/${addons%.git} |
|
|
|
|
|
# git checkout 6.1/0k/prod/master || |
|
|
|
|
|
# git checkout 0k/prod/master || |
|
|
|
|
|
# git checkout 0k/dev/master || |
|
|
|
|
|
# git checkout 6.1/simplee/prod/master || |
|
|
|
|
|
# git checkout simplee/prod/master || |
|
|
|
|
|
# git checkout simplee/dev/master || |
|
|
|
|
|
# git checkout master |
|
|
|
|
|
# ) |
|
|
|
|
|
# done |
|
|
|
|
|
#else |
|
|
|
|
|
# echo 'WARNING: skipping modules installation as directory was already existent !' |
|
|
|
|
|
#fi |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Install werkzeug from github last version |
|
|
|
|
|
## because last PyPi version is 8.4 and we need the 9.0+ |
|
|
|
|
|
|
|
|
|
|
|
( |
|
|
|
|
|
cd /tmp && |
|
|
|
|
|
git clone https://github.com/mitsuhiko/werkzeug.git && |
|
|
|
|
|
cd werkzeug && |
|
|
|
|
|
python setup.py install |
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## |
|
|
## |
|
|
## Linking with external filestore ! |
|
|
## Linking with external filestore ! |
|
@ -192,26 +246,24 @@ python setup.py install |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
( |
|
|
( |
|
|
cd /opt/apps/0k-oe/openobject-server/openerp && |
|
|
|
|
|
mkdir -p /var/openerp-filestore && |
|
|
|
|
|
ln -sf /var/openerp-filestore filestore && |
|
|
|
|
|
cd /var/openerp-filestore && |
|
|
|
|
|
chown openerp . |
|
|
|
|
|
|
|
|
## keeping for compatibility with older version |
|
|
|
|
|
cd /opt/apps/0k-oe/odoo/openerp && |
|
|
|
|
|
mkdir -p /var/openerp-filestore && |
|
|
|
|
|
ln -sf /var/openerp-filestore filestore && |
|
|
|
|
|
cd /var/openerp-filestore && |
|
|
|
|
|
chown openerp . |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
ln -sf "/opt/apps/0k-oe/bin/oe" "/usr/local/bin/oe" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## |
|
|
## |
|
|
## Install 0k-manage for the handy oe command |
|
|
|
|
|
|
|
|
## Remove all unwanted libs |
|
|
## |
|
|
## |
|
|
|
|
|
|
|
|
( |
|
|
|
|
|
if ! [ -d "/opt/apps/0k-manage" ]; then |
|
|
|
|
|
cd /opt/apps && |
|
|
|
|
|
git clone $GIT_0K_CLONE_OPTIONS "$GIT_0K_BASE/0k/0k-manage.git" && |
|
|
|
|
|
cd /opt/apps/0k-manage && |
|
|
|
|
|
git checkout 0k/prod/master |
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
if [ -z "$NO_VIRTUALENV" ]; then |
|
|
|
|
|
apt-get autoremove -y --force-yes $(apt-cache showsrc python-imaging | |
|
|
|
|
|
sed -e '/Build-Depends/!d;s/Build-Depends: \|,\|([^)]*),*\|\[[^]]*\]//g') |
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
## beurk |
|
|
|
|
|
ln -sf "/opt/apps/0k-manage/src/bin/oe" "/usr/local/bin/oe" |
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
apt-get autoremove $DEV -y --force-yes |