1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/horde_ynh.git synced 2024-09-03 19:16:08 +02:00

Apply last example_ynh

This commit is contained in:
yalh76 2022-03-09 00:27:32 +01:00
parent 77c587f4d7
commit e81e13519f
17 changed files with 680 additions and 303 deletions

View file

@ -1,15 +1,10 @@
# 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="domain.tld"
path="/path" (PATH) path="/path"
admin="john" (USER) is_public=1
language="fr" language="fr"
is_public=1 (PUBLIC|public=1|private=0) admin="john"
service_autodiscovery=1 service_autodiscovery=1
whups_install=1 whups_install=1
sesha_install=1 sesha_install=1
@ -23,23 +18,12 @@
setup_private=1 setup_private=1
setup_public=1 setup_public=1
upgrade=1 upgrade=1
# 5.2.22~ynh4
upgrade=1 from_commit=88e078661c230a9fe694624367b4b152950ae894
backup_restore=1 backup_restore=1
multi_instance=1 multi_instance=1
incorrect_path=1
port_already_use=0 port_already_use=0
change_url=1 change_url=1
;;; Levels
Level 1=auto
Level 2=auto
Level 3=auto
# https://github.com/YunoHost-Apps/horde_ynh/blob/master/sources/sso_auth.patch
Level 4=1
Level 5=auto
Level 6=auto
Level 7=auto
Level 8=0
Level 9=0
Level 10=0
;;; Options ;;; Options
Email= Email=
Notification=none Notification=none

View file

@ -1,6 +0,0 @@
SOURCE_URL=url of app's source
SOURCE_SUM=sha256 checksum
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=

View file

@ -4,10 +4,6 @@ location __PATH__/ {
# Path to source # Path to source
alias __FINALPATH__/horde/ ; alias __FINALPATH__/horde/ ;
if ($scheme = http) {
rewrite ^ https://$server_name$request_uri? permanent;
}
index index.php; index index.php;
# Common parameter to increase upload size limit in conjuction with dedicated php-fpm file # Common parameter to increase upload size limit in conjuction with dedicated php-fpm file
@ -20,18 +16,16 @@ location __PATH__/ {
try_files $uri $uri/ index.php; try_files $uri $uri/ index.php;
location ~ [^/]\.php(/|$) { location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$; fastcgi_split_path_info ^(.+?\.php)(/.*)$;
fastcgi_pass unix:/var/run/php5-fpm-__NAME__.sock; fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock;
fastcgi_index index.php; fastcgi_index index.php;
include fastcgi_params; include fastcgi_params;
fastcgi_param REMOTE_USER $remote_user; fastcgi_param REMOTE_USER $remote_user;
fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $request_filename; fastcgi_param SCRIPT_FILENAME $request_filename;
} }
# PHP configuration end
# Include SSOWAT user panel. # Include SSOWAT user panel.
include conf.d/yunohost_panel.conf.inc; include conf.d/yunohost_panel.conf.inc;
more_clear_input_headers 'Accept-Encoding'; more_clear_input_headers 'Accept-Encoding';
} }

View file

@ -1,10 +1,11 @@
; Start a new pool named 'www'. ; Start a new pool named 'www'.
; the variable $pool can we used in any directive and will be replaced by the ; the variable $pool can be used in any directive and will be replaced by the
; pool name ('www' here) ; pool name ('www' here)
[__NAMETOCHANGE__] [__NAMETOCHANGE__]
; Per pool prefix ; Per pool prefix
; It only applies on the following directives: ; It only applies on the following directives:
; - 'access.log'
; - 'slowlog' ; - 'slowlog'
; - 'listen' (unixsocket) ; - 'listen' (unixsocket)
; - 'chroot' ; - 'chroot'
@ -24,17 +25,19 @@ group = __USER__
; The address on which to accept FastCGI requests. ; The address on which to accept FastCGI requests.
; Valid syntaxes are: ; Valid syntaxes are:
; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific address on ; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific IPv4 address on
; a specific port; ; a specific port;
; 'port' - to listen on a TCP socket to all addresses on a ; '[ip:6:addr:ess]:port' - to listen on a TCP socket to a specific IPv6 address on
; specific port; ; a specific port;
; 'port' - to listen on a TCP socket to all addresses
; (IPv6 and IPv4-mapped) on a specific port;
; '/path/to/unix/socket' - to listen on a unix socket. ; '/path/to/unix/socket' - to listen on a unix socket.
; Note: This value is mandatory. ; Note: This value is mandatory.
listen = /var/run/php5-fpm-__NAMETOCHANGE__.sock listen = /var/run/php/php__PHPVERSION__-fpm-__NAMETOCHANGE__.sock
; Set listen(2) backlog. A value of '-1' means unlimited. ; Set listen(2) backlog.
; Default Value: 128 (-1 on FreeBSD and OpenBSD) ; Default Value: 511 (-1 on FreeBSD and OpenBSD)
;listen.backlog = 128 ;listen.backlog = 511
; Set permissions for unix socket, if one is used. In Linux, read/write ; Set permissions for unix socket, if one is used. In Linux, read/write
; permissions must be set in order to allow connections from a web server. Many ; permissions must be set in order to allow connections from a web server. Many
@ -44,8 +47,13 @@ listen = /var/run/php5-fpm-__NAMETOCHANGE__.sock
listen.owner = www-data listen.owner = www-data
listen.group = www-data listen.group = www-data
;listen.mode = 0660 ;listen.mode = 0660
; When POSIX Access Control Lists are supported you can set them using
; these options, value is a comma separated list of user/group names.
; When set, listen.owner and listen.group are ignored
;listen.acl_users =
;listen.acl_groups =
; List of ipv4 addresses of FastCGI clients which are allowed to connect. ; List of addresses (IPv4/IPv6) of FastCGI clients which are allowed to connect.
; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original ; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original
; PHP FCGI (5.2.2+). Makes sense only with a tcp listening socket. Each address ; PHP FCGI (5.2.2+). Makes sense only with a tcp listening socket. Each address
; must be separated by a comma. If this value is left blank, connections will be ; must be separated by a comma. If this value is left blank, connections will be
@ -59,7 +67,13 @@ listen.group = www-data
; - The pool processes will inherit the master process priority ; - The pool processes will inherit the master process priority
; unless it specified otherwise ; unless it specified otherwise
; Default Value: no set ; Default Value: no set
; priority = -19 ; process.priority = -19
; Set the process dumpable flag (PR_SET_DUMPABLE prctl) even if the process user
; or group is differrent than the master process user. It allows to create process
; core dump and ptrace the process for the pool user.
; Default Value: no
; process.dumpable = yes
; Choose how the process manager will control the number of child processes. ; Choose how the process manager will control the number of child processes.
; Possible Values: ; Possible Values:
@ -215,7 +229,7 @@ pm.max_requests = 500
; last request memory: 0 ; last request memory: 0
; ;
; Note: There is a real-time FPM status monitoring sample web page available ; Note: There is a real-time FPM status monitoring sample web page available
; It's available in: ${prefix}/share/fpm/status.html ; It's available in: /usr/share/php/7.0/fpm/status.html
; ;
; Note: The value must start with a leading slash (/). The value can be ; Note: The value must start with a leading slash (/). The value can be
; anything, but it may not be a good idea to use the .php extension or it ; anything, but it may not be a good idea to use the .php extension or it
@ -275,7 +289,7 @@ pm.max_requests = 500
; - %{megabytes}M ; - %{megabytes}M
; - %{mega}M ; - %{mega}M
; %n: pool name ; %n: pool name
; %o: ouput header ; %o: output header
; it must be associated with embraces to specify the name of the header: ; it must be associated with embraces to specify the name of the header:
; - %{Content-Type}o ; - %{Content-Type}o
; - %{X-Powered-By}o ; - %{X-Powered-By}o
@ -291,9 +305,13 @@ pm.max_requests = 500
; %t: server time the request was received ; %t: server time the request was received
; it can accept a strftime(3) format: ; it can accept a strftime(3) format:
; %d/%b/%Y:%H:%M:%S %z (default) ; %d/%b/%Y:%H:%M:%S %z (default)
; The strftime(3) format must be encapsuled in a %{<strftime_format>}t tag
; e.g. for a ISO8601 formatted timestring, use: %{%Y-%m-%dT%H:%M:%S%z}t
; %T: time the log has been written (the request has finished) ; %T: time the log has been written (the request has finished)
; it can accept a strftime(3) format: ; it can accept a strftime(3) format:
; %d/%b/%Y:%H:%M:%S %z (default) ; %d/%b/%Y:%H:%M:%S %z (default)
; The strftime(3) format must be encapsuled in a %{<strftime_format>}t tag
; e.g. for a ISO8601 formatted timestring, use: %{%Y-%m-%dT%H:%M:%S%z}t
; %u: remote user ; %u: remote user
; ;
; Default: "%R - %u %t \"%m %r\" %s" ; Default: "%R - %u %t \"%m %r\" %s"
@ -349,13 +367,22 @@ chdir = __FINALPATH__
; Default Value: no ; Default Value: no
catch_workers_output = yes catch_workers_output = yes
; Clear environment in FPM workers
; Prevents arbitrary environment variables from reaching FPM worker processes
; by clearing the environment in workers before env vars specified in this
; pool configuration are added.
; Setting to "no" will make all environment variables available to PHP code
; via getenv(), $_ENV and $_SERVER.
; Default Value: yes
;clear_env = no
; Limits the extensions of the main script FPM will allow to parse. This can ; Limits the extensions of the main script FPM will allow to parse. This can
; prevent configuration mistakes on the web server side. You should only limit ; prevent configuration mistakes on the web server side. You should only limit
; FPM to .php extensions to prevent malicious users to use other extensions to ; FPM to .php extensions to prevent malicious users to use other extensions to
; exectute php code. ; execute php code.
; Note: set an empty value to allow all extensions. ; Note: set an empty value to allow all extensions.
; Default Value: .php ; Default Value: .php
;security.limit_extensions = .php .php3 .php4 .php5 ;security.limit_extensions = .php .php3 .php4 .php5 .php7
; Pass environment variables like LD_LIBRARY_PATH. All $VARIABLEs are taken from ; Pass environment variables like LD_LIBRARY_PATH. All $VARIABLEs are taken from
; the current environment. ; the current environment.
@ -391,6 +418,17 @@ catch_workers_output = yes
;php_admin_flag[log_errors] = on ;php_admin_flag[log_errors] = on
;php_admin_value[memory_limit] = 32M ;php_admin_value[memory_limit] = 32M
; Common values to change to increase file upload limit
; php_admin_value[upload_max_filesize] = 50M
; php_admin_value[post_max_size] = 50M
; php_admin_flag[mail.add_x_header] = Off
; Other common parameters
; php_admin_value[max_execution_time] = 600
; php_admin_value[max_input_time] = 300
; php_admin_value[memory_limit] = 256M
; php_admin_flag[short_open_tag] = On
; Special settings for Horde ; Special settings for Horde
php_value[include_path] = "__FINALPATH__/pear/php:.:__FINALPATH__/horde/lib" php_value[include_path] = "__FINALPATH__/pear/php:.:__FINALPATH__/horde/lib"
env[PHP_PEAR_SYSCONF_DIR] = __FINALPATH__ env[PHP_PEAR_SYSCONF_DIR] = __FINALPATH__

1
doc/DESCRIPTION.md Normal file
View file

@ -0,0 +1 @@
A groupware (webmail, adressbook, calendar) witch use PHP

50
doc/DISCLAIMER.md Normal file
View file

@ -0,0 +1,50 @@
### Customisation
#### Install others app.
The package provide some apps, but it's could be possible to install some others apps. The list of all availabe apps are listed here : https://www.horde.org/apps
Before any change it's recommended to make a backup :
```bash
# In case of multiple instance adapt "horde" by the horde instance
sudo yunohost backup create --verbose --ignore-system --apps horde
```
Install horde apps with pear :
```bash
# Get the horde final_path
# In case of multiple instance adapt "horde" by the horde instance
final_path=$(yunohost app setting horde final_path)
# Set the pear command to call to stay in the horde environnement (not in the global system environnement)
pear_cmd="$final_path/pear/pear -c $final_path/pear.conf"
# Update the pear channel
$pear_cmd channel-update pear.horde.org
# Install the app that you want
$pear_cmd install -a -B horde/APP_TO_INSTALL
# Set the final permission
# In case of multiple instance adapt "horde" by the horde instance
chown -R www-data:horde $final_path
```
After you need to update the horde database schema and the horde config. So go on the horde config pannel (in the settings wheel > Preferences > Administration > Configuration). Click on "Update all DB schemas" and then on "Update all configurations".
Now you should be able to use the new apps.
### ActiveSync
For calendar, task and addressbook activeSync has been configured but not yet tested.
### Troubleshotting
**Get Address is missing domain while to try to send an email.**
- You need to create an identity before send an email.
- To create this go in the settings wheel > Preferences > Global Preferences > Personal Information.
- Complete the form and save it.
- You might be able to sed an email now.

0
doc/screenshots/.gitkeep Normal file
View file

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 KiB

View file

@ -8,41 +8,58 @@
}, },
"version": "5.2.22~ynh4", "version": "5.2.22~ynh4",
"url": "https://www.horde.org/", "url": "https://www.horde.org/",
"upstream": {
"license": "LGPL-2.0",
"website": "https://www.horde.org",
"demo": "http://demo.horde.org",
"admindoc": "https://wiki.horde.org",
"code": "https://github.com/horde"
},
"license": "LGPL-2.0", "license": "LGPL-2.0",
"maintainer": { "maintainer": {
"name": "Josué Tille", "name": "Josué Tille",
"email": "josue@tille.ch" "email": "josue@tille.ch"
}, },
"requirements": { "requirements": {
"yunohost": ">= 3.5.2.2" "yunohost": ">= 4.3.0"
}, },
"multi_instance": true, "multi_instance": true,
"services": [ "services": [
"nginx", "nginx",
"php5-fpm", "php7.3-fpm",
"mysql" "mysql"
], ],
"arguments": { "arguments": {
"install" : [ "install" : [
{ {
"name": "domain", "name": "domain",
"type": "domain", "type": "domain"
"ask": {
"en": "Choose a domain name for Horde",
"fr": "Choisissez un nom de domaine pour Horde"
},
"example": "example.com"
}, },
{ {
"name": "path", "name": "path",
"type": "path", "type": "path",
"ask": {
"en": "Choose a path for Horde",
"fr": "Choisissez un chemin pour Horde"
},
"example": "/horde", "example": "/horde",
"default": "/horde" "default": "/horde"
}, },
{
"name": "is_public",
"type": "boolean",
"default": false
},
{
"name": "language",
"type": "string",
"ask": {
"en": "Choose the application language",
"fr": "Choisissez la langue de l'application"
},
"choices": [
"bg", "de", "en", "es", "fi", "fo", "fr", "hr", "hu",
"id", "is", "it", "lt", "lv", "mg", "mk", "mt", "nl",
"pl", "pt", "ro", "ru", "sk", "so", "th", "tr", "uz"
],
"default": "en"
},
{ {
"name": "admin", "name": "admin",
"type": "user", "type": "user",
@ -52,36 +69,14 @@
}, },
"example": "johndoe" "example": "johndoe"
}, },
{
"name": "is_public",
"type": "boolean",
"ask": {
"en": "Is it a public server?",
"fr": "Est-ce un serveur publique?"
},
"default": false
},
{ {
"name": "service_autodiscovery", "name": "service_autodiscovery",
"type": "boolean", "type": "boolean",
"ask": { "ask": {
"en": "Would you like to enable the caldDav/cardDAV service autodiscovery?", "en": "Would you like to enable the caldDav/cardDAV service autodiscovery?",
"fr": "Voulez-vous activer l'autodécouverte des services calDAV/cardDAV?" "fr": "Voulez-vous activer l'autodécouverte des services calDAV/cardDAV?"
},
"default": false
},
{
"name": "language",
"ask": {
"en": "Choose the application language",
"fr": "Choisissez la langue de l'application"
}, },
"choices": [ "default": false
"bg", "de", "en", "es", "fi", "fo", "fr", "hr", "hu",
"id", "is", "it", "lt", "lv", "mg", "mk", "mt", "nl",
"pl", "pt", "ro", "ru", "sk", "so", "th", "tr", "uz"
],
"default": "en"
}, },
{ {
"name": "whups_install", "name": "whups_install",

View file

@ -4,9 +4,7 @@
# SET ALL CONSTANTS # SET ALL CONSTANTS
#================================================= #=================================================
app=$YNH_APP_INSTANCE_NAME
final_path="/var/www/$app"
gollem_data_dir="/home/yunohost.app/$app"
#================================================= #=================================================
# DEFINE ALL COMMON FONCTIONS # DEFINE ALL COMMON FONCTIONS

View file

@ -3,44 +3,74 @@
#================================================= #=================================================
# GENERIC START # GENERIC START
#================================================= #=================================================
# IMPORT GENERIC HELPERS
#=================================================
# Source YunoHost helpers # Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
# Stop script if errors #=================================================
# MANAGE SCRIPT FAILURE
#=================================================
ynh_clean_setup () {
true
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors ynh_abort_if_errors
# Import common cmd #=================================================
source ../settings/scripts/experimental_helper.sh # LOAD SETTINGS
source ../settings/scripts/_common.sh #=================================================
ynh_print_info --message="Loading installation settings..."
ynh_script_progression --message="Loading installation settings..." app=$YNH_APP_INSTANCE_NAME
final_path=$(ynh_app_setting_get --app $app --key final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
domain=$(ynh_app_setting_get --app $app --key domain) domain=$(ynh_app_setting_get --app=$app --key=domain)
db_name=$(ynh_app_setting_get --app $app --key db_name) db_name=$(ynh_app_setting_get --app=$app --key=db_name)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
gollem_data_dir=$(ynh_app_setting_get --app=$app --key=gollem_data_dir)
#================================================= #=================================================
# 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 # BACKUP THE APP MAIN DIR
ynh_script_progression --message="Backing up code..." --weight=3 #=================================================
ynh_backup --src_path "$final_path"
# Backup user data ynh_backup --src_path="$final_path"
ynh_script_progression --message="Backing up user data..." --weight=10
ynh_backup --src_path "$gollem_data_dir"
#=================================================
# BACKUP THE DATA DIR
#=================================================
ynh_backup --src_path="$gollem_data_dir"
#=================================================
# BACKUP THE NGINX CONFIGURATION # BACKUP THE NGINX CONFIGURATION
ynh_script_progression --message="Backing up configuration..." #=================================================
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 THE PHP-FPM CONFIGURATION # BACKUP THE PHP-FPM CONFIGURATION
ynh_backup --src_path "/etc/php5/fpm/pool.d/$app.conf" #=================================================
ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
#=================================================
# BACKUP THE MYSQL DATABASE # BACKUP THE MYSQL DATABASE
ynh_script_progression --message="Backing up database" #=================================================
ynh_mysql_dump_db "$db_name" > db.sql ynh_print_info --message="Backing up the MySQL database..."
ynh_script_progression --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." --last ynh_mysql_dump_db --database="$db_name" > db.sql
#=================================================
# END OF SCRIPT
#=================================================
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."

View file

@ -1,62 +1,114 @@
#!/bin/bash #!/bin/bash
#================================================= #=================================================
# GENERIC START # GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#================================================= #=================================================
# IMPORT GENERIC HELPERS source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
# Exit if an error occurs during the execution of the script #=================================================
ynh_abort_if_errors
# Import common cmd
source ./experimental_helper.sh
source ./_common.sh
ynh_script_progression --message="Loading installation settings..."
# RETRIEVE ARGUMENTS # RETRIEVE ARGUMENTS
#=================================================
old_domain=$YNH_APP_OLD_DOMAIN old_domain=$YNH_APP_OLD_DOMAIN
domain=$YNH_APP_NEW_DOMAIN domain=$YNH_APP_NEW_DOMAIN
path_url=$(ynh_normalize_url_path --path_url ${YNH_APP_NEW_PATH:-'/'}) path_url=$(ynh_normalize_url_path --path_url ${YNH_APP_NEW_PATH:-'/'})
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
admin=$(ynh_app_setting_get --app $app --key admin) #=================================================
final_path=$(ynh_app_setting_get --app $app --key final_path) # LOAD SETTINGS
port=$(ynh_app_setting_get --app $app --key port) #=================================================
secret_key=$(ynh_app_setting_get --app $app --key secret_key) ynh_script_progression --message="Loading installation settings..."
service_autodiscovery=$(ynh_app_setting_get --app $app --key service_autodiscovery)
db_name=$(ynh_app_setting_get --app $app --key db_name) # Needed for helper "ynh_add_nginx_config"
db_user=$(ynh_app_setting_get --app $app --key db_user) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
db_pwd=$(ynh_app_setting_get --app $app --key mysqlpwd) admin=$(ynh_app_setting_get --app=$app --key=admin)
port=$(ynh_app_setting_get --app=$app --key=port)
secret_key=$(ynh_app_setting_get --app=$app --key=secret_key)
service_autodiscovery=$(ynh_app_setting_get --app=$app --key=service_autodiscovery)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$(ynh_app_setting_get --app=$app --key=db_user)
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
#=================================================
# 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
change_domain=1
fi
change_path=0
if [ "$old_path" != "$new_path" ]
then
change_path=1
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
if [ "$old_domain" != "$domain" ] if [ "$old_domain" != "$domain" ]
then then
# Delete file checksum for the old conf file location # Delete file checksum for the old conf file location
ynh_delete_file_checksum --file "$nginx_conf_path" ynh_delete_file_checksum --file="$nginx_conf_path"
mv $nginx_conf_path /etc/nginx/conf.d/$domain.d/$app.conf mv $nginx_conf_path /etc/nginx/conf.d/$domain.d/$app.conf
# Store file checksum for the new config file location # Store file checksum for the new config file location
ynh_store_file_checksum --file "/etc/nginx/conf.d/$domain.d/$app.conf" ynh_store_file_checksum --file="/etc/nginx/conf.d/$domain.d/$app.conf"
fi fi
#=================================================
# SPECIFIC MODIFICATIONS
#=================================================
# ...
#=================================================
config_nginx config_nginx
# Update horde config # Update horde config
ynh_script_progression --message="Configuring application..." --weight=3 ynh_script_progression --message="Configuring application..." --weight=3
config_horde config_horde
#=================================================
# GENERIC FINALISATION
#=================================================
# RELOAD NGINX # RELOAD NGINX
systemctl reload nginx #=================================================
ynh_script_progression --message="Reloading NGINX web server..."
ynh_script_progression --message="Change of URL completed for $app" --last ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Change of URL completed for $app"

View file

@ -3,51 +3,64 @@
#================================================= #=================================================
# GENERIC START # GENERIC START
#================================================= #=================================================
# IMPORT GENERIC HELPERS # IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
ynh_clean_setup () {
ynh_clean_check_starting
}
# 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
# Import common cmd #=================================================
source ./experimental_helper.sh
source ./_common.sh
ynh_script_progression --message="Validating installation parameters..."
# RETRIEVE ARGUMENTS FROM THE MANIFEST # RETRIEVE ARGUMENTS FROM THE MANIFEST
#=================================================
domain=$YNH_APP_ARG_DOMAIN domain=$YNH_APP_ARG_DOMAIN
path_url=$(ynh_normalize_url_path --path_url $YNH_APP_ARG_PATH) path_url=$(ynh_normalize_url_path --path_url $YNH_APP_ARG_PATH)
admin=$YNH_APP_ARG_ADMIN
is_public=$YNH_APP_ARG_IS_PUBLIC is_public=$YNH_APP_ARG_IS_PUBLIC
service_autodiscovery=$YNH_APP_ARG_SERVICE_AUTODISCOVERY
language=$YNH_APP_ARG_LANGUAGE language=$YNH_APP_ARG_LANGUAGE
admin=$YNH_APP_ARG_ADMIN
service_autodiscovery=$YNH_APP_ARG_SERVICE_AUTODISCOVERY
whups_install=$YNH_APP_ARG_WHUPS_INSTALL whups_install=$YNH_APP_ARG_WHUPS_INSTALL
sesha_install=$YNH_APP_ARG_SESHA_INSTALL sesha_install=$YNH_APP_ARG_SESHA_INSTALL
ansel_install=$YNH_APP_ARG_ANSEL_INSTALL ansel_install=$YNH_APP_ARG_ANSEL_INSTALL
wicked_install=$YNH_APP_ARG_WICKED_INSTALL wicked_install=$YNH_APP_ARG_WICKED_INSTALL
# Set variable app=$YNH_APP_INSTANCE_NAME
final_path="/var/www/$app"
# STORE SETTINGS FROM MANIFEST #=================================================
ynh_script_progression --message="Storing installation settings..." # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
ynh_app_setting_set --app $app --key admin --value $admin #=================================================
ynh_app_setting_set --app $app --key language --value $language ynh_script_progression --message="Validating installation parameters..."
ynh_app_setting_set --app $app --key final_path --value $final_path
ynh_app_setting_set --app $app --key is_public --value $is_public final_path=/var/www/$app
ynh_app_setting_set --app $app --key service_autodiscovery --value $service_autodiscovery test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
ynh_app_setting_set --app $app --key whups_install --value $whups_install
ynh_app_setting_set --app $app --key sesha_install --value $sesha_install
ynh_app_setting_set --app $app --key ansel_install --value $ansel_install
ynh_app_setting_set --app $app --key wicked_install --value $wicked_install
# 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
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #=================================================
test ! -e "$final_path" || ynh_die --message "This path already contains a folder" # STORE SETTINGS FROM MANIFEST
#=================================================
ynh_script_progression --message="Storing installation settings..."
ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set --app=$app --key=path --value=$path_url
ynh_app_setting_set --app=$app --key=language --value=$language
ynh_app_setting_set --app=$app --key=admin --value=$admin
ynh_app_setting_set --app=$app --key=service_autodiscovery --value=$service_autodiscovery
ynh_app_setting_set --app=$app --key=whups_install --value=$whups_install
ynh_app_setting_set --app=$app --key=sesha_install --value=$sesha_install
ynh_app_setting_set --app=$app --key=ansel_install --value=$ansel_install
ynh_app_setting_set --app=$app --key=wicked_install --value=$wicked_install
# Set list of optionnal app to install # Set list of optionnal app to install
optionnal_apps_list="" optionnal_apps_list=""
@ -85,32 +98,85 @@ then
locale-gen locale-gen
fi fi
#=================================================
# INSTALL DEPENDENCIES # INSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Installing dependencies..." --weight=7 ynh_script_progression --message="Installing dependencies..." --weight=7
install_dependance install_dependance
# CREATE A MYSQL DATABASE #=================================================
ynh_script_progression --message="Configuring MySQL database..." # CREATE DEDICATED USER
db_name=$(ynh_sanitize_dbid --db_name $app) #=================================================
db_user=$db_name ynh_script_progression --message="Configuring system user..."
ynh_app_setting_set --app $app --key db_name --value $db_name
ynh_app_setting_set --app $app --key db_user --value $db_user
ynh_mysql_setup_db --db_name $db_name --db_user $db_user
# Create a system user # Create a system user
ynh_script_progression --message="Configuring system user..." ynh_system_user_create --username=$app --home_dir="$final_path"
ynh_system_user_create --username $app
#=================================================
# CREATE A MYSQL DATABASE
#=================================================
ynh_script_progression --message="Creating a MySQL database..."
db_name=$(ynh_sanitize_dbid --db_name=$app)
db_user=$db_name
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
ynh_app_setting_set --app=$app --key=db_user --value=$db_user
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Setting up source files..."
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
# Download, check integrity, uncompress and patch the source from app.src
mkdir $final_path
mkdir $final_path/data
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring NGINX web server..."
# Create a dedicated NGINX config
config_nginx
#=================================================
# PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring PHP-FPM..."
# Create a dedicated PHP-FPM config
ynh_add_fpm_config
#=================================================
# SPECIFIC SETUP
#=================================================
# CREATE DATA DIRECTORY
#=================================================
ynh_script_progression --message="Creating a data directory..."
gollem_data_dir=/home/yunohost.app/$app
ynh_app_setting_set --app=$app --key=gollem_data_dir --value=$gollem_data_dir
mkdir -p $gollem_data_dir
chmod 750 "$gollem_data_dir"
chmod -R o-rwx "$gollem_data_dir"
chown -R $app:www-data "$gollem_data_dir"
#=================================================
# ...
#=================================================
# Set execution for expect scripts # Set execution for expect scripts
chmod +x ../conf/init_horde_install.exp chmod +x ../conf/init_horde_install.exp
chmod +x ../conf/config_horde.exp chmod +x ../conf/config_horde.exp
# Install horde by pear
ynh_script_progression --message="Creating base directory..."
mkdir $final_path
mkdir $final_path/data
mkdir -p $gollem_data_dir
ynh_script_progression --message="Installing sources files..." --weight=7 ynh_script_progression --message="Installing sources files..." --weight=7
pear config-create "$final_path" "$final_path/pear.conf" pear config-create "$final_path" "$final_path/pear.conf"
@ -131,7 +197,7 @@ $pear_cmd install -a -B horde/webmail $optionnal_apps_list
PHP_PEAR_SYSCONF_DIR=$final_path ../conf/config_horde.exp "$final_path" "$db_name" "$db_user" "$db_pwd" "$admin" PHP_PEAR_SYSCONF_DIR=$final_path ../conf/config_horde.exp "$final_path" "$db_name" "$db_user" "$db_pwd" "$admin"
secret_key=$(grep 'secret_key' "$final_path/horde/config/conf.php" | cut -d"'" -f4) secret_key=$(grep 'secret_key' "$final_path/horde/config/conf.php" | cut -d"'" -f4)
ynh_app_setting_set --app $app --key secret_key --value "$secret_key" ynh_app_setting_set --app=$app --key=secret_key --value="$secret_key"
# Patch the app # Patch the app
ynh_script_progression --message="Patching application..." --weight=7 ynh_script_progression --message="Patching application..." --weight=7
@ -141,34 +207,42 @@ patch_app
ynh_script_progression --message="Configuring application..." --weight=3 ynh_script_progression --message="Configuring application..." --weight=3
config_horde config_horde
# Create a dedicated nginx config
ynh_script_progression --message="Configuring nginx..." --weight=1
config_nginx
# Create a dedicated php-fpm config
ynh_add_fpm_config
#=================================================
# GENERIC FINALIZATION
#=================================================
# SECURE FILES AND DIRECTORIES # SECURE FILES AND DIRECTORIES
ynh_script_progression --message="Protecting directory..." ynh_script_progression --message="Protecting directory..."
set_permission set_permission
# configure the sso #=================================================
ynh_script_progression --message="Configuring permissions..." # GENERIC FINALIZATION
if [ "$is_public" = "0" ]; #=================================================
then # Retire l'accès public
ynh_app_setting_delete --app $app --key skipped_uris
else
ynh_app_setting_set --app $app --key unprotected_uris --value "/"
fi
# SETUP LOGROTATE # SETUP LOGROTATE
#=================================================
ynh_script_progression --message="Configuring log rotation..." ynh_script_progression --message="Configuring log rotation..."
ynh_use_logrotate $final_path/horde --nonappend --specific_user www-data/horde ynh_use_logrotate $final_path/horde --nonappend --specific_user www-data/horde
ynh_use_logrotate $final_path/horde/services --append --specific_user www-data/horde ynh_use_logrotate $final_path/horde/services --append --specific_user www-data/horde
ynh_use_logrotate $final_path/horde/services/portal --append --specific_user www-data/horde ynh_use_logrotate $final_path/horde/services/portal --append --specific_user www-data/horde
ynh_script_progression --message="Installation of $app completed" --last #=================================================
# SETUP SSOWAT
#=================================================
ynh_script_progression --message="Configuring permissions..."
if [ "$is_public" = "0" ];
then # Retire l'accès public
ynh_app_setting_delete --app=$app --key=skipped_uris
else
ynh_app_setting_set --app=$app --key=unprotected_uris --value="/"
fi
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..."
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Installation of $app completed"

View file

@ -3,56 +3,96 @@
#================================================= #=================================================
# GENERIC START # GENERIC START
#================================================= #=================================================
# IMPORT GENERIC HELPERS
#=================================================
# Source YunoHost helpers source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
# Import common cmd #=================================================
source ./experimental_helper.sh # LOAD SETTINGS
source ./_common.sh #=================================================
ynh_script_progression --message="Loading installation settings..." ynh_script_progression --message="Loading installation settings..."
# Retrieve app settings
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app $app --key domain)
port=$(ynh_app_setting_get --app $app --key port) domain=$(ynh_app_setting_get --app=$app --key=domain)
db_name=$(ynh_app_setting_get --app $app --key db_name) port=$(ynh_app_setting_get --app=$app --key=port)
db_user=$(ynh_app_setting_get --app $app --key db_user) db_name=$(ynh_app_setting_get --app=$app --key=db_name)
final_path=$(ynh_app_setting_get --app $app --key final_path) db_user=$(ynh_app_setting_get --app=$app --key=db_user)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#================================================= #=================================================
# STANDARD REMOVE # STANDARD REMOVE
#================================================= #=================================================
# REMOVE LOGROTATE CONFIGURATION
# Remove metapackage and its dependencies #=================================================
ynh_script_progression --message="Removing dependencies" --weight=10 ynh_script_progression --message="Removing logrotate configuration..."
ynh_remove_app_dependencies
# Remove a database if it exists, along with the associated user
ynh_script_progression --message="Removing databases..."
ynh_mysql_remove_db --db_user $db_user --db_name $db_name
# Remove the app directory securely
ynh_script_progression --message="Removing code..."
ynh_secure_remove --file="$final_path"
# Remove user data
ynh_script_progression --message="Removing user data..."
ynh_secure_remove --file="$gollem_data_dir"
# Remove the dedicated nginx config
ynh_script_progression --message="Removing nginx configuration..."
ynh_remove_nginx_config
# Remove the dedicated php-fpm config
ynh_remove_fpm_config
# Delete a system user
ynh_script_progression --message="Removing the dedicated system user..."
ynh_system_user_delete --username $app
# Remove the app-specific logrotate config # Remove the app-specific logrotate config
ynh_remove_logrotate ynh_remove_logrotate
ynh_script_progression --message="Removal of $app completed" --last #=================================================
# REMOVE THE MYSQL DATABASE
#=================================================
ynh_script_progression --message="Removing the MySQL database..."
# Remove a database if it exists, along with the associated user
ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name
#=================================================
# REMOVE APP MAIN DIR
#=================================================
ynh_script_progression --message="Removing app main directory..."
# Remove the app directory securely
ynh_secure_remove --file="$final_path"
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Removing NGINX web server configuration..."
# Remove the dedicated NGINX config
ynh_remove_nginx_config
#=================================================
# REMOVE PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Removing PHP-FPM configuration..."
# Remove the dedicated PHP-FPM config
ynh_remove_fpm_config
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_script_progression --message="Removing dependencies..."
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
#=================================================
# SPECIFIC REMOVE
#=================================================
# REMOVE VARIOUS FILES
#=================================================
ynh_script_progression --message="Removing various files..."
ynh_secure_remove --file="$gollem_data_dir"
#=================================================
# GENERIC FINALIZATION
#=================================================
# REMOVE DEDICATED USER
#=================================================
ynh_script_progression --message="Removing the dedicated system user..."
# Delete a system user
ynh_system_user_delete --username=$app
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Removal of $app completed"

View file

@ -3,67 +3,134 @@
#================================================= #=================================================
# GENERIC START # GENERIC START
#================================================= #=================================================
# IMPORT GENERIC HELPERS
#=================================================
# Source YunoHost helpers # Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
# Stop script if errors #=================================================
# MANAGE SCRIPT FAILURE
#=================================================
ynh_clean_setup () {
ynh_clean_check_starting
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors ynh_abort_if_errors
# Import common cmd #=================================================
source ../settings/scripts/experimental_helper.sh # LOAD SETTINGS
source ../settings/scripts/_common.sh #=================================================
ynh_script_progression --message="Loading installation settings..."
ynh_script_progression --message="Loading settings..." app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app $app --key domain) domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app $app --key path) path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get --app $app --key final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_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=$(ynh_app_setting_get --app=$app --key=db_user)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
gollem_data_dir=$(ynh_app_setting_get --app=$app --key=gollem_data_dir)
#=================================================
# CHECK IF THE APP CAN BE RESTORED # CHECK IF THE APP CAN BE RESTORED
ynh_webpath_available --domain $domain --path_url $path_url \ #=================================================
|| ynh_die --message "Path not available: ${domain}${path_url}" ynh_script_progression --message="Validating restoration parameters..."
test ! -d $final_path \ test ! -d $final_path \
|| ynh_die --message "There is already a directory: $final_path " || ynh_die --message="There is already a directory: $final_path "
#================================================= #=================================================
# STANDARD RESTORATION STEPS # STANDARD RESTORATION STEPS
#================================================= #=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the NGINX web server configuration..."
# Define and install dependencies ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_script_progression --message="Reinstalling dependencies..." --weight=5
install_dependance #=================================================
# RECREATE THE DEDICATED USER
#=================================================
ynh_script_progression --message="Recreating the dedicated system user..."
# Create the dedicated user (if not existing) # Create the dedicated user (if not existing)
ynh_system_user_create --username $app ynh_system_user_create --username=$app --home_dir="$final_path"
# Restore all config and data #=================================================
ynh_script_progression --message="Restoring files..." --weight=10 # RESTORE THE APP MAIN DIR
ynh_restore #=================================================
ynh_script_progression --message="Restoring the app main directory..."
ynh_restore_file --origin_path="$final_path"
#=================================================
# RESTORE THE DATA DIRECTORY
#=================================================
ynh_script_progression --message="Restoring the data directory..."
ynh_restore_file --origin_path="$gollem_data_dir"
mkdir -p $datadir
#=================================================
# RESTORE THE PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the PHP-FPM configuration..."
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
#=================================================
# SPECIFIC RESTORATION
#=================================================
# REINSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Reinstalling dependencies..." --weight=5
install_dependance
#=================================================
# RESTORE THE MYSQL DATABASE # RESTORE THE MYSQL DATABASE
ynh_script_progression --message="Restoring database..." --weight=3 #=================================================
db_pwd=$(ynh_app_setting_get --app $app --key mysqlpwd) ynh_script_progression --message="Restoring the MySQL database..."
ynh_mysql_setup_db --db_user $db_name --db_name $db_name --db_pwd $db_pwd
ynh_mysql_connect_as --user $db_name --password $db_pwd --database $db_name < ./db.sql db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
#================================================= #=================================================
# GENERIC FINALIZATION # RESTORE VARIOUS FILES
#================================================= #=================================================
ynh_script_progression --message="Restoring various files..."
# SECURE FILES AND DIRECTORIES
ynh_script_progression --message="Protecting directory..."
set_permission set_permission
# SETUP LOGROTATE #=================================================
ynh_script_progression --message="Configuring log rotation..." # RESTORE THE LOGROTATE CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the logrotate configuration..."
ynh_use_logrotate $final_path/horde --nonappend --specific_user www-data/horde ynh_use_logrotate $final_path/horde --nonappend --specific_user www-data/horde
ynh_use_logrotate $final_path/horde/services --append --specific_user www-data/horde ynh_use_logrotate $final_path/horde/services --append --specific_user www-data/horde
ynh_use_logrotate $final_path/horde/services/portal --append --specific_user www-data/horde ynh_use_logrotate $final_path/horde/services/portal --append --specific_user www-data/horde
# Reload services #=================================================
systemctl reload php5-fpm # GENERIC FINALIZATION
systemctl reload nginx #=================================================
# RELOAD NGINX AND PHP-FPM
#=================================================
ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..."
ynh_script_progression --message="Restoration completed for $app" --last ynh_systemd_action --service_name=php$phpversion-fpm --action=reload
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Restoration completed for $app"

View file

@ -3,36 +3,47 @@
#================================================= #=================================================
# GENERIC START # GENERIC START
#================================================= #=================================================
# IMPORT GENERIC HELPERS # IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
# Exit if an error occurs during the execution of the script #=================================================
ynh_abort_if_errors # LOAD SETTINGS
#=================================================
# Import common cmd
source ./experimental_helper.sh
source ./_common.sh
ynh_script_progression --message="Loading installation settings..." ynh_script_progression --message="Loading installation settings..."
# LOAD SETTINGS app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app $app --key domain)
path_url=$(ynh_normalize_url_path --path_url $(ynh_app_setting_get --app $app --key path)) domain=$(ynh_app_setting_get --app=$app --key=domain)
admin=$(ynh_app_setting_get --app $app --key admin) path_url=$(ynh_app_setting_get --app=$app --key=path)
service_autodiscovery=$(ynh_app_setting_get --app $app --key service_autodiscovery) admin=$(ynh_app_setting_get --app=$app --key=admin)
final_path=$(ynh_app_setting_get --app $app --key final_path) service_autodiscovery=$(ynh_app_setting_get --app=$app --key=service_autodiscovery)
port=$(ynh_app_setting_get --app $app --key port) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
secret_key=$(ynh_app_setting_get --app $app --key secret_key) port=$(ynh_app_setting_get --app=$app --key=port)
db_name=$(ynh_app_setting_get --app $app --key db_name) secret_key=$(ynh_app_setting_get --app=$app --key=secret_key)
db_user=$(ynh_app_setting_get --app $app --key db_user) db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_pwd=$(ynh_app_setting_get --app $app --key mysqlpwd) db_user=$(ynh_app_setting_get --app=$app --key=db_user)
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
#=================================================
# CHECK VERSION
#=================================================
ynh_script_progression --message="Checking version..."
upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..."
# 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
# Restore it if the upgrade fails
ynh_restore_upgradebackup 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
@ -41,11 +52,53 @@ ynh_abort_if_errors
#================================================= #=================================================
# STANDARD UPGRADE STEPS # STANDARD UPGRADE STEPS
#================================================= #=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..."
# INSTALL DEPENDENCIES # Cleaning legacy permissions
if ynh_legacy_permissions_exists; then
ynh_legacy_permissions_delete_all
ynh_app_setting_delete --app=$app --key=is_public
fi
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Making sure dedicated system user exists..."
# Create a dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Upgrading NGINX web server configuration..."
# Create a dedicated NGINX config
config_nginx
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
ynh_script_progression --message="Upgrading dependencies..." ynh_script_progression --message="Upgrading dependencies..."
install_dependance install_dependance
#=================================================
# PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Upgrading PHP-FPM configuration..."
# Create a dedicated PHP-FPM config
ynh_add_fpm_config
#=================================================
# SPECIFIC UPGRADE
#=================================================
# ...
#=================================================
# Upgrade Horde by PEAR # Upgrade Horde by PEAR
ynh_script_progression --message="Upgrading source files..." --weight=6 ynh_script_progression --message="Upgrading source files..." --weight=6
pear_cmd="$final_path/pear/pear -c $final_path/pear.conf" pear_cmd="$final_path/pear/pear -c $final_path/pear.conf"
@ -60,23 +113,30 @@ patch_app
ynh_script_progression --message="Configuring application..." --weight=3 ynh_script_progression --message="Configuring application..." --weight=3
config_horde config_horde
# NGINX CONFIGURATION
# Create a dedicated nginx config
ynh_script_progression --message="Configuring nginx..." --weight=1
config_nginx
#=================================================
# GENERIC FINALIZATION
#=================================================
# SECURE FILES AND DIRECTORIES # SECURE FILES AND DIRECTORIES
ynh_script_progression --message="Protecting directory..." ynh_script_progression --message="Protecting directory..."
set_permission set_permission
#=================================================
# GENERIC FINALIZATION
#=================================================
# SETUP LOGROTATE # SETUP LOGROTATE
ynh_script_progression --message="Configuring log rotation..." #=================================================
ynh_script_progression --message="Upgrading logrotate configuration..."
ynh_use_logrotate $final_path/horde --nonappend --specific_user www-data/horde ynh_use_logrotate $final_path/horde --nonappend --specific_user www-data/horde
ynh_use_logrotate $final_path/horde/services --append --specific_user www-data/horde ynh_use_logrotate $final_path/horde/services --append --specific_user www-data/horde
ynh_use_logrotate $final_path/horde/services/portal --append --specific_user www-data/horde ynh_use_logrotate $final_path/horde/services/portal --append --specific_user www-data/horde
ynh_script_progression --message="Upgrade of $app completed" --last #=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..."
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Upgrade of $app completed"