1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/baikal_ynh.git synced 2024-09-03 18:16:11 +02:00
* Change permissions system. Bump Yunohost required version accordingly.
* Fix linter warning

Co-authored-by: Félix Piédallu <felix@piedallu.me>
This commit is contained in:
Éric Gaspar 2021-01-18 14:47:59 +01:00 committed by GitHub
parent 18cccebc5c
commit 099f63413f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 58 additions and 62 deletions

View file

@ -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).

View file

@ -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) {

View file

@ -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)

View file

@ -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/",

View file

@ -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
@ -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)."

View file

@ -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

View file

@ -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"
@ -157,14 +156,14 @@ 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
#=================================================
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

View file

@ -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

View file

@ -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

View file

@ -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
@ -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
#=================================================
@ -94,9 +87,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 +111,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 +127,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 +156,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"
@ -195,15 +188,21 @@ 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
#=================================================
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 +210,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