mirror of
https://github.com/YunoHost-Apps/libreerp_ynh.git
synced 2024-09-03 19:36:13 +02:00
Fix install
This commit is contained in:
parent
522c6796da
commit
b8ac53c709
14 changed files with 92 additions and 77 deletions
|
@ -1,8 +1,8 @@
|
|||
;; Test complet sans multisite
|
||||
auto_remove=1
|
||||
; Manifest
|
||||
domain="domain.tld" (DOMAIN)
|
||||
version="12"
|
||||
domain="domain.tld"
|
||||
version="14"
|
||||
oca=0
|
||||
admin_password="testpassw0rD"
|
||||
lang="en_US"
|
||||
|
@ -17,24 +17,8 @@
|
|||
upgrade=1
|
||||
backup_restore=1
|
||||
multi_instance=1
|
||||
wrong_user=1
|
||||
wrong_path=0
|
||||
incorrect_path=0
|
||||
corrupt_source=1
|
||||
fail_download_source=1
|
||||
port_already_use=1
|
||||
final_path_already_use=1
|
||||
;;; Levels
|
||||
Level 1=auto
|
||||
Level 2=auto
|
||||
Level 3=auto
|
||||
Level 4=1
|
||||
Level 5=auto
|
||||
Level 6=auto
|
||||
Level 7=auto
|
||||
Level 8=0
|
||||
Level 9=0
|
||||
Level 10=0
|
||||
port_already_use=0
|
||||
change_url=0
|
||||
;;; Options
|
||||
Email=ljf+libreerp_ynh@reflexlibre.net
|
||||
Notification=down
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
SOURCE_URL=https://github.com/odoo/odoo/archive/206e0b71ac74147a989db60cddae801534b97bdc.tar.gz
|
||||
SOURCE_SUM=a6d8d28bb7f20ac88fd149c652d7e4ce0f35241e46e7a3a347265dae0d7535fe
|
||||
SOURCE_URL=https://github.com/odoo/odoo/archive/336c9aab3619abb5bfbeb07f87ae014facdefb0b.tar.gz
|
||||
SOURCE_SUM=3d37bc31383bfad827c3fdbab4daa3914ad036fd70fe1f20925ed18d2b9e1f87
|
||||
SOURCE_FILENAME=odoo-12.tar.gz
|
||||
SOURCE_FORMAT=tar.gz
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
|
|
5
conf/14.src
Normal file
5
conf/14.src
Normal file
|
@ -0,0 +1,5 @@
|
|||
SOURCE_URL=https://github.com/odoo/odoo/archive/d8322e64c6d999ffc72093b2ef2db91532138c89.tar.gz
|
||||
SOURCE_SUM=40cbbc93ab594f614499ccdd04922590c420bfadeaf2f889853a5d58073e5fef
|
||||
SOURCE_FILENAME=odoo-14.tar.gz
|
||||
SOURCE_FORMAT=tar.gz
|
||||
SOURCE_SUM_PRG=sha256sum
|
|
@ -1,16 +1,16 @@
|
|||
[Unit]
|
||||
Description={{ app }}
|
||||
Description=__APP__
|
||||
Requires=postgresql.service
|
||||
After=network.target postgresql.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
SyslogIdentifier={{ app }}
|
||||
SyslogIdentifier=__APP__
|
||||
PermissionsStartOnly=true
|
||||
User={{ app }}
|
||||
Group={{ app }}
|
||||
User=__APP__
|
||||
Group=__APP__
|
||||
Environment=PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin
|
||||
ExecStart={{ bin_file }} --config {{ conf_file }} --logfile /var/log/{{ app }}.log
|
||||
ExecStart=__BIN_FILE__ --config __CONF_FILE__ --logfile /var/log/__APP__.log
|
||||
Restart=always
|
||||
RestartSec=3
|
||||
StandardOutput=journal+console
|
||||
|
|
|
@ -2,10 +2,10 @@ location / {
|
|||
if ($scheme = http) {
|
||||
rewrite ^ https://$server_name$request_uri? permanent;
|
||||
}
|
||||
try_files $uri @{{ app }};
|
||||
try_files $uri @__APP__;
|
||||
}
|
||||
location @{{ app }} {
|
||||
proxy_pass http://127.0.0.1:{{ port }};
|
||||
location @__APP__ {
|
||||
proxy_pass http://127.0.0.1:__PORT__;
|
||||
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
|
||||
proxy_buffers 16 64k;
|
||||
proxy_buffer_size 128k;
|
||||
|
@ -20,7 +20,7 @@ location @{{ app }} {
|
|||
proxy_send_timeout 720s;
|
||||
}
|
||||
location /longpolling {
|
||||
proxy_pass http://127.0.0.1:{{ port_chat }};
|
||||
proxy_pass http://127.0.0.1:__PORT_CHAT__;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
|
@ -34,7 +34,7 @@ location ~* /web/static/ {
|
|||
proxy_cache_valid 200 90m;
|
||||
proxy_buffering on;
|
||||
expires 864000;
|
||||
proxy_pass http://127.0.0.1:{{ port }};
|
||||
proxy_pass http://127.0.0.1:__PORT__;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
|
|
5
conf/oca-12.src
Normal file
5
conf/oca-12.src
Normal file
|
@ -0,0 +1,5 @@
|
|||
SOURCE_URL=https://github.com/OCA/OCB/archive/4df6b0b164c6f384fdb7df40e51e80780572273a.tar.gz
|
||||
SOURCE_SUM=e064dcd121ca207cbfa18c5f5f63c394ee6a1ca03f9ebbd6b88e6a62dda6bca0
|
||||
SOURCE_FILENAME=odoo-12.tar.gz
|
||||
SOURCE_FORMAT=tar.gz
|
||||
SOURCE_SUM_PRG=sha256sum
|
5
conf/oca-14.src
Normal file
5
conf/oca-14.src
Normal file
|
@ -0,0 +1,5 @@
|
|||
SOURCE_URL=https://github.com/OCA/OCB/archive/b7dc86b530718c090ba26b8eea0154d1c50c05f2.tar.gz
|
||||
SOURCE_SUM=d2ca8bbe913e90f1623c6f2375d4cd2c40d4ed4abb650e66f7691669cbab90fa
|
||||
SOURCE_FILENAME=odoo-14.tar.gz
|
||||
SOURCE_FORMAT=tar.gz
|
||||
SOURCE_SUM_PRG=sha256sum
|
|
@ -1,22 +1,18 @@
|
|||
[options]
|
||||
; This is the password that allows database operations:
|
||||
without_demo = all
|
||||
admin_passwd = {{ admin_password }}
|
||||
admin_passwd = __ADMIN_PASSWORD__
|
||||
db_host = localhost
|
||||
db_port = 5432
|
||||
db_user = {{ db_name }}
|
||||
db_password = {{ db_pass }}
|
||||
{% if preinstall == '1' %}
|
||||
dbfilter = ^{{ db_name }}$
|
||||
{% else %}
|
||||
db_name = {{ db_name }}
|
||||
{% if app_version > 9 %}dbfilter = False{% endif %}
|
||||
list_db = False
|
||||
{% endif %}
|
||||
addons_path = {{ final_path }}/{{ APPNAME }}/addons,{{ final_path }}/custom-addons
|
||||
db_user = __DB_NAME__
|
||||
db_password = __DB_PASS__
|
||||
__CONTENT__
|
||||
__CONTENT2__
|
||||
__CONTENT3__
|
||||
addons_path = __FINAL_PATH__/__APPNAME__/addons,__FINAL_PATH__/custom-addons
|
||||
proxy_mode = true
|
||||
logfile = /var/log/{{ app }}.log
|
||||
logfile = /var/log/__APP__.log
|
||||
xmlrpc_interface = 127.0.0.1
|
||||
netrpc_interface = 127.0.0.1
|
||||
xmlrpc_port = {{ port }}
|
||||
longpolling_port = {{ port_chat }}
|
||||
xmlrpc_port = __PORT__
|
||||
longpolling_port = __PORT_CHAT__
|
||||
|
|
|
@ -34,8 +34,8 @@
|
|||
"example": "erp.domain.org"
|
||||
}, {
|
||||
"name": "version",
|
||||
"choices": ["8", "9", "10", "11", "12"],
|
||||
"default": "12",
|
||||
"choices": ["11", "12", "14"],
|
||||
"default": "14",
|
||||
"ask": {
|
||||
"en": "Choose the version you want",
|
||||
"fr": "Choisissez la version désirée"
|
||||
|
|
|
@ -2,31 +2,35 @@
|
|||
# Common variables
|
||||
#
|
||||
|
||||
export APPNAME="libreerp"
|
||||
export appname="libreerp"
|
||||
export FORKNAME="odoo"
|
||||
DEPENDENCIES="curl postgresql xfonts-75dpi xfonts-base wkhtmltopdf node-less python3-dev gcc libldap2-dev libssl-dev libsasl2-dev python3-pip python3-dev python3-venv python3-wheel libxslt-dev libzip-dev python3-setuptools python-virtualenv python-wheel python-setuptools libjpeg-dev zlib1g-dev virtualenv libfreetype6-dev"
|
||||
|
||||
function debranding() {
|
||||
# Remove Odoo references to avoid trademark issue
|
||||
if [ -d $final_path/$APPNAME/$FORKNAME ]; then
|
||||
python_app=$final_path/$APPNAME/$FORKNAME
|
||||
if [ -d $final_path/$appname/$FORKNAME ]; then
|
||||
python_app=$final_path/$appname/$FORKNAME
|
||||
else
|
||||
python_app=$final_path/$APPNAME/openerp
|
||||
python_app=$final_path/$appname/openerp
|
||||
fi
|
||||
find $final_path/$APPNAME -type f \( -iname '*.xml' -o -iname '*.po' \) -exec sed -i 's/Powered by <a[^>]*>Odoo<\/a>//g' {} \;
|
||||
find $final_path/$APPNAME -type f \( -iname '*.xml' -o -iname '*.po' \) -exec sed -i 's/<a[^>]*>Powered by <[^>]*>Odoo<\/[^>]*><\/a>//g' {} \;
|
||||
find $final_path/$APPNAME -type f \( -iname '*.xml' -o -iname '*.po' \) -exec sed -i 's/Powered by <[^>]*>Odoo<\/[^>]*>//g' {} \;
|
||||
find $final_path/$APPNAME -type f \( -iname '*.xml' -o -iname '*.po' \) -exec sed -i 's/Powered by <[^>]*><img[^>]*Odoo[^>]*><\/a>//g' {} \;
|
||||
sed -i 's/<a[^>]*>My Odoo.com account<\/a>//g' $final_path/$APPNAME/addons/web/static/src/xml/base.xml
|
||||
sed -i 's/<a[^>]*>Documentation<\/a>//g' $final_path/$APPNAME/addons/web/static/src/xml/base.xml
|
||||
sed -i 's/<a[^>]*>Support<\/a>//g' $final_path/$APPNAME/addons/web/static/src/xml/base.xml
|
||||
find $final_path/$appname -type f \( -iname '*.xml' -o -iname '*.po' \) -exec sed -i 's/Powered by <a[^>]*>Odoo<\/a>//g' {} \;
|
||||
find $final_path/$appname -type f \( -iname '*.xml' -o -iname '*.po' \) -exec sed -i 's/<a[^>]*>Powered by <[^>]*>Odoo<\/[^>]*><\/a>//g' {} \;
|
||||
find $final_path/$appname -type f \( -iname '*.xml' -o -iname '*.po' \) -exec sed -i 's/Powered by <[^>]*>Odoo<\/[^>]*>//g' {} \;
|
||||
find $final_path/$appname -type f \( -iname '*.xml' -o -iname '*.po' \) -exec sed -i 's/Powered by <[^>]*><img[^>]*Odoo[^>]*><\/a>//g' {} \;
|
||||
sed -i 's/<a[^>]*>My Odoo.com account<\/a>//g' $final_path/$appname/addons/web/static/src/xml/base.xml
|
||||
sed -i 's/<a[^>]*>Documentation<\/a>//g' $final_path/$appname/addons/web/static/src/xml/base.xml
|
||||
sed -i 's/<a[^>]*>Support<\/a>//g' $final_path/$appname/addons/web/static/src/xml/base.xml
|
||||
cp ../conf/logo_type.png $python_app/addons/base/static/img/logo_white.png
|
||||
cp ../conf/favicon.ico $final_path/$APPNAME/addons/web/static/src/img/favicon.ico
|
||||
cp ../conf/favicon.ico $final_path/$appname/addons/web/static/src/img/favicon.ico
|
||||
|
||||
}
|
||||
function setup_files() {
|
||||
|
||||
ynh_setup_source $final_path/$APPNAME $app_version
|
||||
if [[ $oca -eq 0 ]]; then
|
||||
ynh_setup_source $final_path/$appname $app_version
|
||||
else
|
||||
ynh_setup_source $final_path/$appname "oca-$app_version"
|
||||
fi
|
||||
debranding
|
||||
mkdir -p $final_path/custom-addons
|
||||
chown -R $app:$app $final_path
|
||||
|
@ -38,10 +42,10 @@ function setup_files() {
|
|||
chown $app:$app $conf_file
|
||||
|
||||
# Autoinstall the LDAP auth module
|
||||
if ls $final_path/$APPNAME/$FORKNAME-bin > /dev/null ; then
|
||||
ynh_replace_string "^{$" "{'auto_install': True," ${final_path}/$APPNAME/addons/auth_ldap/__manifest__.py
|
||||
if ls $final_path/$appname/$FORKNAME-bin > /dev/null ; then
|
||||
ynh_replace_string "^{$" "{'auto_install': True," ${final_path}/$appname/addons/auth_ldap/__manifest__.py
|
||||
else
|
||||
ynh_replace_string "'auto_install': False" "'auto_install': True" ${final_path}/$APPNAME/addons/auth_ldap/__openerp__.py
|
||||
ynh_replace_string "'auto_install': False" "'auto_install': True" ${final_path}/$appname/addons/auth_ldap/__openerp__.py
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@ -63,14 +67,14 @@ function install_dependencies() {
|
|||
fi
|
||||
fi
|
||||
pushd $final_path
|
||||
if grep "python3" $final_path/$APPNAME/$FORKNAME-bin ; then
|
||||
if grep "python3" $final_path/$appname/$FORKNAME-bin ; then
|
||||
python3 -m venv venv
|
||||
venv/bin/pip3 install wheel
|
||||
venv/bin/pip3 install -r $APPNAME/requirements.txt
|
||||
venv/bin/pip3 install -r $appname/requirements.txt
|
||||
else
|
||||
virtualenv venv
|
||||
venv/bin/pip install wheel
|
||||
venv/bin/pip install -r $APPNAME/requirements.txt
|
||||
venv/bin/pip install -r $appname/requirements.txt
|
||||
fi
|
||||
popd
|
||||
}
|
||||
|
|
|
@ -32,11 +32,26 @@ ynh_sso_access () {
|
|||
ynh_configure () {
|
||||
local TEMPLATE=$1
|
||||
local DEST=$2
|
||||
content=""
|
||||
content2=""
|
||||
content3=""
|
||||
if [[ $preinstall == '1' ]]
|
||||
then
|
||||
content="dbfilter = $db_name"
|
||||
else
|
||||
content="db_name = $db_name"
|
||||
if [[ $app_version > 9 ]]
|
||||
then
|
||||
content2="dbfilter = False"
|
||||
fi
|
||||
content3="list_db = False"
|
||||
fi
|
||||
|
||||
mkdir -p "$(dirname $DEST)"
|
||||
if [ -f '../manifest.json' ] ; then
|
||||
ynh_render_template "${YNH_CWD}/../conf/$TEMPLATE.j2" "$DEST"
|
||||
ynh_add_config "${YNH_CWD}/../conf/$TEMPLATE.j2" "$DEST"
|
||||
else
|
||||
ynh_render_template "${YNH_CWD}/../settings/conf/$TEMPLATE.j2" "$DEST"
|
||||
ynh_add_config "${YNH_CWD}/../settings/conf/$TEMPLATE.j2" "$DEST"
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ final_path=$(ynh_app_setting_get "$app" final_path)
|
|||
conf_file=$(ynh_app_setting_get "$app" conf_file)
|
||||
|
||||
# Backup sources & data
|
||||
ynh_backup "${final_path}/$APPNAME"
|
||||
ynh_backup "${final_path}/$appname"
|
||||
ynh_backup "${final_path}/custom-addons"
|
||||
ynh_backup "${final_path}/.local"
|
||||
|
||||
|
|
|
@ -15,12 +15,12 @@ export app_version=$YNH_APP_ARG_VERSION
|
|||
export is_public=0
|
||||
export final_path="/var/www/$app"
|
||||
export conf_file=/etc/$app/main.conf
|
||||
export bin_file="$final_path/venv/bin/python $final_path/$APPNAME/$FORKNAME-bin"
|
||||
export bin_file="$final_path/venv/bin/python3 $final_path/$appname/$FORKNAME-bin"
|
||||
if [ "$app_version" = "9" ]; then
|
||||
bin_file="$final_path/venv/bin/python $final_path/$APPNAME/$FORKNAME.py"
|
||||
bin_file="$final_path/venv/bin/python3 $final_path/$appname/$FORKNAME.py"
|
||||
fi
|
||||
if [ "$app_version" = "8" ]; then
|
||||
bin_file="$final_path/venv/bin/python $final_path/$APPNAME/$FORKNAME.py"
|
||||
bin_file="$final_path/venv/bin/python3 $final_path/$appname/$FORKNAME.py"
|
||||
fi
|
||||
export db_name=$(ynh_sanitize_dbid $app)
|
||||
export port=$(ynh_find_port 8069)
|
||||
|
@ -43,8 +43,9 @@ function setup_database() {
|
|||
ynh_configure server.conf $conf_file
|
||||
chown $app:$app $conf_file
|
||||
# Load translation
|
||||
#param=" --without-demo True --addons-path $final_path/$APPNAME/addons --db_user $app --db_password $db_pass --db_host 127.0.0.1 --db_port 5432 --db-filter '^$app\$' -d $app "
|
||||
#param=" --without-demo True --addons-path $final_path/$appname/addons --db_user $app --db_password $db_pass --db_host 127.0.0.1 --db_port 5432 --db-filter '^$app\$' -d $app "
|
||||
param=" -c $conf_file -d $app "
|
||||
sudo -u $app $bin_file -c $conf_file --stop-after-init -i base -d $app
|
||||
sudo -u $app $bin_file -c $conf_file --stop-after-init -i auth_ldap -d $app
|
||||
sudo -u $app $bin_file -c $conf_file --stop-after-init --load-language $lang -d $app
|
||||
# Configure language, timezone and ldap
|
||||
|
|
|
@ -19,12 +19,12 @@ export db_pass=$(ynh_app_setting_get $app psqlpwd)
|
|||
export final_path=$(ynh_app_setting_get $app final_path)
|
||||
export conf_file=$(ynh_app_setting_get $app conf_file)
|
||||
export is_public=0
|
||||
export bin_file="$final_path/venv/bin/python $final_path/$APPNAME/$FORKNAME-bin"
|
||||
export bin_file="$final_path/venv/bin/python $final_path/$appname/$FORKNAME-bin"
|
||||
if [ "$app_version" = "9" ]; then
|
||||
bin_file="$final_path/venv/bin/python $final_path/$APPNAME/$FORKNAME.py"
|
||||
bin_file="$final_path/venv/bin/python $final_path/$appname/$FORKNAME.py"
|
||||
fi
|
||||
if [ "$app_version" = "8" ]; then
|
||||
bin_file="$final_path/venv/bin/python $final_path/$APPNAME/$FORKNAME.py"
|
||||
bin_file="$final_path/venv/bin/python $final_path/$appname/$FORKNAME.py"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
|
|
Loading…
Reference in a new issue