mirror of
https://github.com/YunoHost-Apps/nextcloud_ynh.git
synced 2024-09-03 19:55:57 +02:00
Merge branch 'testing' into v2_PostgreSQL
This commit is contained in:
commit
ad86334619
7 changed files with 61 additions and 22 deletions
|
@ -3,14 +3,19 @@ version = "1.0"
|
||||||
[main]
|
[main]
|
||||||
name = "Nextcloud configuration"
|
name = "Nextcloud configuration"
|
||||||
|
|
||||||
[main.maintenance_mode]
|
[main.maintenance]
|
||||||
name = "Maintenance mode"
|
name = "Maintenance"
|
||||||
|
|
||||||
[main.maintenance_mode.maintenance_mode]
|
[main.maintenance.maintenance_mode]
|
||||||
ask = "Enable maintenance mode"
|
ask = "Enable maintenance mode"
|
||||||
type = "boolean"
|
type = "boolean"
|
||||||
default = "0"
|
default = "0"
|
||||||
|
|
||||||
|
[main.maintenance.set_permissions_button]
|
||||||
|
ask.en = "Set permissions for all data (Can take up to several hours if users have a lot of data)"
|
||||||
|
type = "button"
|
||||||
|
style = "success"
|
||||||
|
|
||||||
[main.addressbook]
|
[main.addressbook]
|
||||||
name = "Address book configuration"
|
name = "Address book configuration"
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,19 @@
|
||||||
# EXPERIMENTAL HELPERS
|
# EXPERIMENTAL HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
wait_nginx_reload() {
|
||||||
|
# Nginx may take some time to support the new configuration,
|
||||||
|
# wait for the nextcloud configuration file to disappear from nginx before checking the CalDAV/CardDAV URL.
|
||||||
|
timeout=30
|
||||||
|
for i in $(seq 1 $timeout); do
|
||||||
|
if ! ynh_exec_warn_less nginx -T | grep --quiet "# configuration file /etc/nginx/conf.d/$domain.d/$app.conf:"; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
# Check if an URL is already handled
|
# Check if an URL is already handled
|
||||||
# usage: is_url_handled --domain=DOMAIN --path=PATH_URI
|
# usage: is_url_handled --domain=DOMAIN --path=PATH_URI
|
||||||
is_url_handled() {
|
is_url_handled() {
|
||||||
|
|
|
@ -14,6 +14,19 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=2
|
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=2
|
||||||
|
|
||||||
|
if [ $change_domain -eq 1 ]
|
||||||
|
then
|
||||||
|
# Check if .well-known is available for this domain
|
||||||
|
if is_url_handled --domain="$new_domain" --path="/.well-known/caldav" || is_url_handled --domain="$new_domain" --path="/.well-known/carddav"
|
||||||
|
then
|
||||||
|
ynh_print_warn --message="Another app already uses the domain $new_domain to serve a CalDAV/CardDAV feature. You may encounter issues when dealing with your calendar or address book."
|
||||||
|
|
||||||
|
# Remove lines about .well-known/carddav and caldav with sed.
|
||||||
|
sed --in-place --regexp-extended '/location = \/\.well\-known\/(caldav|carddav)/d' "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
ynh_store_file_checksum --file="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
ynh_change_url_nginx_config
|
ynh_change_url_nginx_config
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -37,16 +50,6 @@ then
|
||||||
|
|
||||||
# Reload php fpm, necessary for force nextcloud to re-read config.php, cf opcache.revalidate_freq
|
# Reload php fpm, necessary for force nextcloud to re-read config.php, cf opcache.revalidate_freq
|
||||||
ynh_systemd_action --service_name=php${phpversion}-fpm --action=reload
|
ynh_systemd_action --service_name=php${phpversion}-fpm --action=reload
|
||||||
|
|
||||||
# Check if .well-known is available for this domain
|
|
||||||
if is_url_handled --domain="$new_domain" --path="/.well-known/caldav" || is_url_handled --domain="$new_domain" --path="/.well-known/carddav"
|
|
||||||
then
|
|
||||||
ynh_print_warn --message="Another app already uses the domain $new_domain to serve a CalDAV/CardDAV feature. You may encounter issues when dealing with your calendar or address book."
|
|
||||||
|
|
||||||
# Remove lines about .well-known/carddav and caldav with sed.
|
|
||||||
sed --in-place --regexp-extended '/location = \/\.well\-known\/(caldav|carddav)/d' "/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
|
||||||
ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -105,6 +105,24 @@ set__fpm_free_footprint() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SPECIFIC RUNNERS FOR TOML SHORT KEYS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
function run__set_permissions_button() {
|
||||||
|
local data_dir=$(ynh_app_setting_get --app=$app --key=data_dir)
|
||||||
|
ynh_print_info "Set permissions, it may take some time..."
|
||||||
|
chown -R $app:www-data "$install_dir"
|
||||||
|
chown -R $app: "$data_dir"
|
||||||
|
find $install_dir/ -type f -print0 | xargs -r0 chmod 0644
|
||||||
|
find $install_dir/ -type d -print0 | xargs -r0 chmod 0755
|
||||||
|
find $data_dir/data/ -type f -print0 | xargs -r0 chmod 0640
|
||||||
|
find $data_dir/data/ -type d -print0 | xargs -r0 chmod 0750
|
||||||
|
chmod 640 "$install_dir/config/config.php"
|
||||||
|
chmod 755 /home/yunohost.app
|
||||||
|
chmod 750 $install_dir
|
||||||
|
}
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -55,7 +55,8 @@ exec_occ() {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Set write access for the following commands
|
# Set write access for the following commands
|
||||||
chown -R $app: "$install_dir" "$data_dir"
|
chown -R $app:www-data "$install_dir"
|
||||||
|
chown -R $app: "$data_dir"
|
||||||
|
|
||||||
# Define password in an intermediate var
|
# Define password in an intermediate var
|
||||||
# The fact that it's called _password allows it to be
|
# The fact that it's called _password allows it to be
|
||||||
|
@ -234,7 +235,7 @@ find $install_dir/ -type f -print0 | xargs -r0 chmod 0644
|
||||||
find $install_dir/ -type d -print0 | xargs -r0 chmod 0755
|
find $install_dir/ -type d -print0 | xargs -r0 chmod 0755
|
||||||
find $data_dir/data/ -type f -print0 | xargs -r0 chmod 0640
|
find $data_dir/data/ -type f -print0 | xargs -r0 chmod 0640
|
||||||
find $data_dir/data/ -type d -print0 | xargs -r0 chmod 0750
|
find $data_dir/data/ -type d -print0 | xargs -r0 chmod 0750
|
||||||
chmod 640 "$install_dir/config/config.php"
|
chmod 600 "$install_dir/config/config.php"
|
||||||
chmod 755 /home/yunohost.app
|
chmod 755 /home/yunohost.app
|
||||||
chmod 750 $install_dir
|
chmod 750 $install_dir
|
||||||
|
|
||||||
|
|
|
@ -84,7 +84,7 @@ find $install_dir/ -type f -print0 | xargs -r0 chmod 0644
|
||||||
find $install_dir/ -type d -print0 | xargs -r0 chmod 0755
|
find $install_dir/ -type d -print0 | xargs -r0 chmod 0755
|
||||||
find $data_dir/data/ -type f -print0 | xargs -r0 chmod 0640
|
find $data_dir/data/ -type f -print0 | xargs -r0 chmod 0640
|
||||||
find $data_dir/data/ -type d -print0 | xargs -r0 chmod 0750
|
find $data_dir/data/ -type d -print0 | xargs -r0 chmod 0750
|
||||||
chmod 640 "$install_dir/config/config.php"
|
chmod 600 "$install_dir/config/config.php"
|
||||||
chmod 755 /home/yunohost.app
|
chmod 755 /home/yunohost.app
|
||||||
chmod 750 $install_dir
|
chmod 750 $install_dir
|
||||||
|
|
||||||
|
|
|
@ -172,7 +172,7 @@ then
|
||||||
ynh_script_progression --message="Upgrading $app..." --weight=3
|
ynh_script_progression --message="Upgrading $app..." --weight=3
|
||||||
|
|
||||||
# Set write access for the following commands
|
# Set write access for the following commands
|
||||||
chown -R $app: "$install_dir" "$data_dir"
|
chown -R $app:www-data "$install_dir"
|
||||||
|
|
||||||
# Print the current version number of Nextcloud
|
# Print the current version number of Nextcloud
|
||||||
exec_occ -V
|
exec_occ -V
|
||||||
|
@ -232,7 +232,7 @@ then
|
||||||
mv "$tmpdir" "$install_dir"
|
mv "$tmpdir" "$install_dir"
|
||||||
|
|
||||||
# Set write access for the following commands
|
# Set write access for the following commands
|
||||||
chown -R $app: "$install_dir" "$data_dir"
|
chown -R $app:www-data "$install_dir"
|
||||||
|
|
||||||
# Upgrade Nextcloud (SUCCESS = 0, UP_TO_DATE = 3)
|
# Upgrade Nextcloud (SUCCESS = 0, UP_TO_DATE = 3)
|
||||||
exec_occ maintenance:mode --off
|
exec_occ maintenance:mode --off
|
||||||
|
@ -350,12 +350,9 @@ ynh_script_progression --message="Reapplying file permissions..." --weight=2
|
||||||
|
|
||||||
# Fix app ownerships & permissions
|
# Fix app ownerships & permissions
|
||||||
chown -R $app:www-data "$install_dir"
|
chown -R $app:www-data "$install_dir"
|
||||||
chown -R $app: "$data_dir"
|
|
||||||
find $install_dir/ -type f -print0 | xargs -r0 chmod 0644
|
find $install_dir/ -type f -print0 | xargs -r0 chmod 0644
|
||||||
find $install_dir/ -type d -print0 | xargs -r0 chmod 0755
|
find $install_dir/ -type d -print0 | xargs -r0 chmod 0755
|
||||||
find $data_dir/data/ -type f -print0 | xargs -r0 chmod 0640
|
chmod 600 "$install_dir/config/config.php"
|
||||||
find $data_dir/data/ -type d -print0 | xargs -r0 chmod 0750
|
|
||||||
chmod 640 "$install_dir/config/config.php"
|
|
||||||
chmod 755 /home/yunohost.app
|
chmod 755 /home/yunohost.app
|
||||||
chmod 750 $install_dir
|
chmod 750 $install_dir
|
||||||
|
|
||||||
|
@ -382,6 +379,8 @@ ynh_app_setting_delete --app=$app --key="checksum__etc_nginx_conf.d_$domain.d_$a
|
||||||
# Wait untils NGINX has fully reloaded
|
# Wait untils NGINX has fully reloaded
|
||||||
ynh_systemd_action --service_name=nginx --action=reload --line_match="Reloaded" --log_path="systemd"
|
ynh_systemd_action --service_name=nginx --action=reload --line_match="Reloaded" --log_path="systemd"
|
||||||
|
|
||||||
|
wait_nginx_reload
|
||||||
|
|
||||||
# Check if .well-known is available for this domain
|
# 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"
|
if is_url_handled --domain="$domain" --path="/.well-known/caldav" || is_url_handled --domain="$domain" --path="/.well-known/carddav"
|
||||||
then
|
then
|
||||||
|
|
Loading…
Add table
Reference in a new issue