From 1d0a98a754bcde5bae871a958959419694fb136f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Wed, 20 Mar 2024 19:36:05 +0100 Subject: [PATCH] Manifestv2: install --- check_process | 73 --------------- conf/10.src | 5 - conf/11.src | 5 - conf/12.src | 5 - conf/14.src | 5 - conf/15.src | 5 - conf/16.src | 5 - conf/8.src | 5 - conf/9.src | 5 - conf/app.src | 5 - conf/oca-12.src | 5 - conf/oca-14.src | 5 - conf/oca-15.src | 5 - conf/oca-16.src | 5 - conf/openupgrade.src | 5 - manifest.json | 92 ------------------ manifest.toml | 172 ++++++++++++++++++++++++++++++++++ scripts/_common.sh | 51 +++++----- scripts/install | 216 +++++++++---------------------------------- tests.toml | 23 +++++ 20 files changed, 264 insertions(+), 433 deletions(-) delete mode 100644 check_process delete mode 100644 conf/10.src delete mode 100644 conf/11.src delete mode 100644 conf/12.src delete mode 100644 conf/14.src delete mode 100644 conf/15.src delete mode 100644 conf/16.src delete mode 100644 conf/8.src delete mode 100644 conf/9.src delete mode 100644 conf/app.src delete mode 100644 conf/oca-12.src delete mode 100644 conf/oca-14.src delete mode 100644 conf/oca-15.src delete mode 100644 conf/oca-16.src delete mode 100644 conf/openupgrade.src delete mode 100644 manifest.json create mode 100644 manifest.toml create mode 100644 tests.toml diff --git a/check_process b/check_process deleted file mode 100644 index 25e6085..0000000 --- a/check_process +++ /dev/null @@ -1,73 +0,0 @@ -;; Test complet sans multisite v14 - auto_remove=1 - ; Manifest - domain="domain.tld" - version="14" - oca=0 - lang="en_US" - tz="Etc/GMT" - admin="john" - admin_password="1Strong-Password" - ; Checks - pkg_linter=1 - setup_sub_dir=0 - setup_root=1 - setup_nourl=0 - setup_private=0 - setup_public=1 - upgrade=1 - # 12.0~ynh6 - upgrade=1 from_commit=54f28204591c902ebe4a3a6b662e88e8fa598fde - # 15.0~ynh1 - upgrade=1 from_commit=c82770776ccf5ea14a1b47f0ee6a113858e749e6 - backup_restore=1 - multi_instance=1 - port_already_use=0 - change_url=0 -;; Test complet sans multisite v15 - auto_remove=1 - ; Manifest - domain="domain.tld" - version="15" - oca=0 - lang="en_US" - tz="Etc/GMT" - admin="john" - admin_password="1Strong-Password" - ; Checks - pkg_linter=1 - setup_sub_dir=0 - setup_root=1 - setup_nourl=0 - setup_private=0 - setup_public=1 - upgrade=1 - backup_restore=1 - multi_instance=1 - port_already_use=0 - change_url=0 -;; Test complet sans multisite v16 - auto_remove=1 - ; Manifest - domain="domain.tld" - version="16" - oca=0 - lang="en_US" - tz="Etc/GMT" - admin="john" - admin_password="1Strong-Password" - ; Checks - pkg_linter=1 - setup_sub_dir=0 - setup_root=1 - setup_nourl=0 - setup_private=0 - setup_public=1 - upgrade=1 - backup_restore=1 - multi_instance=1 - port_already_use=0 - change_url=0 -;;; Options -Email=ljf+libreerp_ynh@reflexlibre.net -Notification=down diff --git a/conf/10.src b/conf/10.src deleted file mode 100644 index 512c90b..0000000 --- a/conf/10.src +++ /dev/null @@ -1,5 +0,0 @@ -SOURCE_URL=https://github.com/odoo/odoo/archive/28c3f51c4878fbcd79b2e819948465fcf2160ebc.tar.gz -SOURCE_SUM=880be8b9e5a57e67d6645a527efd83224319d8fc645cbd72f24e7e50a75ff31d -SOURCE_FILENAME=odoo-10.tar.gz -SOURCE_FORMAT=tar.gz -SOURCE_SUM_PRG=sha256sum diff --git a/conf/11.src b/conf/11.src deleted file mode 100644 index 1653db3..0000000 --- a/conf/11.src +++ /dev/null @@ -1,5 +0,0 @@ -SOURCE_URL=https://github.com/odoo/odoo/archive/43200e9dcc1d91cfd5c1e5e939b27e713d20cc7c.tar.gz -SOURCE_SUM=71418fc5536242de72baa2d17b38a439252956fbbb1ebc3e2294c858674c4659 -SOURCE_FILENAME=odoo-11.tar.gz -SOURCE_FORMAT=tar.gz -SOURCE_SUM_PRG=sha256sum diff --git a/conf/12.src b/conf/12.src deleted file mode 100644 index ffc58a5..0000000 --- a/conf/12.src +++ /dev/null @@ -1,5 +0,0 @@ -SOURCE_URL=https://github.com/odoo/odoo/archive/c53081f10befd4f1c98e46a450ed3bc71a6246ed.tar.gz -SOURCE_SUM=e2569f947d83ee549304a3112cf5dda3ff4ef7affca8e5e6119b1305ccac1bae -SOURCE_FILENAME=odoo-12.tar.gz -SOURCE_FORMAT=tar.gz -SOURCE_SUM_PRG=sha256sum diff --git a/conf/14.src b/conf/14.src deleted file mode 100644 index aee6de0..0000000 --- a/conf/14.src +++ /dev/null @@ -1,5 +0,0 @@ -SOURCE_URL=https://github.com/odoo/odoo/archive/8ede8a758a92c4b61fe48d820464783e21ee7847.tar.gz -SOURCE_SUM=9bd03884cdfe644652a09f86cec652d69c11538d0e0ed620740c25f49099a734 -SOURCE_FILENAME=odoo-14.tar.gz -SOURCE_FORMAT=tar.gz -SOURCE_SUM_PRG=sha256sum diff --git a/conf/15.src b/conf/15.src deleted file mode 100644 index 92c51c6..0000000 --- a/conf/15.src +++ /dev/null @@ -1,5 +0,0 @@ -SOURCE_URL=https://github.com/odoo/odoo/archive/1ab48bd4c89f21691b34f349338405fcbb85dea4.tar.gz -SOURCE_SUM=93e12c7574e73403d4da456cf612fd5542d961e302fdf9c3a87cdeca9146184d -SOURCE_FILENAME=odoo-15.tar.gz -SOURCE_FORMAT=tar.gz -SOURCE_SUM_PRG=sha256sum diff --git a/conf/16.src b/conf/16.src deleted file mode 100644 index ecb7dae..0000000 --- a/conf/16.src +++ /dev/null @@ -1,5 +0,0 @@ -SOURCE_URL=https://github.com/odoo/odoo/archive/2a88076c1d1df4920bfd139c94862a894d8ef3bc.tar.gz -SOURCE_SUM=39d23f01d9a095d75460829acfd53b74bcfc273a074d6eae163eedcaeeeb58c7 -SOURCE_FILENAME=odoo-16.tar.gz -SOURCE_FORMAT=tar.gz -SOURCE_SUM_PRG=sha256sum diff --git a/conf/8.src b/conf/8.src deleted file mode 100644 index 134e002..0000000 --- a/conf/8.src +++ /dev/null @@ -1,5 +0,0 @@ -SOURCE_URL=https://github.com/odoo/odoo/archive/9e8f70e4849b0eeaca8b5cf51372ecfa23dc561b.tar.gz -SOURCE_SUM=51d5db432364d272efe8c7b8f93757a63d762393a9163307f52a2f4f950ec4e6 -SOURCE_FILENAME=odoo-8.tar.gz -SOURCE_FORMAT=tar.gz -SOURCE_SUM_PRG=sha256sum diff --git a/conf/9.src b/conf/9.src deleted file mode 100644 index 5983b00..0000000 --- a/conf/9.src +++ /dev/null @@ -1,5 +0,0 @@ -SOURCE_URL=https://github.com/odoo/odoo/archive/7132a15c38a3b5e5ec232404d21aacfa2ac5874e.tar.gz -SOURCE_SUM=f4c522da29201835435b01c651032d07c2d0c0e8a14b30f9a784cb531c5ba250 -SOURCE_FILENAME=odoo-9.tar.gz -SOURCE_FORMAT=tar.gz -SOURCE_SUM_PRG=sha256sum diff --git a/conf/app.src b/conf/app.src deleted file mode 100644 index 7b93ab8..0000000 --- a/conf/app.src +++ /dev/null @@ -1,5 +0,0 @@ -SOURCE_URL=https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz -SOURCE_SUM=049b2cdec9a8254f0ef8ac273afaf54f7e25459a273e27189591edc7d7cf29db -SOURCE_FILE=wkhtmltox-0.12.4_linux-generic-amd64.tar.xz -SOURCE_FORMAT=tar.xz -SOURCE_SUM_PRG=sha256sum diff --git a/conf/oca-12.src b/conf/oca-12.src deleted file mode 100644 index 78095ae..0000000 --- a/conf/oca-12.src +++ /dev/null @@ -1,5 +0,0 @@ -SOURCE_URL=https://github.com/OCA/OCB/archive/daa274eb48324d563e1096e334a5a73034be71dc.tar.gz -SOURCE_SUM=73bd925d3bdc402248548f92908a07e8475b6703d063609ba7f0729060c59aac -SOURCE_FILENAME=oca-12.tar.gz -SOURCE_FORMAT=tar.gz -SOURCE_SUM_PRG=sha256sum diff --git a/conf/oca-14.src b/conf/oca-14.src deleted file mode 100644 index 4fd2f35..0000000 --- a/conf/oca-14.src +++ /dev/null @@ -1,5 +0,0 @@ -SOURCE_URL=https://github.com/OCA/OCB/archive/890a6aa943aafff149924b1aca2517a95a1b352f.tar.gz -SOURCE_SUM=41decd11b20d8f99329c413faec9abd1e5ee75076e5f47a33ab806483f51926c -SOURCE_FILENAME=oca-14.tar.gz -SOURCE_FORMAT=tar.gz -SOURCE_SUM_PRG=sha256sum diff --git a/conf/oca-15.src b/conf/oca-15.src deleted file mode 100644 index 0f265b2..0000000 --- a/conf/oca-15.src +++ /dev/null @@ -1,5 +0,0 @@ -SOURCE_URL=https://github.com/OCA/OCB/archive/1ab48bd4c89f21691b34f349338405fcbb85dea4.tar.gz -SOURCE_SUM=23b8902b6fc22e4ce36f6dcc7178257235663e9911b61b70b70aeca0fdb36331 -SOURCE_FILENAME=oca-15.tar.gz -SOURCE_FORMAT=tar.gz -SOURCE_SUM_PRG=sha256sum diff --git a/conf/oca-16.src b/conf/oca-16.src deleted file mode 100644 index f327da3..0000000 --- a/conf/oca-16.src +++ /dev/null @@ -1,5 +0,0 @@ -SOURCE_URL=https://github.com/OCA/OCB/archive/9d5ff52da5ec65a21a00a46e21783a2c6188dd80.tar.gz -SOURCE_SUM=3c3a95ec627e3807c85b0b2fd13a484b0b990426efb4905681aaee8768386e39 -SOURCE_FILENAME=oca-16.tar.gz -SOURCE_FORMAT=tar.gz -SOURCE_SUM_PRG=sha256sum diff --git a/conf/openupgrade.src b/conf/openupgrade.src deleted file mode 100644 index 7bba77f..0000000 --- a/conf/openupgrade.src +++ /dev/null @@ -1,5 +0,0 @@ -SOURCE_URL=https://raw.githubusercontent.com/OCA/OpenUpgrade/11.0/scripts/migrate.py -SOURCE_SUM=362c8cf9b43a3aaddb440e642205e9596da78e28d1e47b582612ced671d95e0b -SOURCE_FILE=odoo-migrate-11.py -SOURCE_SUM_PRG=sha256sum -SOURCE_EXTRACT=False diff --git a/manifest.json b/manifest.json deleted file mode 100644 index c9e43f7..0000000 --- a/manifest.json +++ /dev/null @@ -1,92 +0,0 @@ -{ - "name": "LibreERP", - "id": "libreerp", - "packaging_format": 1, - "description": { - "en": "Suite of business apps (ERP: CRM, Accounting, Point of Sale, HR, Purchases...)", - "fr": "Une collection d'apps de gestion d'entreprise (ERP : CRM, Comptabilité, Point de Vente, RH, Achats...)" - }, - "version": "16.0~ynh2", - "url": "https://odoo.com", - "upstream": { - "license": "LGPL-3.0-only", - "website": "https://odoo.com", - "demo": "https://www.odoo.com/trial", - "admindoc": "https://www.odoo.com/documentation/16.0/administration.html", - "userdoc": "https://www.odoo.com/documentation/16.0/applications.html", - "code": "https://github.com/odoo/odoo" - }, - "license": "LGPL-3.0-only", - "maintainer": { - "name": "ljf", - "email": "ljf+libreerp_ynh@reflexlibre.net" - }, - "previous_maintainers": { - "name": "scith" - }, - "requirements": { - "yunohost": ">= 4.3.0" - }, - "multi_instance": true, - "services": [ - "nginx" - ], - "arguments": { - "install": [ - { - "name": "domain", - "type": "domain" - }, - { - "name": "version", - "type": "string", - "ask": { - "en": "Choose the version you want", - "fr": "Choisissez la version désirée" - }, - "choices": ["11", "12", "14", "15", "16"], - "default": "16" - }, - { - "name": "oca", - "type": "boolean", - "default": false, - "ask": { - "en": "Do you want to setup OCA instead of LibreERP?", - "fr": "Désirez vous installer OCA à la place des sources de LibreERP" - } - }, - { - "name": "lang", - "type": "string", - "ask": { - "en": "Choose the application language", - "fr": "Choisissez la langue de l'application" - }, - "choices": ["sq_AL", "am_ET", "ar_SY", "eu_ES", "bs_BA", "bg_BG", "my_MM", "ca_ES", "zh_CN", "zh_HK", "zh_TW", "hr_HR", "cs_CZ", "da_DK", "nl_BE", "nl_NL", "en_AU", "en_GB", "en_US", "et_EE", "fi_FI", "fr_BE", "fr_CA", "fr_CH", "fr_FR", "gl_ES", "ka_GE", "de_CH", "de_DE", "el_GR", "gu_IN", "he_IL", "hi_IN", "hu_HU", "id_ID", "it_IT", "ja_JP", "kab_DZ", "ko_KP", "ko_KR", "lo_LA", "lv_LV", "lt_LT", "mk_MK", "mn_MN", "nb_NO", "fa_IR", "pl_PL", "pt_BR", "pt_PT", "ro_RO", "ru_RU", "sr_RS", "sr@latin", "sk_SK", "sl_SI", "es_AR", "es_BO", "es_CL", "es_CO", "es_CR", "es_DO", "es_EC", "es_GT", "es_MX", "es_PA", "es_PE", "es_PY", "es_UY", "es_VE", "es_ES", "sv_SE", "te_IN", "th_TH", "tr_TR", "uk_UA", "vi_VN"], - "default": "en_US" - }, - { - "name": "tz", - "type": "string", - "ask": { - "en": "Choose a timezone", - "fr": "Choisissez un fuseau horaire" - }, - "default": "Etc/UTC" - }, - { - "name": "admin", - "type": "user" - }, - { - "name": "admin_password", - "type": "password", - "ask": { - "en": "Choose a strong master admin password", - "fr": "Choisissez un mot de passe maître fort pour l'administration" - } - } - ] - } -} diff --git a/manifest.toml b/manifest.toml new file mode 100644 index 0000000..86d69ec --- /dev/null +++ b/manifest.toml @@ -0,0 +1,172 @@ +#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/manifest.v2.schema.json + +packaging_format = 2 + +id = "libreerp" +name = "LibreERP" +description.en = "Suite of business apps (ERP: CRM, Accounting, Point of Sale, HR, Purchases...)" +description.fr = "Une collection d'apps de gestion d'entreprise (ERP : CRM, Comptabilité, Point de Vente, RH, Achats...)" + +version = "16.0~ynh3" + +maintainers = ["ljf"] + +[upstream] +license = "LGPL-3.0-only" +website = "https://odoo.com" +demo = "https://www.odoo.com/trial" +admindoc = "https://www.odoo.com/documentation/16.0/administration.html" +userdoc = "https://www.odoo.com/documentation/16.0/applications.html" +code = "https://github.com/odoo/odoo" +cpe = "cpe:2.3:a:odoo:odoo" + +[integration] +yunohost = ">= 11.2" +architectures = "all" +multi_instance = true +ldap = true +sso = true +disk = "50M" # FIXME: replace with an **estimate** minimum disk requirement. e.g. 20M, 400M, 1G, ... +ram.build = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ... +ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ... + +[install] + [install.domain] + type = "domain" + + [install.version] + ask.en = "Choose the version you want" + ask.fr = "Choisissez la version désirée" + type = "string" + choices = ["11", "12", "14", "15", "16"] + default = "16" + + [install.oca] + ask.en = "Do you want to setup OCA instead of LibreERP?" + ask.fr = "Désirez vous installer OCA à la place des sources de LibreERP" + type = "boolean" + default = false + + [install.lang] + ask.en = "Choose the application language" + ask.fr = "Choisissez la langue de l'application" + type = "string" + choices = ["sq_AL", "am_ET", "ar_SY", "eu_ES", "bs_BA", "bg_BG", "my_MM", "ca_ES", "zh_CN", "zh_HK", "zh_TW", "hr_HR", "cs_CZ", "da_DK", "nl_BE", "nl_NL", "en_AU", "en_GB", "en_US", "et_EE", "fi_FI", "fr_BE", "fr_CA", "fr_CH", "fr_FR", "gl_ES", "ka_GE", "de_CH", "de_DE", "el_GR", "gu_IN", "he_IL", "hi_IN", "hu_HU", "id_ID", "it_IT", "ja_JP", "kab_DZ", "ko_KP", "ko_KR", "lo_LA", "lv_LV", "lt_LT", "mk_MK", "mn_MN", "nb_NO", "fa_IR", "pl_PL", "pt_BR", "pt_PT", "ro_RO", "ru_RU", "sr_RS", "sr@latin", "sk_SK", "sl_SI", "es_AR", "es_BO", "es_CL", "es_CO", "es_CR", "es_DO", "es_EC", "es_GT", "es_MX", "es_PA", "es_PE", "es_PY", "es_UY", "es_VE", "es_ES", "sv_SE", "te_IN", "th_TH", "tr_TR", "uk_UA", "vi_VN"] + default = "en_US" + + [install.tz] + ask.en = "Choose a timezone" + ask.fr = "Choisissez un fuseau horaire" + type = "string" + default = "Etc/UTC" + + [install.admin] + type = "user" + + [install.admin_password] + ask.en = "Choose a strong master admin password" + ask.fr = "Choisissez un mot de passe maître fort pour l'administration" + type = "password" + +[resources] + [resources.sources] + [resources.sources.main_16_oca] + url = "https://github.com/OCA/OCB/archive/9d5ff52da5ec65a21a00a46e21783a2c6188dd80.tar.gz" + sha256 = "3c3a95ec627e3807c85b0b2fd13a484b0b990426efb4905681aaee8768386e39" + prefetch = false + + [resources.sources.main_16] + url = "https://github.com/odoo/odoo/archive/2a88076c1d1df4920bfd139c94862a894d8ef3bc.tar.gz" + sha256 = "39d23f01d9a095d75460829acfd53b74bcfc273a074d6eae163eedcaeeeb58c7" + prefetch = false + + [resources.sources.main_15_oca] + url = "https://github.com/OCA/OCB/archive/1ab48bd4c89f21691b34f349338405fcbb85dea4.tar.gz" + sha256 = "23b8902b6fc22e4ce36f6dcc7178257235663e9911b61b70b70aeca0fdb36331" + prefetch = false + + [resources.sources.main_15] + url = "https://github.com/odoo/odoo/archive/1ab48bd4c89f21691b34f349338405fcbb85dea4.tar.gz" + sha256 = "93e12c7574e73403d4da456cf612fd5542d961e302fdf9c3a87cdeca9146184d" + prefetch = false + + [resources.sources.main_14_oca] + url = "https://github.com/OCA/OCB/archive/890a6aa943aafff149924b1aca2517a95a1b352f.tar.gz" + sha256 = "41decd11b20d8f99329c413faec9abd1e5ee75076e5f47a33ab806483f51926c" + prefetch = false + + [resources.sources.main_14] + url = "https://github.com/odoo/odoo/archive/8ede8a758a92c4b61fe48d820464783e21ee7847.tar.gz" + sha256 = "9bd03884cdfe644652a09f86cec652d69c11538d0e0ed620740c25f49099a734" + prefetch = false + + [resources.sources.main_12_oca] + url = "https://github.com/OCA/OCB/archive/daa274eb48324d563e1096e334a5a73034be71dc.tar.gz" + sha256 = "73bd925d3bdc402248548f92908a07e8475b6703d063609ba7f0729060c59aac" + prefetch = false + + [resources.sources.main_12] + url = "https://github.com/odoo/odoo/archive/c53081f10befd4f1c98e46a450ed3bc71a6246ed.tar.gz" + sha256 = "e2569f947d83ee549304a3112cf5dda3ff4ef7affca8e5e6119b1305ccac1bae" + prefetch = false + + [resources.sources.main_11] + url = "https://github.com/odoo/odoo/archive/43200e9dcc1d91cfd5c1e5e939b27e713d20cc7c.tar.gz" + sha256 = "71418fc5536242de72baa2d17b38a439252956fbbb1ebc3e2294c858674c4659" + prefetch = false + + [resources.sources.main_10] + url = "https://github.com/odoo/odoo/archive/28c3f51c4878fbcd79b2e819948465fcf2160ebc.tar.gz" + sha256 = "880be8b9e5a57e67d6645a527efd83224319d8fc645cbd72f24e7e50a75ff31d" + prefetch = false + + [resources.sources.main_9] + url = "https://github.com/odoo/odoo/archive/7132a15c38a3b5e5ec232404d21aacfa2ac5874e.tar.gz" + sha256 = "f4c522da29201835435b01c651032d07c2d0c0e8a14b30f9a784cb531c5ba250" + prefetch = false + + [resources.sources.main_8] + url = "https://github.com/odoo/odoo/archive/9e8f70e4849b0eeaca8b5cf51372ecfa23dc561b.tar.gz" + sha256 = "51d5db432364d272efe8c7b8f93757a63d762393a9163307f52a2f4f950ec4e6" + prefetch = false + + [resources.system_user] + + [resources.install_dir] + + [resources.permissions] + main.url = "/" + + [resources.ports] + main.default = 8069 + chat.default = 8072 + + [resources.apt] + packages = [ + "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", + "libjpeg-dev", + "zlib1g-dev", + "libfreetype6-dev", + "libffi-dev", + "libpq-dev", + ] + + [resources.database] + type = "postgresql" diff --git a/scripts/_common.sh b/scripts/_common.sh index ededc6c..44c585a 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -9,8 +9,7 @@ export FORKNAME="odoo" swap_needed=1024 -# dependencies used by the app -pkg_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 libjpeg-dev zlib1g-dev libfreetype6-dev libffi-dev libpq-dev" +conf_file="/etc/$app/main.conf" #================================================= # PERSONAL HELPERS @@ -18,50 +17,50 @@ pkg_dependencies="curl postgresql xfonts-75dpi xfonts-base wkhtmltopdf node-less function debranding() { # Remove Odoo references to avoid trademark issue - if [ -d $final_path/$appname/$FORKNAME ]; then - python_app=$final_path/$appname/$FORKNAME + if [ -d $install_dir/$appname/$FORKNAME ]; then + python_app=$install_dir/$appname/$FORKNAME else - python_app=$final_path/$appname/openerp + python_app=$install_dir/$appname/openerp fi - find $final_path/$appname -type f \( -iname '*.xml' -o -iname '*.po' \) -exec sed -i 's/Powered by ]*>Odoo<\/a>//g' {} \; - find $final_path/$appname -type f \( -iname '*.xml' -o -iname '*.po' \) -exec sed -i 's/]*>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 <[^>]*>]*Odoo[^>]*><\/a>//g' {} \; - if test -f "$final_path/$appname/addons/web/static/src/xml/base.xml"; then - sed -i 's/]*>My Odoo.com account<\/a>//g' $final_path/$appname/addons/web/static/src/xml/base.xml - sed -i 's/]*>Documentation<\/a>//g' $final_path/$appname/addons/web/static/src/xml/base.xml - sed -i 's/]*>Support<\/a>//g' $final_path/$appname/addons/web/static/src/xml/base.xml + find $install_dir/$appname -type f \( -iname '*.xml' -o -iname '*.po' \) -exec sed -i 's/Powered by ]*>Odoo<\/a>//g' {} \; + find $install_dir/$appname -type f \( -iname '*.xml' -o -iname '*.po' \) -exec sed -i 's/]*>Powered by <[^>]*>Odoo<\/[^>]*><\/a>//g' {} \; + find $install_dir/$appname -type f \( -iname '*.xml' -o -iname '*.po' \) -exec sed -i 's/Powered by <[^>]*>Odoo<\/[^>]*>//g' {} \; + find $install_dir/$appname -type f \( -iname '*.xml' -o -iname '*.po' \) -exec sed -i 's/Powered by <[^>]*>]*Odoo[^>]*><\/a>//g' {} \; + if test -f "$install_dir/$appname/addons/web/static/src/xml/base.xml"; then + sed -i 's/]*>My Odoo.com account<\/a>//g' $install_dir/$appname/addons/web/static/src/xml/base.xml + sed -i 's/]*>Documentation<\/a>//g' $install_dir/$appname/addons/web/static/src/xml/base.xml + sed -i 's/]*>Support<\/a>//g' $install_dir/$appname/addons/web/static/src/xml/base.xml fi cp ../conf/logo_type.png $python_app/addons/base/static/img/logo_white.png } function setup_files() { - + if [[ $oca -eq 0 ]]; then - ynh_setup_source $final_path/$appname $app_version + ynh_setup_source $install_dir/$appname $app_version else - ynh_setup_source $final_path/$appname "oca-$app_version" + ynh_setup_source $install_dir/$appname "oca-$app_version" fi debranding - mkdir -p $final_path/custom-addons - chmod 750 "$final_path" - chmod -R o-rwx "$final_path" - chown -R $app:$app "$final_path" + mkdir -p $install_dir/custom-addons + chmod 750 "$install_dir" + chmod -R o-rwx "$install_dir" + chown -R $app:$app "$install_dir" touch /var/log/$app.log chown $app:$app /var/log/$app.log - + if [ ! -f $conf_file ]; then ynh_configure server.conf $conf_file chmod 400 "$conf_file" 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 $install_dir/$appname/$FORKNAME-bin > /dev/null ; then + ynh_replace_string "^{$" "{'auto_install': True," $install_dir/$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" $install_dir/$appname/addons/auth_ldap/__openerp__.py fi - fi + fi } @@ -70,7 +69,7 @@ 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_pwd --db_host 127.0.0.1 --db_port 5432 --db-filter '^$app\$' -d $app " + #param=" --without-demo True --addons-path $install_dir/$appname/addons --db_user $app --db_password $db_pwd --db_host 127.0.0.1 --db_port 5432 --db-filter '^$app\$' -d $app " param=" -c $conf_file -d $app " ynh_exec_as $app $bin_file -c $conf_file --stop-after-init -i base -d $app ynh_exec_as $app $bin_file -c $conf_file --stop-after-init -i auth_ldap -d $app diff --git a/scripts/install b/scripts/install index 704d1f0..97b4577 100644 --- a/scripts/install +++ b/scripts/install @@ -1,7 +1,5 @@ #!/bin/bash -#================================================= -# GENERIC START #================================================= # IMPORT GENERIC HELPERS #================================================= @@ -10,109 +8,33 @@ source _common.sh source /usr/share/yunohost/helpers #================================================= -# MANAGE SCRIPT FAILURE +# INITIALIZE AND STORE SETTINGS #================================================= -ynh_clean_setup () { - true -} -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors - -#================================================= -# RETRIEVE ARGUMENTS FROM THE MANIFEST -#================================================= - -domain=$YNH_APP_ARG_DOMAIN -path_url="/" -export app_version=$YNH_APP_ARG_VERSION -oca=$YNH_APP_ARG_OCA -lang=$YNH_APP_ARG_LANG -tz=$YNH_APP_ARG_TZ -admin=$YNH_APP_ARG_ADMIN -admin_password=$YNH_APP_ARG_ADMIN_PASSWORD - -export app=$YNH_APP_INSTANCE_NAME - export conf_file=/etc/$app/main.conf +ynh_app_setting_set --app="$app" --key="conf_file" --value="$conf_file" + export preinstall=0 -#================================================= -# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS -#================================================= -ynh_script_progression --message="Validating installation parameters..." --weight=1 - -export final_path=/var/www/$app -test ! -e "$final_path" || ynh_die --message="This path already contains a folder" - -export bin_file="$final_path/venv/bin/python3 $final_path/$appname/$FORKNAME-bin" -if [ "$app_version" = "9" ]; then - bin_file="$final_path/venv/bin/python3 $final_path/$appname/$FORKNAME.py" -fi -if [ "$app_version" = "8" ]; then - bin_file="$final_path/venv/bin/python3 $final_path/$appname/$FORKNAME.py" +if [ "$app_version" = "9" ] || [ "$app_version" = "8" ]; then + bin_file="$install_dir/venv/bin/python3 $install_dir/$appname/$FORKNAME.py" +else + bin_file="$install_dir/venv/bin/python3 $install_dir/$appname/$FORKNAME-bin" fi -# Register (book) web path -ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url - #================================================= -# STORE SETTINGS FROM MANIFEST +# ADD SWAP #================================================= -ynh_script_progression --message="Storing installation settings..." --weight=1 -ynh_app_setting_set --app=$app --key=domain --value=$domain -ynh_app_setting_set --app=$app --key=app_version --value=$app_version -ynh_app_setting_set --app=$app --key=oca --value=$oca -ynh_app_setting_set --app=$app --key=lang --value=$lang -ynh_app_setting_set --app=$app --key=tz --value=$tz -ynh_app_setting_set --app=$app --key=conf_file --value=$conf_file - -#================================================= -# STANDARD MODIFICATIONS -#================================================= -# FIND AND OPEN A PORT -#================================================= -ynh_script_progression --message="Finding an available port..." --weight=1 - -# Find an available port -port=$(ynh_find_port --port=8069) -ynh_app_setting_set --app=$app --key=port --value=$port - -# Find an available port -port_chat=$(ynh_find_port --port=8072) -ynh_app_setting_set --app=$app --key=port_chat --value=$port_chat - -#================================================= -# INSTALL DEPENDENCIES -#================================================= -ynh_script_progression --message="Installing dependencies..." --weight=1 - -ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies - -#================================================= -# CREATE DEDICATED USER -#================================================= -ynh_script_progression --message="Configuring system user..." --weight=1 - -# Create a system user -ynh_system_user_create --username=$app --home_dir="$final_path" +if [ "${PACKAGE_CHECK_EXEC:-0}" -ne 1 ]; then + ynh_script_progression --message="Adding swap..." --weight=1 + ynh_add_swap --size=$swap_needed +fi #================================================= # CREATE A POSTGRESQL DATABASE #================================================= -ynh_script_progression --message="Creating a PostgreSQL database..." --weight=1 - -export db_name=$(ynh_sanitize_dbid --db_name=$app) -db_user=$db_name -ynh_app_setting_set --app=$app --key=db_name --value=$db_name - -# Make sure that postgresql is installed and running -ynh_psql_test_if_first_run - -# Create the database -ynh_psql_setup_db --db_user=$db_user --db_name=$db_name -export db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) +ynh_script_progression --message="Configuring $app's PostgreSQL database..." --weight=1 # Make sure that its encoding is UTF-8 ynh_psql_execute_as_root --sql="update pg_database set encoding = pg_char_to_encoding('UTF8') where datname = '$db_name'" @@ -122,73 +44,37 @@ ynh_psql_execute_as_root --sql="update pg_database set encoding = pg_char_to_enc #================================================= ynh_script_progression --message="Setting up source files..." --weight=1 -ynh_app_setting_set --app=$app --key=final_path --value=$final_path # Download, check integrity, uncompress and patch the source from app.src setup_files -#================================================= -# NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Configuring NGINX web server..." --weight=1 - -# Create a dedicated NGINX config -ynh_add_nginx_config - -#================================================= -# SPECIFIC SETUP -#================================================= -# ADD SWAP -#================================================= - -if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then - : -else - ynh_script_progression --message="Adding swap..." --weight=1 - ynh_add_swap --size=$swap_needed -fi - #================================================= # BUILD APP #================================================= ynh_script_progression --message="Building app..." --weight=1 -if ! wkhtmltopdf --version | grep "wkhtmltopdf 0.12.4 (with patched qt)"; then - # The debian package has a bug so we deploy a more recent version - if [ -f '../manifest.json' ] ; then - ynh_setup_source /usr/ - else - OLD_YNH_CWD=$YNH_CWD - YNH_CWD=$YNH_CWD/../settings/conf - ynh_setup_source /usr/ - YNH_CWD=$OLD_YNH_CWD - fi -fi -pushd $final_path - ynh_exec_warn_less ynh_exec_as $app RUSTUP_HOME="$final_path"/.rustup CARGO_HOME="$final_path"/.cargo bash -c 'curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -q -y' - export PATH="$PATH:$final_path/.cargo/bin:$final_path/.local/bin:/usr/local/sbin" - if grep "python3" $final_path/$appname/$FORKNAME-bin ; then - python3 -m venv venv - venv/bin/pip3 install --upgrade pip - venv/bin/pip3 install wheel - venv/bin/pip3 install -r $appname/requirements.txt - else - virtualenv venv - venv/bin/pip3 install --upgrade pip - venv/bin/pip install wheel - venv/bin/pip install -r $appname/requirements.txt - fi - ynh_secure_remove --file="$final_path/.cargo" - ynh_secure_remove --file="$final_path/.rustup" +pushd "$install_dir" + ynh_exec_warn_less ynh_exec_as "$app" \ + RUSTUP_HOME="$install_dir/.rustup" \ + CARGO_HOME="$install_dir/.cargo" \ + bash -c 'curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -q -y' + + export PATH="$PATH:$install_dir/.cargo/bin:$install_dir/.local/bin:/usr/local/sbin" + + if grep "python3" "$install_dir/$appname/$FORKNAME-bin" ; then + python3 -m venv venv + venv/bin/pip3 install --upgrade pip + venv/bin/pip3 install wheel + venv/bin/pip3 install -r $appname/requirements.txt + else + virtualenv venv + venv/bin/pip3 install --upgrade pip + venv/bin/pip install wheel + venv/bin/pip install -r $appname/requirements.txt + fi + ynh_secure_remove --file="$install_dir/.cargo" + ynh_secure_remove --file="$install_dir/.rustup" popd -#================================================= -# SETUP SYSTEMD -#================================================= -ynh_script_progression --message="Configuring a systemd service..." --weight=1 - -# Create a dedicated systemd config -ynh_add_systemd_config - #================================================= # SETUP DATABASE #================================================= @@ -197,38 +83,24 @@ ynh_script_progression --message="Setuping the database..." --weight=1 setup_database #================================================= -# GENERIC FINALIZATION +# SYSTEM CONFIGURATION #================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 +ynh_script_progression --message="Adding system configurations related to $app..." --weight=1 -yunohost service add $app --log="/var/log/$app.log" +# Create a dedicated NGINX config +ynh_add_nginx_config + +# Create a dedicated systemd config +ynh_add_systemd_config +yunohost service add "$app" --log="/var/log/$app.log" #================================================= # START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Starting a systemd service..." --weight=1 +ynh_script_progression --message="Starting $app's systemd service..." --weight=1 # Start a systemd service -ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app.log" - -#================================================= -# SETUP SSOWAT -#================================================= -ynh_script_progression --message="Configuring permissions..." --weight=1 - -ynh_permission_update --permission="main" --add="visitors" - -# Only the admin can access the admin panel of the app (if the app has an admin panel) -ynh_permission_create --permission="admin" --url="/web/database/manager" --allowed="all_users" - -#================================================= -# RELOAD NGINX -#================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=1 - -ynh_systemd_action --service_name=nginx --action=reload +ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$app.log" #================================================= # END OF SCRIPT diff --git a/tests.toml b/tests.toml new file mode 100644 index 0000000..a5bd120 --- /dev/null +++ b/tests.toml @@ -0,0 +1,23 @@ +#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/tests.v1.schema.json + +test_format = 1.0 + +[default] + + args.version = "14" + args.tz = "Etc/GMT" + + # ------------ + # Tests to run + # ------------ + + test_upgrade_from.54f28204591c902ebe4a3a6b662e88e8fa598fde.name = "12.0~ynh6" + test_upgrade_from.c82770776ccf5ea14a1b47f0ee6a113858e749e6.name = "15.0~ynh1" + +[no_multisite_v15] + args.version = "15" + args.tz = "Etc/GMT" + +[no_multisite_v16] + args.version = "16" + args.tz = "Etc/GMT"