From 4cea5a79fbd2f3be78cfb2c5675633ac10775a37 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Wed, 21 Oct 2020 20:00:35 +0200 Subject: [PATCH 1/5] Small fixes --- README.md | 8 +++----- conf/nginx.conf | 2 +- conf/php-fpm.conf | 2 +- manifest.json | 4 ++-- scripts/backup | 12 ++++++------ scripts/change_url | 10 +++++----- scripts/install | 17 ++++++++--------- scripts/remove | 12 ++++++------ scripts/restore | 8 ++++---- scripts/upgrade | 18 +++++++++--------- 10 files changed, 45 insertions(+), 48 deletions(-) diff --git a/README.md b/README.md index 5c2cb53..d46b2cb 100644 --- a/README.md +++ b/README.md @@ -29,8 +29,7 @@ sabre/dav, that includes an administration interface for easy management. ## YunoHost specific features -In addition to Baïkal core features, the following are made available with -this package: +In addition to Baïkal core features, the following are made available with this package: * Serve `/.well-known` paths for CalDAV and CardDAV on the domain @@ -38,7 +37,7 @@ this package: #### Supported architectures -* x86-64b - [![Build Status](https://ci-apps.yunohost.org/ci/logs/baikal%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/baikal/) +* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/baikal%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/baikal/) * ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/baikal%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/baikal/) ## Limitations @@ -57,8 +56,7 @@ this package: --- -Developers infos ----------------- +## Developers infos Please do your pull request to the [testing branch](https://github.com/YunoHost-Apps/baikal_ynh/tree/testing). diff --git a/conf/nginx.conf b/conf/nginx.conf index 8807793..db0ab0d 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -23,7 +23,7 @@ location __PATH__/ { fastcgi_split_path_info ^(.+\.php)(.*)$; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param SCRIPT_FILENAME $request_filename; - fastcgi_pass unix:/var/run/php/php7.0-fpm-__NAME__.sock; + fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock; } location ~ ^__PATH__/(\.|Core|Specific) { diff --git a/conf/php-fpm.conf b/conf/php-fpm.conf index 6736bea..cc8c244 100644 --- a/conf/php-fpm.conf +++ b/conf/php-fpm.conf @@ -33,7 +33,7 @@ group = __USER__ ; (IPv6 and IPv4-mapped) on a specific port; ; '/path/to/unix/socket' - to listen on a unix socket. ; Note: This value is mandatory. -listen = /var/run/php/php7.0-fpm-__NAMETOCHANGE__.sock +listen = /var/run/php/php__PHPVERSION__-fpm-__NAMETOCHANGE__.sock ; Set listen(2) backlog. ; Default Value: 511 (-1 on FreeBSD and OpenBSD) diff --git a/manifest.json b/manifest.json index f99dab6..d7c2308 100644 --- a/manifest.json +++ b/manifest.json @@ -3,8 +3,8 @@ "name": "Baikal", "packaging_format": 1, "description": { - "en": "Lightweight CalDAV+CardDAV server", - "fr": "Serveur CalDAV+CardDAV léger" + "en": "Lightweight CalDAV and CardDAV server", + "fr": "Serveur CalDAV et CardDAV léger" }, "version": "0.7.1~ynh1", "url": "http://baikal-server.com/", diff --git a/scripts/backup b/scripts/backup index 8f642f0..27d9c0b 100644 --- a/scripts/backup +++ b/scripts/backup @@ -29,32 +29,32 @@ db_name=$(ynh_app_setting_get --app=$app --key=db_name) phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= -# STANDARD BACKUP STEPS +# DECLARE DATA AND CONF FILES TO BACKUP +#================================================= +ynh_print_info --message="Declaring files to be backed up..." + #================================================= # BACKUP THE APP MAIN DIR #================================================= -ynh_script_progression --message="Backing up the main app directory..." ynh_backup --src_path="$final_path" #================================================= # BACKUP THE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Backing up nginx web server configuration..." ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # BACKUP THE PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Backing up php-fpm configuration..." ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" #================================================= # BACKUP THE MYSQL DATABASE #================================================= -ynh_script_progression --message="Backing up the MySQL database..." +ynh_print_info --message="Backing up the MySQL database..." ynh_mysql_dump_db --database="$db_name" > db.sql @@ -62,4 +62,4 @@ ynh_mysql_dump_db --database="$db_name" > db.sql # END OF SCRIPT #================================================= -ynh_script_progression --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." --last +ynh_print_info --message="Backup script completed for Baïkal. (YunoHost will then actually copy those files to the archive)." diff --git a/scripts/change_url b/scripts/change_url index eefd59f..4d491c8 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -54,7 +54,7 @@ then # Check if .well-known is available for the new domain. if is_url_handled --domain="$new_domain" --path="/.well-known/caldav" || is_url_handled --domain="$new_domain" --path="/.well-known/carddav" then - ynh_die --message="Another app already uses the domain $new_domain to serve a caldav/carddav feature. Please use another domain." + ynh_die --message="Another app already uses the domain $new_domain to serve a calDAV/cardDAV feature. Please use another domain." fi fi @@ -63,7 +63,7 @@ fi #================================================= # MODIFY URL IN NGINX CONF #================================================= -ynh_script_progression --message="Updating nginx web server configuration..." --weight=2 +ynh_script_progression --message="Updating NGINX web server configuration..." --weight=2 nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf @@ -94,7 +94,7 @@ fi #================================================= # UPDATE CONFIGURATION #================================================= -ynh_script_progression --message="Updating baikal configuration..." +ynh_script_progression --message="Updating Baïkal configuration..." ynh_backup_if_checksum_is_different --file="${final_path}/config/baikal.yaml" @@ -107,7 +107,7 @@ ynh_store_file_checksum --file="${final_path}/config/baikal.yaml" #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." +ynh_script_progression --message="Reloading NGINX web server..." ynh_systemd_action --service_name=nginx --action=reload @@ -115,4 +115,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Change of URL completed for $app" --last +ynh_script_progression --message="Change of URL completed for Baïkal" --last diff --git a/scripts/install b/scripts/install index d43be25..029648e 100644 --- a/scripts/install +++ b/scripts/install @@ -13,7 +13,6 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= -# Exit if an error occurs during the execution of the script ynh_abort_if_errors #================================================= @@ -40,7 +39,7 @@ ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url # Check if .well-known is available for this domain. if is_url_handled --domain="$domain" --path="/.well-known/caldav" || is_url_handled --domain="$domain" --path="/.well-known/carddav" then - ynh_die --message="Another app already uses the domain $domain to serve a caldav/carddav feature. Please use another domain." + ynh_die --message="Another app already uses the domain $domain to serve a calDAV/cardDAV feature. Please use another domain." fi #================================================= @@ -81,9 +80,9 @@ ynh_setup_source --dest_dir="$final_path" #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Configuring nginx web server..." +ynh_script_progression --message="Configuring NGINX web server..." -# Create a dedicated nginx config +# Create a dedicated NGINX config ynh_add_nginx_config #================================================= @@ -97,9 +96,9 @@ ynh_system_user_create --username=$app #================================================= # PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Configuring php-fpm..." +ynh_script_progression --message="Configuring PHP-FPM..." -# Create a dedicated php-fpm config +# Create a dedicated PHP-FPM config ynh_add_fpm_config #================================================= @@ -107,7 +106,7 @@ ynh_add_fpm_config #================================================= # INITIALIZE DATABASE #================================================= -ynh_script_progression --message="Configuring baikal..." --weight=3 +ynh_script_progression --message="Configuring Baïkal..." --weight=3 ynh_mysql_connect_as --user=$db_name --password="$db_pwd" --database=$db_name \ < "${final_path}/Core/Resources/Db/MySQL/db.sql" @@ -164,7 +163,7 @@ ynh_app_setting_set --app=$app --key=protected_uris --value="/admin/" #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." +ynh_script_progression --message="Reloading NGINX web server..." ynh_systemd_action --service_name=nginx --action=reload @@ -172,4 +171,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Installation of $app completed" --last +ynh_script_progression --message="Installation of Baïkal completed" --last diff --git a/scripts/remove b/scripts/remove index 2a8974a..1c3060c 100644 --- a/scripts/remove +++ b/scripts/remove @@ -41,7 +41,7 @@ ynh_remove_app_dependencies #================================================= # REMOVE APP MAIN DIR #================================================= -ynh_script_progression --message="Removing app main directory" +ynh_script_progression --message="Removing Baïkal main directory" # Remove the app directory securely ynh_secure_remove --file="$final_path" @@ -49,17 +49,17 @@ ynh_secure_remove --file="$final_path" #================================================= # REMOVE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Removing nginx web server configuration" +ynh_script_progression --message="Removing NGINX web server configuration" -# Remove the dedicated nginx config +# Remove the dedicated NGINX config ynh_remove_nginx_config #================================================= # REMOVE PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Removing php-fpm configuration" +ynh_script_progression --message="Removing PHP-FPM configuration" -# Remove the dedicated php-fpm config +# Remove the dedicated PHP-FPM config ynh_remove_fpm_config #================================================= @@ -76,4 +76,4 @@ ynh_system_user_delete --username=$app # END OF SCRIPT #================================================= -ynh_script_progression --message="Removal of $app completed" --last +ynh_script_progression --message="Removal of Baïkal completed" --last diff --git a/scripts/restore b/scripts/restore index fc9e81e..820e1de 100644 --- a/scripts/restore +++ b/scripts/restore @@ -42,7 +42,7 @@ test ! -d $final_path \ # Check if .well-known is available for this domain. if is_url_handled --domain="$domain" --path="/.well-known/caldav" || is_url_handled --domain="$domain" --path="/.well-known/carddav" then - ynh_die --message="Another app already uses the domain $domain to serve a caldav/carddav feature. Please use another domain." + ynh_die --message="Another app already uses the domain $domain to serve a calDAV/cardDAV feature. Please use another domain." fi #================================================= @@ -63,7 +63,7 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # RESTORE THE APP MAIN DIR #================================================= -ynh_script_progression --message="Restoring the app main directory..." +ynh_script_progression --message="Restoring Baïkal main directory..." ynh_restore_file --origin_path="$final_path" @@ -104,7 +104,7 @@ ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" #================================================= # RELOAD NGINX AND PHP-FPM #================================================= -ynh_script_progression --message="Reloading nginx web server and php-fpm..." +ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." ynh_systemd_action --service_name=php$phpversion-fpm --action=reload ynh_systemd_action --service_name=nginx --action=reload @@ -113,4 +113,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Restoration completed for $app" --last +ynh_script_progression --message="Restoration completed for Baïkal" --last diff --git a/scripts/upgrade b/scripts/upgrade index 0983311..42c5cea 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -47,7 +47,7 @@ fi #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= -ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=4 +ynh_script_progression --message="Backing up Baïkal before upgrading (may take a while)..." --weight=4 # Backup the current version of the app ynh_backup_before_upgrade @@ -94,9 +94,9 @@ fi #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Upgrading nginx web server configuration..." +ynh_script_progression --message="Upgrading NGINX web server configuration..." -# Create a dedicated nginx config +# Create a dedicated NGINX config ynh_add_nginx_config phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) @@ -118,9 +118,9 @@ ynh_system_user_create --username=$app #================================================= # PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Upgrading php-fpm configuration..." --weight=2 +ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=2 -# Create a dedicated php-fpm config +# Create a dedicated PHP-FPM config ynh_add_fpm_config #================================================= @@ -134,7 +134,7 @@ then #================================================= # UPGRADE BAIKAL CONFIGURATION #================================================= - ynh_script_progression --message="Upgrading baikal configuration..." --weight=2 + ynh_script_progression --message="Upgrading Baïkal configuration..." --weight=2 bk_conf="${final_path}/config/baikal.yaml" ynh_backup_if_checksum_is_different --file="$bk_conf" @@ -163,7 +163,7 @@ then #================================================= # UPGRADE BAIKAL #================================================= - ynh_script_progression --message="Upgrading baikal..." + ynh_script_progression --message="Upgrading Baïkal..." # Run Baikal upgrade php"${phpversion}" "${final_path}/bin/upgrade.sh" @@ -203,7 +203,7 @@ ynh_app_setting_set --app=$app --key=protected_uris --value="/admin/" #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." +ynh_script_progression --message="Reloading NGINX web server..." ynh_systemd_action --service_name=nginx --action=reload @@ -211,4 +211,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Upgrade of $app completed" --last +ynh_script_progression --message="Upgrade of Baïkal completed" --last From e90db69db75c2d0877ef981102483103658b16c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Fri, 10 Apr 2020 11:56:07 +0200 Subject: [PATCH 2/5] Change permissions system. Bump Yunohost required version accordingly. --- scripts/install | 4 ++-- scripts/upgrade | 14 ++++++++++---- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/scripts/install b/scripts/install index 029648e..91021c1 100644 --- a/scripts/install +++ b/scripts/install @@ -156,9 +156,9 @@ chmod 640 "$final_path/config/baikal.yaml" ynh_script_progression --message="Configuring SSOwat..." --weight=2 # Allow public access on / -ynh_app_setting_set --app=$app --key=skipped_uris --value="/" +ynh_permission_update --permission "main" --add "visitors" # But restrain on /admin -ynh_app_setting_set --app=$app --key=protected_uris --value="/admin/" +ynh_permission_create --permission "admin" --url "/admin" --allowed "all_users" #================================================= # RELOAD NGINX diff --git a/scripts/upgrade b/scripts/upgrade index 42c5cea..c5efe4f 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -195,10 +195,16 @@ chmod 640 "$final_path/config/baikal.yaml" #================================================= ynh_script_progression --message="Configuring SSOwat..." --weight=2 -# Allow public access on / -ynh_app_setting_set --app=$app --key=skipped_uris --value="/" -# But restrain on /admin -ynh_app_setting_set --app=$app --key=protected_uris --value="/admin/" +# Upgrade from the legacy permissions system +protected_uris=$(ynh_app_setting_get --app="$app" --key=protected_uris) +if [ -n "${protected_uris}" ]; then + ynh_app_setting_delete --app="$app" --key=protected_uris + + # Allow public access on / + ynh_permission_update --permission "main" --add "visitors" + # But restrain on /admin + ynh_permission_create --permission "admin" --url "/admin" --allowed "all_users" +fi #================================================= # RELOAD NGINX From 98ce43163f85253dd6ce600533faa6850083d6e3 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Mon, 18 Jan 2021 10:30:01 +0100 Subject: [PATCH 3/5] Fix linter warning --- scripts/upgrade | 7 ------- 1 file changed, 7 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 42c5cea..e78da5f 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -58,13 +58,6 @@ ynh_clean_setup () { # Exit if an error occurs during the execution of the script ynh_abort_if_errors -#================================================= -# CHECK THE PATH -#================================================= - -# Normalize the URL path syntax -path_url=$(ynh_normalize_url_path --path_url=$path_url) - #================================================= # STANDARD UPGRADE STEPS #================================================= From 6d1fb30afbcd57e772b737c1d3099936a41e403d Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Mon, 18 Jan 2021 12:04:00 +0100 Subject: [PATCH 4/5] Update backup --- scripts/backup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/backup b/scripts/backup index 27d9c0b..3a806bb 100644 --- a/scripts/backup +++ b/scripts/backup @@ -19,7 +19,7 @@ ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." +ynh_print_info --message="Loading installation settings..." app=$YNH_APP_INSTANCE_NAME From 67d95de3f61279e2f39692ed07e3575d852c0c90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 6 May 2021 18:28:44 +0200 Subject: [PATCH 5/5] enh-Testing (#58) * Update check_process --- README.md | 14 ++++++----- check_process | 10 +++----- conf/baikal.yaml | 8 +++---- conf/nginx.conf | 1 + manifest.json | 18 +++----------- pull_request_template.md | 12 ++-------- scripts/install | 23 +++++------------- scripts/upgrade | 52 ++++++++++++++++------------------------ 8 files changed, 47 insertions(+), 91 deletions(-) diff --git a/README.md b/README.md index d46b2cb..1f62aff 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ # Baïkal for YunoHost [![Integration level](https://dash.yunohost.org/integration/baikal.svg)](https://dash.yunohost.org/appci/app/baikal) ![](https://ci-apps.yunohost.org/ci/badges/baikal.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/baikal.maintain.svg) -[![Install Baïkal with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=baikal) +[![Install Baïkal with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=baikal) > *This package allow you to install Baïkal quickly and simply on a YunoHost server. -If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to know how to install and enjoy it.* +If you don't have YunoHost, please see [here](https://yunohost.org/install) to know how to install and enjoy it.* ## Overview [Baïkal](http://baikal-server.com/) is a CalDAV and CardDAV server, based on @@ -14,6 +14,8 @@ sabre/dav, that includes an administration interface for easy management. ## Screenshots +![](http://www.baikal-server.com/res/img/screenshots/dashboard.png) + ## Demo * [YunoHost demo](https://demo.yunohost.org/baikal/admin/) @@ -25,7 +27,7 @@ sabre/dav, that includes an administration interface for easy management. ## Documentation * Official documentation: http://sabre.io/baikal/ - * YunoHost documentation: https://yunohost.org/#/app_baikal + * YunoHost documentation: https://yunohost.org/en/app_baikal ## YunoHost specific features @@ -37,14 +39,14 @@ In addition to Baïkal core features, the following are made available with this #### Supported architectures -* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/baikal%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/baikal/) -* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/baikal%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/baikal/) +* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/baikal.svg)](https://ci-apps.yunohost.org/ci/apps/baikal/) +* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/baikal.svg)](https://ci-apps-arm.yunohost.org/ci/apps/baikal/) ## Limitations ## Additional information -* There is a breaking change in the management of the administrator password when upgrading to 0.7.0. You must change the admin password! +* There is a breaking change in the management of the administrator password when upgrading to 0.7.0 You must change the admin password! * To be able to change the admin password, please visit the page: `https://you.domain.tld/yunohost/admin/#/apps/baikal/actions` and set a new password. ## Links diff --git a/check_process b/check_process index 904082b..db9882c 100644 --- a/check_process +++ b/check_process @@ -11,18 +11,14 @@ setup_private=0 setup_public=0 upgrade=1 - upgrade=1 from_commit=1aea3f3c4943c83135f7f287e6ac10c03df56323 + upgrade=1 from_commit=099f63413f120982232a77fd4ff5f62530d546ad backup_restore=1 multi_instance=0 - incorrect_path=1 - port_already_use=0 change_url=1 -;;; Levels - Level 5=auto ;;; Options Email= Notification=none ;;; Upgrade options - ; commit=1aea3f3c4943c83135f7f287e6ac10c03df56323 - name=Fix install + refactoring + ; commit=099f63413f120982232a77fd4ff5f62530d546ad + name=Testing (#57) manifest_arg=domain=DOMAIN&path=PATH&password=mysecret& diff --git a/conf/baikal.yaml b/conf/baikal.yaml index 47135ed..09fb85c 100644 --- a/conf/baikal.yaml +++ b/conf/baikal.yaml @@ -5,7 +5,7 @@ system: cal_enabled: true invite_from: 'noreply@localhost' dav_auth_type: 'LDAP-UserBind' - admin_passwordhash: __PASSWORDHASH__ + admin_passwordhash: __PASSWORD_HASH__ auth_realm: BaikalDAV base_uri: '__PATH__' # Auth Backend LDAP-UserBind; LDAP URI @@ -24,6 +24,6 @@ database: sqlite_file: "absolute/path/to/Specific/db/db.sqlite" mysql: true mysql_host: 'localhost' - mysql_dbname: '__DBNAME__' - mysql_username: '__DBUSER__' - mysql_password: '__DBPASS__' + mysql_dbname: '__DB_NAME__' + mysql_username: '__DB_NAME__' + mysql_password: '__DB_PWD__' diff --git a/conf/nginx.conf b/conf/nginx.conf index db0ab0d..518275c 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,6 +1,7 @@ location = /.well-known/carddav { return 301 https://$server_name__PATH__/card.php; } + location = /.well-known/caldav { return 301 https://$server_name__PATH__/cal.php; } diff --git a/manifest.json b/manifest.json index d7c2308..8d171b8 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Lightweight CalDAV and CardDAV server", "fr": "Serveur CalDAV et CardDAV léger" }, - "version": "0.7.1~ynh1", + "version": "0.7.1~ynh2", "url": "http://baikal-server.com/", "license": "GPL-3.0", "maintainer": { @@ -14,12 +14,12 @@ "email": "julien.malik@paraiso.me" }, "requirements": { - "yunohost": ">= 3.8.1" + "yunohost": ">= 4.1.7" }, "multi_instance": false, "services": [ "nginx", - "php7.0-fpm", + "php7.3-fpm", "mysql" ], "arguments": { @@ -27,29 +27,17 @@ { "name": "domain", "type": "domain", - "ask": { - "en": "Choose a domain for Baïkal", - "fr": "Choisissez un domaine pour Baïkal" - }, "example": "domain.org" }, { "name": "path", "type": "path", - "ask": { - "en": "Choose a path for Baïkal", - "fr": "Choisissez un chemin pour Baïkal" - }, "example": "/baikal", "default": "/baikal" }, { "name": "password", "type": "password", - "ask": { - "en": "Set the password for the administration", - "fr": "Définissez le mot de passe pour l'administration" - }, "example": "mysecret" } ] diff --git a/pull_request_template.md b/pull_request_template.md index eb2a30e..0a198cf 100644 --- a/pull_request_template.md +++ b/pull_request_template.md @@ -11,14 +11,6 @@ - [ ] Upgrade from last version tested. - [ ] Can be reviewed and tested. -## Validation +## Package_check results --- -*Minor decision* -- **Upgrade previous version** : -- [ ] **Code review** : -- [ ] **Approval (LGTM)** : -- [ ] **Approval (LGTM)** : -- **CI succeeded** : -[![Build Status](https://ci-apps-hq.yunohost.org/jenkins/job/baikal_ynh%20PR-NUM-/badge/icon)](https://ci-apps-hq.yunohost.org/jenkins/job/baikal_ynh%20PR-NUM-/) -*Please replace '-NUM-' in this link by the PR number.* -When the PR is marked as ready to merge, you have to wait for 3 days before really merging it. +* An automatic package_check will be launch at https://ci-apps-dev.yunohost.org/, when you add a specific comment to your Pull Request: "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!"* diff --git a/scripts/install b/scripts/install index 91021c1..ebbd114 100644 --- a/scripts/install +++ b/scripts/install @@ -116,25 +116,14 @@ ynh_mysql_connect_as --user=$db_name --password="$db_pwd" --database=$db_name \ #================================================= bk_conf="${final_path}/config/baikal.yaml" -cp ../conf/baikal.yaml "$bk_conf" - -ynh_replace_string --match_string="__TIMEZONE__" --replace_string="$(cat /etc/timezone)" --target_file="$bk_conf" -# Create admin password hash +timezone=$(cat /etc/timezone) password_hash=$(echo -n admin:BaikalDAV:$password | sha256sum | cut -d ' ' -f 1) -ynh_replace_string --match_string="__PASSWORDHASH__" --replace_string="${password_hash}" --target_file="$bk_conf" ynh_app_setting_set --app=$app --key=password_hash --value=$password_hash - -ynh_replace_string --match_string="__PATH__" --replace_string="${path_url%/}" --target_file="$bk_conf" -ynh_replace_string --match_string="__DBNAME__" --replace_string="$db_name" --target_file="$bk_conf" -ynh_replace_string --match_string="__DBUSER__" --replace_string="$db_name" --target_file="$bk_conf" -ynh_replace_string --match_string="__DBPASS__" --replace_string="$db_pwd" --target_file="$bk_conf" - +path=${path_url%/} deskey=$(ynh_string_random 24) ynh_app_setting_set --app=$app --key=encrypt_key --value="$deskey" -ynh_replace_string --match_string="__DESKEY__" --replace_string="$deskey" --target_file="$bk_conf" -# Store the config file checksum into the app settings -ynh_store_file_checksum --file="$bk_conf" +ynh_add_config --template="../conf/baikal.yaml" --destination="$bk_conf" # Disable installation touch "${final_path}/Specific/INSTALL_DISABLED" @@ -153,12 +142,12 @@ chmod 640 "$final_path/config/baikal.yaml" #================================================= # SETUP SSOWAT #================================================= -ynh_script_progression --message="Configuring SSOwat..." --weight=2 +ynh_script_progression --message="Configuring permissions..." --weight=2 # Allow public access on / -ynh_permission_update --permission "main" --add "visitors" +ynh_permission_update --permission="main" --add="visitors" # But restrain on /admin -ynh_permission_create --permission "admin" --url "/admin" --allowed "all_users" +ynh_permission_create --permission="admin" --url="/admin" --allowed="all_users" #================================================= # RELOAD NGINX diff --git a/scripts/upgrade b/scripts/upgrade index d463884..21ab67d 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -20,6 +20,9 @@ domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) final_path=$(ynh_app_setting_get --app=$app --key=final_path) db_name=$(ynh_app_setting_get --app=$app --key=db_name) +phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) +db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) +password_hash=$(ynh_app_setting_get --app=$app --key=password_hash) #================================================= # CHECK VERSION @@ -44,6 +47,18 @@ if [ -z "$db_name" ]; then ynh_app_setting_set --app=$app --key=db_name --value=$db_name fi +# Cleaning legacy permissions +if ynh_legacy_permissions_exists; then + ynh_legacy_permissions_delete_all + + ynh_app_setting_delete --app=$app --key=is_public +fi + +if ! ynh_permission_exists --permission="admin"; then + # Create the required permissions + ynh_permission_create --permission="admin" --url="/admin" --allowed="all_users" +fi + #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= @@ -91,7 +106,6 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." # Create a dedicated NGINX config ynh_add_nginx_config -phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # UPGRADE DEPENDENCIES @@ -129,29 +143,19 @@ then #================================================= ynh_script_progression --message="Upgrading Baïkal configuration..." --weight=2 - bk_conf="${final_path}/config/baikal.yaml" - ynh_backup_if_checksum_is_different --file="$bk_conf" - cp ../conf/baikal.yaml "$bk_conf" - - ynh_replace_string --match_string="__TIMEZONE__" --replace_string="$(cat /etc/timezone)" --target_file="$bk_conf" - password_hash=$(ynh_app_setting_get --app=$app --key=password_hash) - # If the password_hash is not in the app's config, recreate it from the password. if [ -z "$password_hash" ]; then password=$(ynh_app_setting_get --app=$app --key=password) password_hash=$(echo -n admin:BaikalDAV:$password | md5sum | cut -d ' ' -f 1) ynh_app_setting_set --app=$app --key=password_hash --value=$password_hash fi - ynh_replace_string --match_string="__PASSWORDHASH__" --replace_string="${password_hash}" --target_file="$bk_conf" - - ynh_replace_string --match_string="__PATH__" --replace_string="${path_url%/}" --target_file="$bk_conf" - ynh_replace_string --match_string="__DBNAME__" --replace_string="$db_name" --target_file="$bk_conf" - ynh_replace_string --match_string="__DBUSER__" --replace_string="$db_name" --target_file="$bk_conf" - db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) - ynh_replace_string --match_string="__DBPASS__" --replace_string="$db_pwd" --target_file="$bk_conf" + bk_conf="${final_path}/config/baikal.yaml" + timezone=$(cat /etc/timezone) + path=${path_url%/} deskey=$(ynh_app_setting_get --app=$app --key=encrypt_key) ynh_app_setting_set --app=$app --key=encrypt_key --value="$deskey" - ynh_replace_string --match_string="__DESKEY__" --replace_string="$deskey" --target_file="$bk_conf" + + ynh_add_config --template="../conf/baikal.yaml" --destination="$bk_conf" #================================================= # UPGRADE BAIKAL @@ -183,22 +187,6 @@ chown -R root: "$final_path" chown $app "$final_path/config/baikal.yaml" chmod 640 "$final_path/config/baikal.yaml" -#================================================= -# SETUP SSOWAT -#================================================= -ynh_script_progression --message="Configuring SSOwat..." --weight=2 - -# Upgrade from the legacy permissions system -protected_uris=$(ynh_app_setting_get --app="$app" --key=protected_uris) -if [ -n "${protected_uris}" ]; then - ynh_app_setting_delete --app="$app" --key=protected_uris - - # Allow public access on / - ynh_permission_update --permission "main" --add "visitors" - # But restrain on /admin - ynh_permission_create --permission "admin" --url "/admin" --allowed "all_users" -fi - #================================================= # RELOAD NGINX #=================================================