mirror of
https://github.com/YunoHost-Apps/z-push_ynh.git
synced 2024-09-03 18:05:58 +02:00
Cleanup
Back to original variables
This commit is contained in:
parent
63639131f3
commit
1c3ff2ec3e
10 changed files with 96 additions and 146 deletions
|
@ -9,6 +9,7 @@
|
||||||
setup_private=0
|
setup_private=0
|
||||||
setup_public=1
|
setup_public=1
|
||||||
upgrade=1
|
upgrade=1
|
||||||
|
upgrade=1 from_commit=bdac42b709cd2bc663a68422f69ac6bfd43a1ce5
|
||||||
backup_restore=1
|
backup_restore=1
|
||||||
multi_instance=0
|
multi_instance=0
|
||||||
incorrect_path=0
|
incorrect_path=0
|
||||||
|
|
|
@ -14,37 +14,33 @@ location /Microsoft-Server-ActiveSync {
|
||||||
client_max_body_size 20m;
|
client_max_body_size 20m;
|
||||||
client_body_buffer_size 128k;
|
client_body_buffer_size 128k;
|
||||||
|
|
||||||
fastcgi_pass unix:/var/run/php5-fpm-__NAME__.sock;
|
fastcgi_pass unix:/var/run/php/php7.0-fpm-__NAME__.sock;
|
||||||
include fastcgi_params;
|
include fastcgi_params;
|
||||||
fastcgi_param HTTPS on;
|
fastcgi_param HTTPS on;
|
||||||
fastcgi_param SCRIPT_FILENAME $request_filename;
|
fastcgi_param SCRIPT_FILENAME $request_filename;
|
||||||
|
|
||||||
# Include SSOWAT user panel.
|
|
||||||
include conf.d/yunohost_panel.conf.inc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
location /AutoDiscover/AutoDiscover.xml {
|
location /AutoDiscover/AutoDiscover.xml {
|
||||||
alias /usr/share/z-push/autodiscover/autodiscover.php;
|
alias /usr/share/z-push/autodiscover/autodiscover.php;
|
||||||
#fastcgi_pass unix:/var/run/php/php7.0-fpm.sock; # for PHP 7.X Debian/Ubuntu
|
fastcgi_pass unix:/var/run/php/php7.0-fpm-__NAME__.sock;
|
||||||
fastcgi_pass unix:/var/run/php5-fpm-__NAME__.sock;
|
|
||||||
include fastcgi_params;
|
include fastcgi_params;
|
||||||
fastcgi_param HTTPS on;
|
fastcgi_param HTTPS on;
|
||||||
fastcgi_param SCRIPT_FILENAME $request_filename;
|
fastcgi_param SCRIPT_FILENAME $request_filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
location /Autodiscover/Autodiscover.xml {
|
location /Autodiscover/Autodiscover.xml {
|
||||||
alias /usr/share/z-push/autodiscover/autodiscover.php;
|
alias /usr/share/z-push/autodiscover/autodiscover.php;
|
||||||
#fastcgi_pass unix:/var/run/php/php7.0-fpm.sock; # for PHP 7.X Debian/Ubuntu
|
fastcgi_pass unix:/var/run/php/php7.0-fpm-__NAME__.sock;
|
||||||
fastcgi_pass unix:/var/run/php5-fpm-__NAME__.sock;
|
|
||||||
include fastcgi_params;
|
include fastcgi_params;
|
||||||
fastcgi_param HTTPS on;
|
fastcgi_param HTTPS on;
|
||||||
fastcgi_param SCRIPT_FILENAME $request_filename;
|
fastcgi_param SCRIPT_FILENAME $request_filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
location /autodiscover/autodiscover.xml {
|
location /autodiscover/autodiscover.xml {
|
||||||
alias /usr/share/z-push/autodiscover/autodiscover.php;
|
alias /usr/share/z-push/autodiscover/autodiscover.php;
|
||||||
#fastcgi_pass unix:/var/run/php/php7.0-fpm.sock; # for PHP 7.X Debian/Ubuntu
|
fastcgi_pass unix:/var/run/php/php7.0-fpm-__NAME__.sock;
|
||||||
fastcgi_pass unix:/var/run/php5-fpm-__NAME__.sock;
|
|
||||||
include fastcgi_params;
|
include fastcgi_params;
|
||||||
fastcgi_param HTTPS on;
|
fastcgi_param HTTPS on;
|
||||||
fastcgi_param SCRIPT_FILENAME $request_filename;
|
fastcgi_param SCRIPT_FILENAME $request_filename;
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
[Unit]
|
|
||||||
Description=Small description of the service
|
|
||||||
After=network.target
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=simple
|
|
||||||
User=__APP__
|
|
||||||
Group=__APP__
|
|
||||||
WorkingDirectory=__FINALPATH__/
|
|
||||||
ExecStart=__FINALPATH__/script >> /var/log/__APP__/__APP__.log 2>&1
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
|
@ -8,7 +8,7 @@
|
||||||
},
|
},
|
||||||
"version": "2.4.5~ynh1",
|
"version": "2.4.5~ynh1",
|
||||||
"url": "https://z-push.org",
|
"url": "https://z-push.org",
|
||||||
"license": "free",
|
"license": "AGPL-3.0-or-later",
|
||||||
"maintainer": {
|
"maintainer": {
|
||||||
"name": "beudbeud, polytan02"
|
"name": "beudbeud, polytan02"
|
||||||
},
|
},
|
||||||
|
|
|
@ -26,8 +26,8 @@ app=$YNH_APP_INSTANCE_NAME
|
||||||
final_path=$(ynh_app_setting_get $app final_path)
|
final_path=$(ynh_app_setting_get $app final_path)
|
||||||
domain=$(ynh_app_setting_get $app domain)
|
domain=$(ynh_app_setting_get $app domain)
|
||||||
config_path=$(ynh_app_setting_get $app config_path)
|
config_path=$(ynh_app_setting_get $app config_path)
|
||||||
state_path=$(ynh_app_setting_get $app state_path)
|
final_logpath=$(ynh_app_setting_get $app final_logpath)
|
||||||
log_path=$(ynh_app_setting_get $app log_path)
|
statedir=$(ynh_app_setting_get $app statedir)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD BACKUP STEPS
|
# STANDARD BACKUP STEPS
|
||||||
|
@ -42,7 +42,7 @@ ynh_backup "$final_path"
|
||||||
ynh_backup "$config_path"
|
ynh_backup "$config_path"
|
||||||
|
|
||||||
# Backup state
|
# Backup state
|
||||||
ynh_backup "$state_path"
|
ynh_backup "$statedir"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE NGINX CONFIGURATION
|
# BACKUP THE NGINX CONFIGURATION
|
||||||
|
@ -56,7 +56,7 @@ ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Backing up php-fpm configuration..."
|
ynh_print_info "Backing up php-fpm configuration..."
|
||||||
|
|
||||||
ynh_backup "/etc/php5/fpm/pool.d/$app.conf"
|
ynh_backup "/etc/php/7.0/fpm/pool.d/$app.conf"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC BACKUP
|
# SPECIFIC BACKUP
|
||||||
|
|
|
@ -14,10 +14,9 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
old_domain=$YNH_APP_OLD_DOMAIN
|
old_domain=$YNH_APP_OLD_DOMAIN
|
||||||
old_path=$YNH_APP_OLD_PATH
|
|
||||||
|
|
||||||
new_domain=$YNH_APP_NEW_DOMAIN
|
new_domain=$YNH_APP_NEW_DOMAIN
|
||||||
new_path=$YNH_APP_NEW_PATH
|
new_path="/Microsoft-Server-ActiveSync"
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
|
@ -29,19 +28,6 @@ ynh_print_info "Loading installation settings..."
|
||||||
# Needed for helper "ynh_add_nginx_config"
|
# Needed for helper "ynh_add_nginx_config"
|
||||||
final_path=$(ynh_app_setting_get $app final_path)
|
final_path=$(ynh_app_setting_get $app final_path)
|
||||||
|
|
||||||
# Add settings here as needed by your application
|
|
||||||
#db_name=$(ynh_app_setting_get "$app" db_name)
|
|
||||||
#db_pwd=$(ynh_app_setting_get $app db_pwd)
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CHECK THE SYNTAX OF THE PATHS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
test -n "$old_path" || old_path="/"
|
|
||||||
test -n "$new_path" || new_path="/"
|
|
||||||
new_path=$(ynh_normalize_url_path $new_path)
|
|
||||||
old_path=$(ynh_normalize_url_path $old_path)
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK WHICH PARTS SHOULD BE CHANGED
|
# CHECK WHICH PARTS SHOULD BE CHANGED
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -52,12 +38,6 @@ then
|
||||||
change_domain=1
|
change_domain=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
change_path=0
|
|
||||||
if [ "$old_path" != "$new_path" ]
|
|
||||||
then
|
|
||||||
change_path=1
|
|
||||||
fi
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD MODIFICATIONS
|
# STANDARD MODIFICATIONS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -67,18 +47,6 @@ ynh_print_info "Updating nginx web server configuration..."
|
||||||
|
|
||||||
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
||||||
|
|
||||||
# Change the path in the nginx config file
|
|
||||||
if [ $change_path -eq 1 ]
|
|
||||||
then
|
|
||||||
# Make a backup of the original nginx config file if modified
|
|
||||||
ynh_backup_if_checksum_is_different "$nginx_conf_path"
|
|
||||||
# Set global variables for nginx helper
|
|
||||||
domain="$old_domain"
|
|
||||||
path_url="$new_path"
|
|
||||||
# Create a dedicated nginx config
|
|
||||||
ynh_add_nginx_config
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Change the domain for nginx
|
# Change the domain for nginx
|
||||||
if [ $change_domain -eq 1 ]
|
if [ $change_domain -eq 1 ]
|
||||||
then
|
then
|
||||||
|
|
|
@ -14,11 +14,6 @@ source ynh_add_secure_repos__2
|
||||||
# MANAGE SCRIPT FAILURE
|
# MANAGE SCRIPT FAILURE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_clean_setup () {
|
|
||||||
### Remove this function if there's nothing to clean before calling the remove script.
|
|
||||||
read -p "Press any key..."
|
|
||||||
true
|
|
||||||
}
|
|
||||||
# Exit if an error occurs during the execution of the script
|
# Exit if an error occurs during the execution of the script
|
||||||
ynh_abort_if_errors
|
ynh_abort_if_errors
|
||||||
|
|
||||||
|
@ -27,13 +22,7 @@ ynh_abort_if_errors
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
domain=$YNH_APP_ARG_DOMAIN
|
domain=$YNH_APP_ARG_DOMAIN
|
||||||
path_url="/"
|
path_url="/Microsoft-Server-ActiveSync"
|
||||||
|
|
||||||
path_url_activesync="/Microsoft-Server-ActiveSync"
|
|
||||||
path_url_autodiscover1="/AutoDiscover"
|
|
||||||
path_url_autodiscover2="/Autodiscover"
|
|
||||||
path_url_autodiscover3="/autodiscover"
|
|
||||||
|
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
|
@ -44,16 +33,13 @@ ynh_print_info "Validating installation parameters..."
|
||||||
|
|
||||||
final_path=/usr/share/z-push
|
final_path=/usr/share/z-push
|
||||||
config_path=/etc/z-push
|
config_path=/etc/z-push
|
||||||
state_path=/var/lib/z-push
|
final_logpath=/var/log/z-push
|
||||||
log_path=/var/log/z-push
|
statedir=/var/lib/z-push
|
||||||
|
|
||||||
test ! -e "$final_path" || ynh_die "This path already contains a folder"
|
test ! -e "$final_path" || ynh_die "This path already contains a folder"
|
||||||
|
|
||||||
# Normalize the url path syntax
|
|
||||||
path_url=$(ynh_normalize_url_path $path_url)
|
|
||||||
|
|
||||||
# Register (book) web path
|
# Register (book) web path
|
||||||
ynh_webpath_register $app $domain $path_url_activesync
|
ynh_webpath_register $app $domain $path_url
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STORE SETTINGS FROM MANIFEST
|
# STORE SETTINGS FROM MANIFEST
|
||||||
|
@ -64,8 +50,8 @@ ynh_app_setting_set $app domain $domain
|
||||||
ynh_app_setting_set $app path $path_url
|
ynh_app_setting_set $app path $path_url
|
||||||
ynh_app_setting_set $app final_path $final_path
|
ynh_app_setting_set $app final_path $final_path
|
||||||
ynh_app_setting_set $app config_path $config_path
|
ynh_app_setting_set $app config_path $config_path
|
||||||
ynh_app_setting_set $app state_path $state_path
|
ynh_app_setting_set $app final_logpath $final_logpath
|
||||||
ynh_app_setting_set $app log_path $log_path
|
ynh_app_setting_set $app statedir $statedir
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD MODIFICATIONS
|
# STANDARD MODIFICATIONS
|
||||||
|
@ -74,7 +60,6 @@ ynh_app_setting_set $app log_path $log_path
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Installing dependencies..."
|
ynh_print_info "Installing dependencies..."
|
||||||
|
|
||||||
#ynh_install_extra_repo --repo="deb http://repo.z-hub.io/z-push:/final/Debian_9.0/ stretch stable"
|
|
||||||
ynh_add_repo --uri="http://repo.z-hub.io/z-push:/final/Debian_9.0/" --suite="/" --component="" --name="$app"
|
ynh_add_repo --uri="http://repo.z-hub.io/z-push:/final/Debian_9.0/" --suite="/" --component="" --name="$app"
|
||||||
ynh_pin_repo --package="*" --pin="origin \"repo.z-hub.io\"" --name="$app"
|
ynh_pin_repo --package="*" --pin="origin \"repo.z-hub.io\"" --name="$app"
|
||||||
|
|
||||||
|
@ -100,10 +85,10 @@ ynh_add_fpm_config
|
||||||
# MODIFY A CONFIG FILE
|
# MODIFY A CONFIG FILE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
sudo cp ../conf/policies.ini $config_path/policies.ini
|
cp ../conf/policies.ini $config_path/policies.ini
|
||||||
sudo cp ../conf/z-push.conf.php $config_path/z-push.conf.php
|
cp ../conf/z-push.conf.php $config_path/z-push.conf.php
|
||||||
sudo cp ../conf/galsearch-ldap.conf.php $config_path/galsearch-ldap.conf.php
|
cp ../conf/galsearch-ldap.conf.php $config_path/galsearch-ldap.conf.php
|
||||||
sudo cp ../conf/autodiscover.conf.php $config_path/autodiscover.conf.php
|
cp ../conf/autodiscover.conf.php $config_path/autodiscover.conf.php
|
||||||
|
|
||||||
# Configuration of timezone
|
# Configuration of timezone
|
||||||
ynh_replace_string "__TIMEZONE__" "$(cat /etc/timezone)" "$config_path/z-push.conf.php"
|
ynh_replace_string "__TIMEZONE__" "$(cat /etc/timezone)" "$config_path/z-push.conf.php"
|
||||||
|
@ -120,15 +105,15 @@ if yunohost app list --installed -f baikal | grep -q id ; then
|
||||||
# Configuration of backend
|
# Configuration of backend
|
||||||
ynh_replace_string "__BACKEND_PROVIDER__" "BackendCombined" "$config_path/z-push.conf.php"
|
ynh_replace_string "__BACKEND_PROVIDER__" "BackendCombined" "$config_path/z-push.conf.php"
|
||||||
ynh_replace_string "__BACKEND_PROVIDER__" "BackendCombined" "$config_path/autodiscover.conf.php"
|
ynh_replace_string "__BACKEND_PROVIDER__" "BackendCombined" "$config_path/autodiscover.conf.php"
|
||||||
sudo cp ../conf/combined.conf.php $config_path/combined.conf.php
|
cp ../conf/combined.conf.php $config_path/combined.conf.php
|
||||||
|
|
||||||
# Configuration of caldav
|
# Configuration of caldav
|
||||||
sudo cp ../conf/caldav.conf.php $config_path/caldav.conf.php
|
cp ../conf/caldav.conf.php $config_path/caldav.conf.php
|
||||||
ynh_replace_string "__DOMAIN__" "$baikaldomain" "$config_path/caldav.conf.php"
|
ynh_replace_string "__DOMAIN__" "$baikaldomain" "$config_path/caldav.conf.php"
|
||||||
ynh_replace_string "__CALDAV_PATH__" "$baikalpath/cal.php/calendars/%u/" "$config_path/caldav.conf.php"
|
ynh_replace_string "__CALDAV_PATH__" "$baikalpath/cal.php/calendars/%u/" "$config_path/caldav.conf.php"
|
||||||
|
|
||||||
# Configuration of carddav
|
# Configuration of carddav
|
||||||
sudo cp ../conf/carddav.conf.php $config_path/carddav.conf.php
|
cp ../conf/carddav.conf.php $config_path/carddav.conf.php
|
||||||
ynh_replace_string "__DOMAIN__" "$baikaldomain" "$config_path/carddav.conf.php"
|
ynh_replace_string "__DOMAIN__" "$baikaldomain" "$config_path/carddav.conf.php"
|
||||||
ynh_replace_string "__CARDDAV_PATH__" "$baikalpath/card.php/addressbooks/%u/" "$config_path/carddav.conf.php"
|
ynh_replace_string "__CARDDAV_PATH__" "$baikalpath/card.php/addressbooks/%u/" "$config_path/carddav.conf.php"
|
||||||
ynh_replace_string "__CARDDAV_DEFAULT_PATH__" "$baikalpath/card.php/addressbooks/%u/default" "$config_path/carddav.conf.php"
|
ynh_replace_string "__CARDDAV_DEFAULT_PATH__" "$baikalpath/card.php/addressbooks/%u/default" "$config_path/carddav.conf.php"
|
||||||
|
@ -147,15 +132,15 @@ elif yunohost app list --installed -f nextcloud | grep -q id ; then
|
||||||
# Configuration of backend
|
# Configuration of backend
|
||||||
ynh_replace_string "__BACKEND_PROVIDER__" "BackendCombined" "$config_path/z-push.conf.php"
|
ynh_replace_string "__BACKEND_PROVIDER__" "BackendCombined" "$config_path/z-push.conf.php"
|
||||||
ynh_replace_string "__BACKEND_PROVIDER__" "BackendCombined" "$config_path/autodiscover.conf.php"
|
ynh_replace_string "__BACKEND_PROVIDER__" "BackendCombined" "$config_path/autodiscover.conf.php"
|
||||||
sudo cp ../conf/combined.conf.php $config_path/combined.conf.php
|
cp ../conf/combined.conf.php $config_path/combined.conf.php
|
||||||
|
|
||||||
# Configuration of caldav
|
# Configuration of caldav
|
||||||
sudo cp ../conf/caldav.conf.php $config_path/caldav.conf.php
|
cp ../conf/caldav.conf.php $config_path/caldav.conf.php
|
||||||
ynh_replace_string "__DOMAIN__" "$nextclouddomain" "$config_path/caldav.conf.php"
|
ynh_replace_string "__DOMAIN__" "$nextclouddomain" "$config_path/caldav.conf.php"
|
||||||
ynh_replace_string "__CALDAV_PATH__" "$nextcloudpath/remote.php/dav/calendars/%u/personal/" "$config_path/caldav.conf.php"
|
ynh_replace_string "__CALDAV_PATH__" "$nextcloudpath/remote.php/dav/calendars/%u/personal/" "$config_path/caldav.conf.php"
|
||||||
|
|
||||||
# Configuration of carddav
|
# Configuration of carddav
|
||||||
sudo cp ../conf/carddav.conf.php $config_path/carddav.conf.php
|
cp ../conf/carddav.conf.php $config_path/carddav.conf.php
|
||||||
ynh_replace_string "__DOMAIN__" "$nextclouddomain" "$config_path/carddav.conf.php"
|
ynh_replace_string "__DOMAIN__" "$nextclouddomain" "$config_path/carddav.conf.php"
|
||||||
ynh_replace_string "__CARDDAV_PATH__" "$nextcloudpath/remote.php/dav/addressbooks/users/%u/contacts/" "$config_path/carddav.conf.php"
|
ynh_replace_string "__CARDDAV_PATH__" "$nextcloudpath/remote.php/dav/addressbooks/users/%u/contacts/" "$config_path/carddav.conf.php"
|
||||||
ynh_replace_string "__CARDDAV_DEFAULT_PATH__" "$nextcloudpath/remote.php/dav/addressbooks/users/%u/contacts/" "$config_path/carddav.conf.php"
|
ynh_replace_string "__CARDDAV_DEFAULT_PATH__" "$nextcloudpath/remote.php/dav/addressbooks/users/%u/contacts/" "$config_path/carddav.conf.php"
|
||||||
|
@ -172,7 +157,7 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Configuration of imap
|
# Configuration of imap
|
||||||
sudo cp ../conf/imap.conf.php $config_path/imap.conf.php
|
cp ../conf/imap.conf.php $config_path/imap.conf.php
|
||||||
ynh_replace_string "__DOMAIN__" "$domain" "$config_path/imap.conf.php"
|
ynh_replace_string "__DOMAIN__" "$domain" "$config_path/imap.conf.php"
|
||||||
ynh_replace_string "__IMAP_MEETING_USE_CALDAV__" "false" "$config_path/imap.conf.php"
|
ynh_replace_string "__IMAP_MEETING_USE_CALDAV__" "false" "$config_path/imap.conf.php"
|
||||||
|
|
||||||
|
@ -197,8 +182,8 @@ ynh_store_file_checksum "$config_path/autodiscover.conf.php"
|
||||||
|
|
||||||
# Set permissions to app files
|
# Set permissions to app files
|
||||||
chown -R www-data:www-data $final_path
|
chown -R www-data:www-data $final_path
|
||||||
chown -R www-data:www-data $log_path
|
chown -R www-data:www-data $final_logpath
|
||||||
chown -R www-data:www-data $state_path
|
chown -R www-data:www-data $statedir
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP LOGROTATE
|
# SETUP LOGROTATE
|
||||||
|
|
|
@ -20,8 +20,8 @@ app=$YNH_APP_INSTANCE_NAME
|
||||||
domain=$(ynh_app_setting_get $app domain)
|
domain=$(ynh_app_setting_get $app domain)
|
||||||
final_path=$(ynh_app_setting_get $app final_path)
|
final_path=$(ynh_app_setting_get $app final_path)
|
||||||
config_path=$(ynh_app_setting_get $app config_path)
|
config_path=$(ynh_app_setting_get $app config_path)
|
||||||
state_path=$(ynh_app_setting_get $app state_path)
|
final_logpath=$(ynh_app_setting_get $app final_logpath)
|
||||||
log_path=$(ynh_app_setting_get $app log_path)
|
statedir=$(ynh_app_setting_get $app statedir)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD REMOVE
|
# STANDARD REMOVE
|
||||||
|
@ -77,10 +77,10 @@ ynh_remove_logrotate
|
||||||
ynh_secure_remove "$config_path"
|
ynh_secure_remove "$config_path"
|
||||||
|
|
||||||
# Remove the log files
|
# Remove the log files
|
||||||
ynh_secure_remove "$log_path"
|
ynh_secure_remove "$final_logpath"
|
||||||
|
|
||||||
# Remove the state
|
# Remove the state
|
||||||
ynh_secure_remove "$state_path"
|
ynh_secure_remove "$statedir"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
|
|
|
@ -28,8 +28,8 @@ domain=$(ynh_app_setting_get $app domain)
|
||||||
path_url=$(ynh_app_setting_get $app path)
|
path_url=$(ynh_app_setting_get $app path)
|
||||||
final_path=$(ynh_app_setting_get $app final_path)
|
final_path=$(ynh_app_setting_get $app final_path)
|
||||||
config_path=$(ynh_app_setting_get $app config_path)
|
config_path=$(ynh_app_setting_get $app config_path)
|
||||||
state_path=$(ynh_app_setting_get $app state_path)
|
final_logpath=$(ynh_app_setting_get $app final_logpath)
|
||||||
log_path=$(ynh_app_setting_get $app log_path)
|
statedir=$(ynh_app_setting_get $app statedir)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK IF THE APP CAN BE RESTORED
|
# CHECK IF THE APP CAN BE RESTORED
|
||||||
|
@ -60,7 +60,7 @@ ynh_restore_file "$final_path"
|
||||||
ynh_restore_file "$config_path"
|
ynh_restore_file "$config_path"
|
||||||
|
|
||||||
# Restore state
|
# Restore state
|
||||||
ynh_restore_file "$state_path"
|
ynh_restore_file "$statedir"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE PHP-FPM CONFIGURATION
|
# RESTORE THE PHP-FPM CONFIGURATION
|
||||||
|
@ -73,8 +73,10 @@ ynh_restore_file "/etc/php/7.0/fpm/pool.d/$app.conf"
|
||||||
#=================================================
|
#=================================================
|
||||||
# REINSTALL DEPENDENCIES
|
# REINSTALL DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Reinstalling dependencies..."
|
||||||
|
|
||||||
ynh_install_extra_repo --repo="deb http://repo.z-hub.io/z-push:/final/Debian_9.0/ /" --key="http://repo.z-hub.io/z-push:/final/Debian_9.0/Release.key"
|
ynh_add_repo --uri="http://repo.z-hub.io/z-push:/final/Debian_9.0/" --suite="/" --component="" --name="$app"
|
||||||
|
ynh_pin_repo --package="*" --pin="origin \"repo.z-hub.io\"" --name="$app"
|
||||||
|
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
ynh_install_app_dependencies $pkg_dependencies
|
||||||
|
|
||||||
|
@ -90,8 +92,8 @@ ynh_restore_file "/etc/logrotate.d/$app"
|
||||||
|
|
||||||
# Restore permissions on app files
|
# Restore permissions on app files
|
||||||
chown -R www-data:www-data $final_path
|
chown -R www-data:www-data $final_path
|
||||||
chown -R www-data:www-data $log_path
|
chown -R www-data:www-data $final_logpath
|
||||||
chown -R www-data:www-data $state_path
|
chown -R www-data:www-data $statedir
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
|
|
|
@ -21,29 +21,14 @@ domain=$(ynh_app_setting_get $app domain)
|
||||||
path_url=$(ynh_app_setting_get $app path)
|
path_url=$(ynh_app_setting_get $app path)
|
||||||
final_path=$(ynh_app_setting_get $app final_path)
|
final_path=$(ynh_app_setting_get $app final_path)
|
||||||
config_path=$(ynh_app_setting_get $app config_path)
|
config_path=$(ynh_app_setting_get $app config_path)
|
||||||
state_path=$(ynh_app_setting_get $app state_path)
|
statedir=$(ynh_app_setting_get $app statedir)
|
||||||
log_path=$(ynh_app_setting_get $app log_path)
|
final_logpath=$(ynh_app_setting_get $app final_logpath)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ENSURE DOWNWARD COMPATIBILITY
|
# ENSURE DOWNWARD COMPATIBILITY
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Ensuring downward compatibility..."
|
ynh_print_info "Ensuring downward compatibility..."
|
||||||
|
|
||||||
# If final_path doesn't exist, create it
|
|
||||||
if [ -z $final_path ]; then
|
|
||||||
final_path=/usr/share/z-push
|
|
||||||
ynh_app_setting_set $app final_path $final_path
|
|
||||||
fi
|
|
||||||
|
|
||||||
config_path=/etc/z-push
|
|
||||||
state_path=/var/lib/z-push
|
|
||||||
log_path=/var/log/z-push
|
|
||||||
|
|
||||||
ynh_app_setting_set $app config_path $config_path
|
|
||||||
ynh_app_setting_set $app state_path $state_path
|
|
||||||
ynh_app_setting_set $app log_path $log_path
|
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -65,6 +50,23 @@ ynh_abort_if_errors
|
||||||
# Normalize the URL path syntax
|
# Normalize the URL path syntax
|
||||||
path_url=$(ynh_normalize_url_path $path_url)
|
path_url=$(ynh_normalize_url_path $path_url)
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# REMOVE OLD VERSION
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# If final_path doesn't exist, create it
|
||||||
|
if [ $final_path == "/var/www/$app" ]; then
|
||||||
|
ynh_secure_remove "$final_path"
|
||||||
|
final_path=/usr/share/z-push
|
||||||
|
config_path=/etc/z-push
|
||||||
|
statedir=/var/lib/z-push
|
||||||
|
final_logpath=/var/log/z-push
|
||||||
|
ynh_app_setting_set $app final_path $final_path
|
||||||
|
ynh_app_setting_set $app config_path $config_path
|
||||||
|
ynh_app_setting_set $app statedir $statedir
|
||||||
|
ynh_app_setting_set $app final_logpath $final_logpath
|
||||||
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD UPGRADE STEPS
|
# STANDARD UPGRADE STEPS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -80,7 +82,8 @@ ynh_add_nginx_config
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info "Upgrading dependencies..."
|
ynh_print_info "Upgrading dependencies..."
|
||||||
|
|
||||||
ynh_install_extra_repo --repo="deb http://repo.z-hub.io/z-push:/final/Debian_9.0/ /" --key="http://repo.z-hub.io/z-push:/final/Debian_9.0/Release.key"
|
ynh_add_repo --uri="http://repo.z-hub.io/z-push:/final/Debian_9.0/" --suite="/" --component="" --name="$app"
|
||||||
|
ynh_pin_repo --package="*" --pin="origin \"repo.z-hub.io\"" --name="$app"
|
||||||
|
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
ynh_install_app_dependencies $pkg_dependencies
|
||||||
|
|
||||||
|
@ -98,10 +101,10 @@ ynh_add_fpm_config
|
||||||
# MODIFY A CONFIG FILE
|
# MODIFY A CONFIG FILE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
sudo cp ../conf/policies.ini $config_path/policies.ini
|
cp ../conf/policies.ini $config_path/policies.ini
|
||||||
sudo cp ../conf/z-push.conf.php $config_path/z-push.conf.php
|
cp ../conf/z-push.conf.php $config_path/z-push.conf.php
|
||||||
sudo cp ../conf/galsearch-ldap.conf.php $config_path/galsearch-ldap.conf.php
|
cp ../conf/galsearch-ldap.conf.php $config_path/galsearch-ldap.conf.php
|
||||||
sudo cp ../conf/autodiscover.conf.php $config_path/autodiscover.conf.php
|
cp ../conf/autodiscover.conf.php $config_path/autodiscover.conf.php
|
||||||
|
|
||||||
# Configuration of timezone
|
# Configuration of timezone
|
||||||
ynh_replace_string "__TIMEZONE__" "$(cat /etc/timezone)" "$config_path/z-push.conf.php"
|
ynh_replace_string "__TIMEZONE__" "$(cat /etc/timezone)" "$config_path/z-push.conf.php"
|
||||||
|
@ -109,7 +112,7 @@ ynh_replace_string "__TIMEZONE__" "$(cat /etc/timezone)" "$config_path/autodisco
|
||||||
|
|
||||||
|
|
||||||
# Enable caldav carddav support
|
# Enable caldav carddav support
|
||||||
if sudo yunohost app list --installed -f baikal | grep -q id ; then
|
if yunohost app list --installed -f baikal | grep -q id ; then
|
||||||
echo "Detected Baikal"
|
echo "Detected Baikal"
|
||||||
baikaldomain=$(ynh_app_setting_get baikal domain)
|
baikaldomain=$(ynh_app_setting_get baikal domain)
|
||||||
baikalpath=$(ynh_app_setting_get baikal path)
|
baikalpath=$(ynh_app_setting_get baikal path)
|
||||||
|
@ -118,15 +121,15 @@ if sudo yunohost app list --installed -f baikal | grep -q id ; then
|
||||||
# Configuration of backend
|
# Configuration of backend
|
||||||
ynh_replace_string "__BACKEND_PROVIDER__" "BackendCombined" "$config_path/z-push.conf.php"
|
ynh_replace_string "__BACKEND_PROVIDER__" "BackendCombined" "$config_path/z-push.conf.php"
|
||||||
ynh_replace_string "__BACKEND_PROVIDER__" "BackendCombined" "$config_path/autodiscover.conf.php"
|
ynh_replace_string "__BACKEND_PROVIDER__" "BackendCombined" "$config_path/autodiscover.conf.php"
|
||||||
sudo cp ../conf/combined.conf.php $config_path/combined.conf.php
|
cp ../conf/combined.conf.php $config_path/combined.conf.php
|
||||||
|
|
||||||
# Configuration of caldav
|
# Configuration of caldav
|
||||||
sudo cp ../conf/caldav.conf.php $config_path/caldav.conf.php
|
cp ../conf/caldav.conf.php $config_path/caldav.conf.php
|
||||||
ynh_replace_string "__DOMAIN__" "$baikaldomain" "$config_path/caldav.conf.php"
|
ynh_replace_string "__DOMAIN__" "$baikaldomain" "$config_path/caldav.conf.php"
|
||||||
ynh_replace_string "__CALDAV_PATH__" "$baikalpath/cal.php/calendars/%u/" "$config_path/caldav.conf.php"
|
ynh_replace_string "__CALDAV_PATH__" "$baikalpath/cal.php/calendars/%u/" "$config_path/caldav.conf.php"
|
||||||
|
|
||||||
# Configuration of carddav
|
# Configuration of carddav
|
||||||
sudo cp ../conf/carddav.conf.php $config_path/carddav.conf.php
|
cp ../conf/carddav.conf.php $config_path/carddav.conf.php
|
||||||
ynh_replace_string "__DOMAIN__" "$baikaldomain" "$config_path/carddav.conf.php"
|
ynh_replace_string "__DOMAIN__" "$baikaldomain" "$config_path/carddav.conf.php"
|
||||||
ynh_replace_string "__CARDDAV_PATH__" "$baikalpath/card.php/addressbooks/%u/" "$config_path/carddav.conf.php"
|
ynh_replace_string "__CARDDAV_PATH__" "$baikalpath/card.php/addressbooks/%u/" "$config_path/carddav.conf.php"
|
||||||
ynh_replace_string "__CARDDAV_DEFAULT_PATH__" "$baikalpath/card.php/addressbooks/%u/default" "$config_path/carddav.conf.php"
|
ynh_replace_string "__CARDDAV_DEFAULT_PATH__" "$baikalpath/card.php/addressbooks/%u/default" "$config_path/carddav.conf.php"
|
||||||
|
@ -136,7 +139,7 @@ if sudo yunohost app list --installed -f baikal | grep -q id ; then
|
||||||
ynh_store_file_checksum "$config_path/caldav.conf.php"
|
ynh_store_file_checksum "$config_path/caldav.conf.php"
|
||||||
ynh_store_file_checksum "$config_path/carddav.conf.php"
|
ynh_store_file_checksum "$config_path/carddav.conf.php"
|
||||||
|
|
||||||
elif sudo yunohost app list --installed -f nextcloud | grep -q id ; then
|
elif yunohost app list --installed -f nextcloud | grep -q id ; then
|
||||||
echo "Detected NextCloud"
|
echo "Detected NextCloud"
|
||||||
nextclouddomain=$(ynh_app_setting_get nextcloud domain)
|
nextclouddomain=$(ynh_app_setting_get nextcloud domain)
|
||||||
nextcloudpath=$(ynh_app_setting_get nextcloud path)
|
nextcloudpath=$(ynh_app_setting_get nextcloud path)
|
||||||
|
@ -145,15 +148,15 @@ elif sudo yunohost app list --installed -f nextcloud | grep -q id ; then
|
||||||
# Configuration of backend
|
# Configuration of backend
|
||||||
ynh_replace_string "__BACKEND_PROVIDER__" "BackendCombined" "$config_path/z-push.conf.php"
|
ynh_replace_string "__BACKEND_PROVIDER__" "BackendCombined" "$config_path/z-push.conf.php"
|
||||||
ynh_replace_string "__BACKEND_PROVIDER__" "BackendCombined" "$config_path/autodiscover.conf.php"
|
ynh_replace_string "__BACKEND_PROVIDER__" "BackendCombined" "$config_path/autodiscover.conf.php"
|
||||||
sudo cp ../conf/combined.conf.php $config_path/combined.conf.php
|
cp ../conf/combined.conf.php $config_path/combined.conf.php
|
||||||
|
|
||||||
# Configuration of caldav
|
# Configuration of caldav
|
||||||
sudo cp ../conf/caldav.conf.php $config_path/caldav.conf.php
|
cp ../conf/caldav.conf.php $config_path/caldav.conf.php
|
||||||
ynh_replace_string "__DOMAIN__" "$nextclouddomain" "$config_path/caldav.conf.php"
|
ynh_replace_string "__DOMAIN__" "$nextclouddomain" "$config_path/caldav.conf.php"
|
||||||
ynh_replace_string "__CALDAV_PATH__" "$nextcloudpath/remote.php/dav/calendars/%u/personal/" "$config_path/caldav.conf.php"
|
ynh_replace_string "__CALDAV_PATH__" "$nextcloudpath/remote.php/dav/calendars/%u/personal/" "$config_path/caldav.conf.php"
|
||||||
|
|
||||||
# Configuration of carddav
|
# Configuration of carddav
|
||||||
sudo cp ../conf/carddav.conf.php $config_path/carddav.conf.php
|
cp ../conf/carddav.conf.php $config_path/carddav.conf.php
|
||||||
ynh_replace_string "__DOMAIN__" "$nextclouddomain" "$config_path/carddav.conf.php"
|
ynh_replace_string "__DOMAIN__" "$nextclouddomain" "$config_path/carddav.conf.php"
|
||||||
ynh_replace_string "__CARDDAV_PATH__" "$nextcloudpath/remote.php/dav/addressbooks/users/%u/contacts/" "$config_path/carddav.conf.php"
|
ynh_replace_string "__CARDDAV_PATH__" "$nextcloudpath/remote.php/dav/addressbooks/users/%u/contacts/" "$config_path/carddav.conf.php"
|
||||||
ynh_replace_string "__CARDDAV_DEFAULT_PATH__" "$nextcloudpath/remote.php/dav/addressbooks/users/%u/contacts/" "$config_path/carddav.conf.php"
|
ynh_replace_string "__CARDDAV_DEFAULT_PATH__" "$nextcloudpath/remote.php/dav/addressbooks/users/%u/contacts/" "$config_path/carddav.conf.php"
|
||||||
|
@ -170,15 +173,32 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Configuration of imap
|
# Configuration of imap
|
||||||
sudo cp ../conf/imap.conf.php $config_path/imap.conf.php
|
cp ../conf/imap.conf.php $config_path/imap.conf.php
|
||||||
ynh_replace_string "__DOMAIN__" "$domain" "$config_path/imap.conf.php"
|
ynh_replace_string "__DOMAIN__" "$domain" "$config_path/imap.conf.php"
|
||||||
ynh_replace_string "__IMAP_MEETING_USE_CALDAV__" "false" "$config_path/imap.conf.php"
|
ynh_replace_string "__IMAP_MEETING_USE_CALDAV__" "false" "$config_path/imap.conf.php"
|
||||||
|
|
||||||
# Checksum of config files
|
# Checksum of config files
|
||||||
ynh_store_file_checksum "$config_path/imap.conf.php"
|
ynh_store_file_checksum "$config_path/imap.conf.php"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SECURE FILES AND DIRECTORIES
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Set permissions on app files
|
||||||
|
chown -R www-data:www-data $final_path
|
||||||
|
chown -R www-data:www-data $final_logpath
|
||||||
|
chown -R www-data:www-data $statedir
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# FIX STATES
|
||||||
|
#=================================================
|
||||||
|
|
||||||
# Fixstates to avoid full resync of devices after version upgrades
|
# Fixstates to avoid full resync of devices after version upgrades
|
||||||
sudo $final_path/z-push-admin.php -a fixstates
|
$final_path/z-push-admin.php -a fixstates
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# STORE THE CONFIG FILE CHECKSUM
|
||||||
|
#=================================================
|
||||||
|
|
||||||
ynh_backup_if_checksum_is_different "$config_path/policies.ini"
|
ynh_backup_if_checksum_is_different "$config_path/policies.ini"
|
||||||
ynh_backup_if_checksum_is_different "$config_path/z-push.conf.php"
|
ynh_backup_if_checksum_is_different "$config_path/z-push.conf.php"
|
||||||
|
@ -201,15 +221,6 @@ ynh_use_logrotate --non-append
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
#=================================================
|
|
||||||
# SECURE FILES AND DIRECTORIES
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Set permissions on app files
|
|
||||||
chown -R www-data:www-data $final_path
|
|
||||||
chown -R www-data:www-data $log_path
|
|
||||||
chown -R www-data:www-data $state_path
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SSOWAT
|
# SETUP SSOWAT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
Loading…
Add table
Reference in a new issue