mirror of
https://github.com/YunoHost-Apps/sogo_ynh.git
synced 2024-09-03 20:26:07 +02:00
Apply last example_ynh
This commit is contained in:
parent
5f3792a3a9
commit
90eaa2a593
10 changed files with 195 additions and 156 deletions
|
@ -1,29 +1,23 @@
|
||||||
# See here for more informations
|
|
||||||
# https://github.com/YunoHost/package_check#syntax-check_process-file
|
|
||||||
|
|
||||||
# Move this file from check_process.default to check_process when you have filled it.
|
|
||||||
|
|
||||||
;; Test complet
|
;; Test complet
|
||||||
; Manifest
|
; Manifest
|
||||||
domain="domain.tld"
|
domain="domain.tld"
|
||||||
path="/SOGo"
|
is_public=1
|
||||||
admin="john"
|
admin="john"
|
||||||
is_public=1
|
; Checks
|
||||||
; Checks
|
pkg_linter=1
|
||||||
pkg_linter=1
|
setup_sub_dir=1
|
||||||
setup_sub_dir=1
|
setup_root=0
|
||||||
setup_root=0
|
setup_nourl=0
|
||||||
setup_nourl=0
|
setup_private=1
|
||||||
setup_private=1
|
setup_public=1
|
||||||
setup_public=1
|
upgrade=1
|
||||||
upgrade=1
|
upgrade=1 from_commit=cc07f5da79498ef948c31a99f6ace9ad0a5b9ec1
|
||||||
upgrade=1 from_commit=cc07f5da79498ef948c31a99f6ace9ad0a5b9ec1
|
upgrade=1 from_commit=2fc174c57586df38506a07195decb08eed02f55f
|
||||||
upgrade=1 from_commit=2fc174c57586df38506a07195decb08eed02f55f
|
backup_restore=1
|
||||||
backup_restore=1
|
multi_instance=0
|
||||||
multi_instance=0
|
change_url=0
|
||||||
change_url=0
|
|
||||||
;;; Upgrade options
|
;;; Upgrade options
|
||||||
; commit=cc07f5da79498ef948c31a99f6ace9ad0a5b9ec1
|
; commit=cc07f5da79498ef948c31a99f6ace9ad0a5b9ec1
|
||||||
name=Before group permission support
|
name=Before group permission support
|
||||||
; commit=2fc174c57586df38506a07195decb08eed02f55f
|
; commit=2fc174c57586df38506a07195decb08eed02f55f
|
||||||
name=Before refactoring
|
name=Before refactoring
|
||||||
|
|
|
@ -1,27 +1,29 @@
|
||||||
# SOGo Proxying
|
# SOGo Proxying
|
||||||
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
|
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
|
||||||
location ^~ __PATH__/ {
|
location ^~ __PATH__/ {
|
||||||
proxy_pass http://127.0.0.1:__PORT__;
|
proxy_pass http://127.0.0.1:__PORT__;
|
||||||
proxy_redirect http://127.0.0.1:__PORT__/SOGo/ /SOGo;
|
proxy_redirect http://127.0.0.1:__PORT__/SOGo/ /SOGo;
|
||||||
# forward user's IP address
|
# forward user's IP address
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
proxy_set_header x-webobjects-server-protocol HTTP/1.0;
|
proxy_set_header x-webobjects-server-protocol HTTP/1.0;
|
||||||
proxy_set_header x-webobjects-remote-host 127.0.0.1;
|
proxy_set_header x-webobjects-remote-host 127.0.0.1;
|
||||||
proxy_set_header x-webobjects-server-name $server_name;
|
proxy_set_header x-webobjects-server-name $server_name;
|
||||||
proxy_set_header x-webobjects-server-url $scheme://$host;
|
proxy_set_header x-webobjects-server-url $scheme://$host;
|
||||||
include conf.d/yunohost_panel.conf.inc;
|
|
||||||
|
|
||||||
client_max_body_size 100M;
|
client_max_body_size 100M;
|
||||||
|
|
||||||
|
# Include SSOWAT user panel.
|
||||||
|
include conf.d/yunohost_panel.conf.inc;
|
||||||
}
|
}
|
||||||
|
|
||||||
location __PATH__.woa/WebServerResources/ {
|
location __PATH__.woa/WebServerResources/ {
|
||||||
alias /usr/lib/GNUstep/SOGo/WebServerResources/;
|
alias /usr/lib/GNUstep/SOGo/WebServerResources/;
|
||||||
}
|
}
|
||||||
location __PATH__/WebServerResources/ {
|
location __PATH__/WebServerResources/ {
|
||||||
alias /usr/lib/GNUstep/SOGo/WebServerResources/;
|
alias /usr/lib/GNUstep/SOGo/WebServerResources/;
|
||||||
}
|
}
|
||||||
location ^__PATH__/so/ControlPanel/Products/([^/]*)/Resources/(.*)$ {
|
location ^__PATH__/so/ControlPanel/Products/([^/]*)/Resources/(.*)$ {
|
||||||
alias /usr/lib/GNUstep/SOGo/$1.SOGo/Resources/$2;
|
alias /usr/lib/GNUstep/SOGo/$1.SOGo/Resources/$2;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,13 +4,13 @@ After=network.target
|
||||||
After=mariadb.service
|
After=mariadb.service
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
|
Type=forking
|
||||||
|
User=__APP__
|
||||||
Environment="PREFORK=3"
|
Environment="PREFORK=3"
|
||||||
Environment="LD_LIBRARY_PATH=/lib:/usr/lib:/opt/yunohost/__APP__/Library/Libraries/sogo:/opt/yunohost/__APP__/Local/Library/Libraries/sogo"
|
Environment="LD_LIBRARY_PATH=/lib:/usr/lib:/opt/yunohost/__APP__/Library/Libraries/sogo:/opt/yunohost/__APP__/Local/Library/Libraries/sogo"
|
||||||
EnvironmentFile=-/etc/default/__APP__
|
EnvironmentFile=-/etc/default/__APP__
|
||||||
Type=forking
|
|
||||||
ExecStart=/opt/yunohost/__APP__/sbin/sogod -WOWorkersCount ${PREFORK} -WOPidFile /run/__APP__/sogo.pid -WOLogFile /var/log/__APP__/sogo.log
|
ExecStart=/opt/yunohost/__APP__/sbin/sogod -WOWorkersCount ${PREFORK} -WOPidFile /run/__APP__/sogo.pid -WOLogFile /var/log/__APP__/sogo.log
|
||||||
PIDFile=/run/__APP__/sogo.pid
|
PIDFile=/run/__APP__/sogo.pid
|
||||||
User=__APP__
|
|
||||||
|
|
||||||
# Sandboxing options to harden security
|
# Sandboxing options to harden security
|
||||||
# Depending on specificities of your service/app, you may need to tweak these
|
# Depending on specificities of your service/app, you may need to tweak these
|
||||||
|
|
|
@ -25,32 +25,32 @@
|
||||||
"email": "mattronix@weho.st",
|
"email": "mattronix@weho.st",
|
||||||
"url": "http://sogo.nu"
|
"url": "http://sogo.nu"
|
||||||
},
|
},
|
||||||
|
"requirements": {
|
||||||
|
"yunohost": ">= 4.3.0"
|
||||||
|
},
|
||||||
"multi_instance": false,
|
"multi_instance": false,
|
||||||
"services": [
|
"services": [
|
||||||
"nginx",
|
"nginx",
|
||||||
"mysql"
|
"mysql"
|
||||||
],
|
],
|
||||||
"requirements": {
|
|
||||||
"yunohost": ">= 4.3.0"
|
|
||||||
},
|
|
||||||
"arguments": {
|
"arguments": {
|
||||||
"install" : [
|
"install": [
|
||||||
{
|
{
|
||||||
"name": "domain",
|
"name": "domain",
|
||||||
"type": "domain"
|
"type": "domain"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "admin",
|
|
||||||
"type": "user"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "is_public",
|
"name": "is_public",
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"help": {
|
"help": {
|
||||||
"en": "If it's not public, everybody which want to access to any page of SOGo need to be authenticated on the SSO. On the public mode anybody can access to the authentication page. The shared calendar will be also accessible by anybody who has this link",
|
"en": "If it's not public, everybody which want to access to any page of SOGo need to be authenticated on the SSO. On the public mode anybody can access to the authentication page. The shared calendar will be also accessible by anybody who has this link",
|
||||||
"fr": "Si n'est pas publique, n'importe qui veux accéder à n'importe quelle page de SOGo doit être authentifié dans le SSO. Dans le mode publique n'importe qui peut accéder à la page d'authentification de SOGo. Les agenda partagé seront aussi accessible par n'import qui qui à ce liens."
|
"fr": "Si n'est pas publique, n'importe qui veux accéder à n'importe quelle page de SOGo doit être authentifié dans le SSO. Dans le mode publique n'importe qui peut accéder à la page d'authentification de SOGo. Les agenda partagé seront aussi accessible par n'import qui qui à ce liens."
|
||||||
},
|
},
|
||||||
"default": true
|
"default": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "admin",
|
||||||
|
"type": "user"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SET ALL CONSTANTS
|
# COMMON VARIABLES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# dependencies used by the app
|
# dependencies used by the app
|
||||||
pkg_dependencies="sogo stunnel4 memcached"
|
pkg_dependencies="sogo stunnel4 memcached"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DEFINE ALL COMMON FONCTIONS
|
# PERSONAL HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
config_stunnel() {
|
config_stunnel() {
|
||||||
|
@ -60,3 +60,11 @@ set_permission() {
|
||||||
chown -R $app:$app /var/log/$app
|
chown -R $app:$app /var/log/$app
|
||||||
chmod u=rwX,g=rX,o= -R /var/log/$app
|
chmod u=rwX,g=rX,o= -R /var/log/$app
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# EXPERIMENTAL HELPERS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# FUTURE OFFICIAL HELPERS
|
||||||
|
#=================================================
|
||||||
|
|
|
@ -15,7 +15,6 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_clean_setup () {
|
ynh_clean_setup () {
|
||||||
### Remove this function if there's nothing to clean before calling the remove script.
|
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
# Exit if an error occurs during the execution of the script
|
# Exit if an error occurs during the execution of the script
|
||||||
|
@ -43,27 +42,14 @@ ynh_print_info --message="Declaring files to be backed up..."
|
||||||
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP SOGo CONFIGURATION
|
# SPECIFIC BACKUP
|
||||||
|
#=================================================
|
||||||
|
# BACKUP VARIOUS FILES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_backup --src_path="/etc/$app"
|
ynh_backup --src_path="/etc/$app"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# BACKUP STUNNEL CONFIGURATION
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
ynh_backup --src_path="/etc/stunnel/$app.conf"
|
ynh_backup --src_path="/etc/stunnel/$app.conf"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# BACKUP CRON
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
ynh_backup --src_path="/etc/cron.d/$app"
|
ynh_backup --src_path="/etc/cron.d/$app"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# BACKUP LOGS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
ynh_backup --src_path="/var/log/$app"
|
ynh_backup --src_path="/var/log/$app"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -12,12 +12,12 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
# RETRIEVE ARGUMENTS
|
# RETRIEVE ARGUMENTS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Loading installation settings..."
|
|
||||||
|
|
||||||
# RETRIEVE ARGUMENTS
|
|
||||||
old_domain=$YNH_APP_OLD_DOMAIN
|
old_domain=$YNH_APP_OLD_DOMAIN
|
||||||
domain=$YNH_APP_NEW_DOMAIN
|
old_path=$YNH_APP_OLD_PATH
|
||||||
path_url=$YNH_APP_NEW_PATH
|
|
||||||
|
new_domain=$YNH_APP_NEW_DOMAIN
|
||||||
|
new_path="/SOGo"
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
|
@ -26,31 +26,68 @@ app=$YNH_APP_INSTANCE_NAME
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Loading installation settings..." --weight=1
|
ynh_script_progression --message="Loading installation settings..." --weight=1
|
||||||
|
|
||||||
port=$(ynh_app_setting_get --app=$app --key=web_port)
|
# Needed for helper "ynh_add_nginx_config"
|
||||||
admin=$(ynh_app_setting_get --app=$app --key=admin)
|
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
|
|
||||||
# Check if the new path stay /SOGo if not exit
|
# Add settings here as needed by your application
|
||||||
|
port=$(ynh_app_setting_get --app=$app --key=web_port)
|
||||||
|
admin=$(ynh_app_setting_get --app=$app --key=admin)
|
||||||
|
|
||||||
if [[ $path_url != "/SOGo" ]]
|
#=================================================
|
||||||
|
# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..."
|
||||||
|
|
||||||
|
# Backup the current version of the app
|
||||||
|
ynh_backup_before_upgrade
|
||||||
|
ynh_clean_setup () {
|
||||||
|
ynh_clean_check_starting
|
||||||
|
# Remove the new domain config file, the remove script won't do it as it doesn't know yet its location.
|
||||||
|
ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
||||||
|
|
||||||
|
# Restore it if the upgrade fails
|
||||||
|
ynh_restore_upgradebackup
|
||||||
|
}
|
||||||
|
# Exit if an error occurs during the execution of the script
|
||||||
|
ynh_abort_if_errors
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# CHECK WHICH PARTS SHOULD BE CHANGED
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
change_domain=0
|
||||||
|
if [ "$old_domain" != "$new_domain" ]
|
||||||
then
|
then
|
||||||
ynh_die --message "You can't use an other path than '/SOGo'"
|
change_domain=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
change_path=0
|
||||||
|
if [ "$old_path" != "$new_path" ]
|
||||||
|
then
|
||||||
|
change_path=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD MODIFICATIONS
|
# STANDARD MODIFICATIONS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Updating NGINX configuration..."
|
|
||||||
|
|
||||||
# MODIFY URL IN NGINX CONF
|
# MODIFY URL IN NGINX CONF
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="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 domain for nginx
|
# Change the domain for NGINX
|
||||||
# Delete file checksum for the old conf file location
|
if [ $change_domain -eq 1 ]
|
||||||
ynh_delete_file_checksum --file "$nginx_conf_path"
|
then
|
||||||
mv $nginx_conf_path /etc/nginx/conf.d/$domain.d/$app.conf
|
# Delete file checksum for the old conf file location
|
||||||
# Store file checksum for the new config file location
|
ynh_delete_file_checksum --file="$nginx_conf_path"
|
||||||
ynh_store_file_checksum --file "/etc/nginx/conf.d/$domain.d/$app.conf"
|
mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
|
||||||
|
# Store file checksum for the new config file location
|
||||||
|
ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
||||||
|
fi
|
||||||
|
|
||||||
|
domain=$new_domain
|
||||||
|
path_url=$new_path
|
||||||
|
|
||||||
#Configure Nginx
|
#Configure Nginx
|
||||||
config_nginx
|
config_nginx
|
||||||
|
|
|
@ -14,8 +14,7 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_clean_setup () {
|
ynh_clean_setup () {
|
||||||
### Remove this function if there's nothing to clean before calling the remove script.
|
ynh_clean_check_starting
|
||||||
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
|
||||||
|
@ -25,8 +24,9 @@ ynh_abort_if_errors
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
domain=$YNH_APP_ARG_DOMAIN
|
domain=$YNH_APP_ARG_DOMAIN
|
||||||
admin=$YNH_APP_ARG_ADMIN
|
path_url="/SOGo"
|
||||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||||
|
admin=$YNH_APP_ARG_ADMIN
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
|
@ -35,9 +35,6 @@ app=$YNH_APP_INSTANCE_NAME
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Validating installation parameters..." --weight=1
|
ynh_script_progression --message="Validating installation parameters..." --weight=1
|
||||||
|
|
||||||
# Set variable
|
|
||||||
path_url="/SOGo"
|
|
||||||
|
|
||||||
# Register (book) web path
|
# Register (book) web path
|
||||||
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
|
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
|
||||||
|
|
||||||
|
@ -80,6 +77,16 @@ db_user=$db_name
|
||||||
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
||||||
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name
|
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# NGINX CONFIGURATION
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Configuring NGINX web server..." --weight=1
|
||||||
|
|
||||||
|
# Create a dedicated NGINX config
|
||||||
|
config_nginx
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SPECIFIC SETUP
|
||||||
#=================================================
|
#=================================================
|
||||||
# ADD A CONFIGURATION
|
# ADD A CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -105,13 +112,6 @@ ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app"
|
||||||
chown root: "/etc/cron.d/$app"
|
chown root: "/etc/cron.d/$app"
|
||||||
chmod 644 "/etc/cron.d/$app"
|
chmod 644 "/etc/cron.d/$app"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# NGINX CONFIGURATION
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Configuring NGINX web server..." --weight=1
|
|
||||||
|
|
||||||
config_nginx
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SECURE FILES AND DIRECTORIES
|
# SECURE FILES AND DIRECTORIES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -129,6 +129,7 @@ chmod u=rwX,g=rX,o= -R /var/log/$app
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring log rotation..." --weight=1
|
ynh_script_progression --message="Configuring log rotation..." --weight=1
|
||||||
|
|
||||||
|
# Use logrotate to manage application logfile(s)
|
||||||
ynh_use_logrotate --logfile="/var/log/$app/sogo.log" --nonappend
|
ynh_use_logrotate --logfile="/var/log/$app/sogo.log" --nonappend
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -143,6 +144,7 @@ yunohost service add $app --description="Groupware for E-Mail, Contacts and Cale
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
||||||
|
|
||||||
|
# Start a systemd service
|
||||||
ynh_systemd_action --service_name=$app --action="restart" --log_path="systemd"
|
ynh_systemd_action --service_name=$app --action="restart" --log_path="systemd"
|
||||||
ynh_systemd_action --service_name=stunnel4 --action="restart" --log_path="systemd"
|
ynh_systemd_action --service_name=stunnel4 --action="restart" --log_path="systemd"
|
||||||
|
|
||||||
|
@ -151,14 +153,15 @@ ynh_systemd_action --service_name=stunnel4 --action="restart" --log_path="system
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring permissions..." --weight=1
|
ynh_script_progression --message="Configuring permissions..." --weight=1
|
||||||
|
|
||||||
|
# Make app public if necessary
|
||||||
if [ $is_public -eq 1 ]
|
if [ $is_public -eq 1 ]
|
||||||
then
|
then
|
||||||
ynh_permission_update --permission="main" --add="visitors"
|
# Everyone can access the app.
|
||||||
|
# The "main" permission is automatically created before the install script.
|
||||||
|
ynh_permission_update --permission="main" --add="visitors"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ynh_permission_create --permission="sync_client" --allowed='visitors' --auth_header=false\
|
ynh_permission_create --permission="sync_client" --allowed='visitors' --auth_header=false --label="Sync client" --protected=true --show_tile=false --additional_urls="/Microsoft-Server-ActiveSync" "/principals" "/.well-known/caldav" "/.well-known/carddav"
|
||||||
--label="Sync client" --protected=true --show_tile=false\
|
|
||||||
--additional_urls="/Microsoft-Server-ActiveSync" "/principals" "/.well-known/caldav" "/.well-known/carddav"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
|
|
|
@ -15,8 +15,7 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_clean_setup () {
|
ynh_clean_setup () {
|
||||||
#### Remove this function if there's nothing to clean before calling the remove script.
|
ynh_clean_check_starting
|
||||||
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
|
||||||
|
@ -33,13 +32,6 @@ path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||||
db_user=$db_name
|
db_user=$db_name
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RESTORE THE NGINX CONFIGURATION
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Restoring the NGINX configuration..." --weight=1
|
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REINSTALL DEPENDENCIES
|
# REINSTALL DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -48,10 +40,12 @@ ynh_script_progression --message="Reinstalling dependencies..." --weight=1
|
||||||
# Define and install dependencies
|
# Define and install dependencies
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
ynh_install_app_dependencies $pkg_dependencies
|
||||||
|
|
||||||
# Restore all config and data
|
#=================================================
|
||||||
#ynh_script_progression --message="Restoring files..." --weight=10
|
# RESTORE THE NGINX CONFIGURATION
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Restoring the NGINX web server configuration..." --weight=1
|
||||||
|
|
||||||
#ynh_restore
|
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE MYSQL DATABASE
|
# RESTORE THE MYSQL DATABASE
|
||||||
|
@ -88,12 +82,14 @@ chmod u=rwX,g=rX,o= -R /var/log/$app
|
||||||
# RESTORE SYSTEMD
|
# RESTORE SYSTEMD
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring the systemd configuration..." --weight=1
|
ynh_script_progression --message="Restoring the systemd configuration..." --weight=1
|
||||||
|
|
||||||
systemctl enable $app.service --quiet
|
systemctl enable $app.service --quiet
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE LOGROTATE CONFIGURATION
|
# RESTORE THE LOGROTATE CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring the logrotate configuration..." --weight=1
|
ynh_script_progression --message="Restoring the logrotate configuration..." --weight=1
|
||||||
|
|
||||||
ynh_use_logrotate --logfile="/var/log/$app/sogo.log" --nonappend
|
ynh_use_logrotate --logfile="/var/log/$app/sogo.log" --nonappend
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -112,7 +108,9 @@ ynh_systemd_action --service_name=$app --action="restart" --log_path="systemd"
|
||||||
ynh_systemd_action --service_name=stunnel4 --action="restart" --log_path="systemd"
|
ynh_systemd_action --service_name=stunnel4 --action="restart" --log_path="systemd"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX AND PHP-FPM
|
# GENERIC FINALIZATION
|
||||||
|
#=================================================
|
||||||
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@ db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK VERSION
|
# CHECK VERSION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Checking version..."
|
||||||
|
|
||||||
upgrade_type=$(ynh_check_app_version_changed)
|
upgrade_type=$(ynh_check_app_version_changed)
|
||||||
|
|
||||||
|
@ -39,59 +40,67 @@ ynh_script_progression --message="Backing up the app before upgrading (may take
|
||||||
# Backup the current version of the app
|
# Backup the current version of the app
|
||||||
ynh_backup_before_upgrade
|
ynh_backup_before_upgrade
|
||||||
ynh_clean_setup () {
|
ynh_clean_setup () {
|
||||||
# Restore it if the upgrade fails
|
ynh_clean_check_starting
|
||||||
ynh_restore_upgradebackup
|
# Restore it if the upgrade fails
|
||||||
|
ynh_restore_upgradebackup
|
||||||
}
|
}
|
||||||
# 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
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# UPGRADE SETTINGS FROM OLD INSTALL
|
# STANDARD UPGRADE STEPS
|
||||||
|
#=================================================
|
||||||
|
# STOP SYSTEMD SERVICE
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Stopping a systemd service..."
|
||||||
|
|
||||||
|
ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# ENSURE DOWNWARD COMPATIBILITY
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
||||||
|
|
||||||
if [[ -z $port ]]; then
|
if [[ -z $port ]]; then
|
||||||
# Find a port for SOGo
|
# Find a port for SOGo
|
||||||
port=$(ynh_find_port --port=20000)
|
port=$(ynh_find_port --port=20000)
|
||||||
ynh_app_setting_set --app=$app --key=web_port --value=$port
|
ynh_app_setting_set --app=$app --key=web_port --value=$port
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z $db_name ]]; then
|
if [[ -z $db_name ]]; then
|
||||||
db_name=$app
|
db_name=$app
|
||||||
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z $db_user ]]; then
|
if [[ -z $db_user ]]; then
|
||||||
db_user=$app
|
db_user=$app
|
||||||
ynh_app_setting_set --app=$app --key=db_user --value=$db_user
|
ynh_app_setting_set --app=$app --key=db_user --value=$db_user
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Cleaning legacy permissions
|
# Cleaning legacy permissions
|
||||||
if ynh_legacy_permissions_exists; then
|
if ynh_legacy_permissions_exists; then
|
||||||
ynh_legacy_permissions_delete_all
|
ynh_legacy_permissions_delete_all
|
||||||
|
|
||||||
ynh_app_setting_delete --app=$app --key=is_public
|
ynh_app_setting_delete --app=$app --key=is_public
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Manage migrations
|
# Manage migrations
|
||||||
ynh_script_progression --message="Migrating database if needed..."
|
ynh_script_progression --message="Migrating database if needed..."
|
||||||
|
|
||||||
if ynh_compare_current_package_version --comparison le --version 4.0.0~ynh0; then
|
if ynh_compare_current_package_version --comparison le --version 4.0.0~ynh0; then
|
||||||
ynh_replace_string --match_string __APP__ --replace_string $app --target_file migrations/3.2-4.0.sh
|
ynh_replace_string --match_string __APP__ --replace_string $app --target_file migrations/3.2-4.0.sh
|
||||||
ynh_replace_string --match_string __DBUSER__ --replace_string $db_user --target_file migrations/3.2-4.0.sh
|
ynh_replace_string --match_string __DBUSER__ --replace_string $db_user --target_file migrations/3.2-4.0.sh
|
||||||
ynh_replace_string --match_string __DBPASS__ --replace_string $db_pwd --target_file migrations/3.2-4.0.sh
|
ynh_replace_string --match_string __DBPASS__ --replace_string $db_pwd --target_file migrations/3.2-4.0.sh
|
||||||
bash migrations/3.2-4.0.sh
|
bash migrations/3.2-4.0.sh
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! ynh_permission_exists --permission="sync_client"; then
|
if ! ynh_permission_exists --permission="sync_client"; then
|
||||||
# Create the required permissions
|
# Create the required permissions
|
||||||
ynh_permission_create --permission="sync_client" --allowed='visitors' --auth_header=false\
|
ynh_permission_create --permission="sync_client" --allowed='visitors' --auth_header=false\
|
||||||
--label="Sync client" --protected=true --show_tile=false\
|
--label="Sync client" --protected=true --show_tile=false\
|
||||||
--additional_urls="/Microsoft-Server-ActiveSync" "/principals" "/.well-known/caldav" "/.well-known/carddav"
|
--additional_urls="/Microsoft-Server-ActiveSync" "/principals" "/.well-known/caldav" "/.well-known/carddav"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# STANDARD MODIFICATIONS
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# UPGRADE DEPENDENCIES
|
# UPGRADE DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -99,6 +108,15 @@ ynh_script_progression --message="Upgrading dependencies..." --weight=1
|
||||||
|
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
ynh_install_app_dependencies $pkg_dependencies
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# NGINX CONFIGURATION
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1
|
||||||
|
|
||||||
|
config_nginx
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SPECIFIC UPGRADE
|
||||||
#=================================================
|
#=================================================
|
||||||
# UPDATE A CONFIG FILE
|
# UPDATE A CONFIG FILE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -122,13 +140,6 @@ ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app"
|
||||||
chown root: "/etc/cron.d/$app"
|
chown root: "/etc/cron.d/$app"
|
||||||
chmod 644 "/etc/cron.d/$app"
|
chmod 644 "/etc/cron.d/$app"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# NGINX CONFIGURATION
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1
|
|
||||||
|
|
||||||
config_nginx
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SECURE FILES AND DIRECTORIES
|
# SECURE FILES AND DIRECTORIES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -145,15 +156,15 @@ chmod u=rwX,g=rX,o= -R /var/log/$app
|
||||||
ynh_script_progression --message="Configuring permissions..."
|
ynh_script_progression --message="Configuring permissions..."
|
||||||
|
|
||||||
if ! ynh_permission_exists --permission sync_client; then
|
if ! ynh_permission_exists --permission sync_client; then
|
||||||
ynh_permission_create --permission="sync_client" --allowed 'visitors' --auth_header=false\
|
ynh_permission_create --permission="sync_client" --allowed 'visitors' --auth_header=false\
|
||||||
--label="Sync client" --protected=true --show_tile=false\
|
--label="Sync client" --protected=true --show_tile=false\
|
||||||
--additional_urls="/Microsoft-Server-ActiveSync" "/principals" "/.well-known/caldav" "/.well-known/carddav"
|
--additional_urls="/Microsoft-Server-ActiveSync" "/principals" "/.well-known/caldav" "/.well-known/carddav"
|
||||||
python3 remove_sso_conf_persistent.py $domain \
|
python3 remove_sso_conf_persistent.py $domain \
|
||||||
|| ynh_print_warn --message="Your file /etc/ssowat/""conf.json.persistent doesn't respect the json syntax. The config file wasn't cleaned. Please clean it manually."
|
|| ynh_print_warn --message="Your file /etc/ssowat/""conf.json.persistent doesn't respect the json syntax. The config file wasn't cleaned. Please clean it manually."
|
||||||
else
|
else
|
||||||
ynh_permission_update --permission="sync_client" --add='visitors' --label="Sync client" --protected=true --show_tile=false
|
ynh_permission_update --permission="sync_client" --add='visitors' --label="Sync client" --protected=true --show_tile=false
|
||||||
ynh_permission_url --permission "sync_client" --auth_header=false\
|
ynh_permission_url --permission "sync_client" --auth_header=false\
|
||||||
--add_url="/Microsoft-Server-ActiveSync" "/principals" "/.well-known/caldav" "/.well-known/carddav"
|
--add_url="/Microsoft-Server-ActiveSync" "/principals" "/.well-known/caldav" "/.well-known/carddav"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
Loading…
Add table
Reference in a new issue