mirror of
https://github.com/YunoHost-Apps/nextcloud_ynh.git
synced 2024-09-03 19:55:57 +02:00
Merge pull request #163 from YunoHost-Apps/package_upgrade
Package upgrade
This commit is contained in:
commit
b3417bcccd
13 changed files with 371 additions and 205 deletions
56
README.md
56
README.md
|
@ -1,5 +1,12 @@
|
||||||
Nextcloud for YunoHost
|
# Nextcloud for YunoHost
|
||||||
---------------------
|
|
||||||
|
[](https://dash.yunohost.org/appci/app/nextcloud)
|
||||||
|
[](https://install-app.yunohost.org/?app=nextcloud)
|
||||||
|
|
||||||
|
> *This package allow you to install Nextcloud quickly and simply on a YunoHost server.
|
||||||
|
If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to know how to install and enjoy it.*
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
|
||||||
[Nextcloud](https://nextcloud.com) gives you freedom and control over your
|
[Nextcloud](https://nextcloud.com) gives you freedom and control over your
|
||||||
own data. A personal cloud which run on your own server. With Nextcloud
|
own data. A personal cloud which run on your own server. With Nextcloud
|
||||||
|
@ -7,10 +14,23 @@ you can synchronize your files over your devices.
|
||||||
|
|
||||||
**Shipped version:** 15.0.5
|
**Shipped version:** 15.0.5
|
||||||
|
|
||||||
[](https://install-app.yunohost.org/?app=nextcloud)
|
## Screenshots
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
## Features
|
## Demo
|
||||||
|
|
||||||
|
* [YunoHost demo](https://demo.yunohost.org/nextcloud/)
|
||||||
|
* [Official demo](https://demo.nextcloud.com/)
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
## Documentation
|
||||||
|
|
||||||
|
* Official documentation: https://docs.nextcloud.com/server/15/user_manual/
|
||||||
|
* YunoHost documentation: https://github.com/YunoHost/doc/blob/master/app_nextcloud_fr.md
|
||||||
|
|
||||||
|
## YunoHost specific features
|
||||||
|
|
||||||
In addition to Nextcloud core features, the following are made available with
|
In addition to Nextcloud core features, the following are made available with
|
||||||
this package:
|
this package:
|
||||||
|
@ -23,6 +43,14 @@ this package:
|
||||||
* Serve `/.well-known` paths for CalDAV and CardDAV on the domain only if it's
|
* Serve `/.well-known` paths for CalDAV and CardDAV on the domain only if it's
|
||||||
not already served - i.e. by Baïkal
|
not already served - i.e. by Baïkal
|
||||||
|
|
||||||
|
#### Multi-users support
|
||||||
|
|
||||||
|
#### Supported architectures
|
||||||
|
|
||||||
|
* x86-64b - [](https://ci-apps.yunohost.org/ci/apps/nextcloud/)
|
||||||
|
* ARMv8-A - [](https://ci-apps-arm.yunohost.org/ci/apps/nextcloud/)
|
||||||
|
* Jessie x86-64b - [](https://ci-stretch.nohost.me/ci/apps/nextcloud/)
|
||||||
|
|
||||||
## Limitations
|
## Limitations
|
||||||
|
|
||||||
To integrate the logout button to the SSO, we have to patch Nextcloud sources.
|
To integrate the logout button to the SSO, we have to patch Nextcloud sources.
|
||||||
|
@ -38,7 +66,9 @@ Finally, the following error message in Nextcloud logs can be safely ignored:
|
||||||
Following symlinks is not allowed ('/home/yunohost.multimedia/user/Share' -> '/home/yunohost.multimedia/share/' not inside '/home/yunohost.multimedia/user/')
|
Following symlinks is not allowed ('/home/yunohost.multimedia/user/Share' -> '/home/yunohost.multimedia/share/' not inside '/home/yunohost.multimedia/user/')
|
||||||
```
|
```
|
||||||
|
|
||||||
## Migrate from ownCloud
|
## Additionnal informations
|
||||||
|
|
||||||
|
#### Migrate from ownCloud
|
||||||
|
|
||||||
**This is not considered as stable yet, please do it with care and only for
|
**This is not considered as stable yet, please do it with care and only for
|
||||||
testing!**
|
testing!**
|
||||||
|
@ -72,6 +102,20 @@ sudo yunohost app ssowatconf
|
||||||
|
|
||||||
## Links
|
## Links
|
||||||
|
|
||||||
* Report a bug: https://dev.yunohost.org/projects/apps/issues
|
* Report a bug: https://github.com/YunoHost-Apps/nextcloud_ynh/issues
|
||||||
* Nextcloud website: https://nextcloud.com/
|
* Nextcloud website: https://nextcloud.com/
|
||||||
* YunoHost website: https://yunohost.org/
|
* YunoHost website: https://yunohost.org/
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Developers infos
|
||||||
|
----------------
|
||||||
|
|
||||||
|
Please do your pull request to the [testing branch](https://github.com/YunoHost-Apps/nextcloud_ynh/tree/testing).
|
||||||
|
|
||||||
|
To try the testing branch, please proceed like that.
|
||||||
|
```
|
||||||
|
sudo yunohost app install https://github.com/YunoHost-Apps/nextcloud_ynh/tree/testing --debug
|
||||||
|
or
|
||||||
|
sudo yunohost app upgrade nextcloud -u https://github.com/YunoHost-Apps/nextcloud_ynh/tree/testing --debug
|
||||||
|
```
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
{
|
{
|
||||||
"system": {
|
"system": {
|
||||||
"datadirectory": "#DATADIR#",
|
"datadirectory": "__DATADIR__",
|
||||||
"trusted_domains": [
|
"trusted_domains": [
|
||||||
"localhost",
|
"localhost",
|
||||||
"#DOMAIN#"
|
"__DOMAIN__"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
*/15 * * * * #USER# /usr/bin/php -f #DESTDIR#/cron.php
|
*/15 * * * * __USER__ /usr/bin/php -f __DESTDIR__/cron.php
|
||||||
|
|
|
@ -6,8 +6,11 @@ location = /.well-known/caldav {
|
||||||
}
|
}
|
||||||
|
|
||||||
location ^~ __PATH__ {
|
location ^~ __PATH__ {
|
||||||
|
|
||||||
|
# Path to source
|
||||||
alias __FINALPATH__/;
|
alias __FINALPATH__/;
|
||||||
|
|
||||||
|
# Force usage of https
|
||||||
if ($scheme = http) {
|
if ($scheme = http) {
|
||||||
rewrite ^ https://$server_name$request_uri? permanent;
|
rewrite ^ https://$server_name$request_uri? permanent;
|
||||||
}
|
}
|
||||||
|
@ -67,7 +70,7 @@ location ^~ __PATH__ {
|
||||||
fastcgi_param HTTPS on;
|
fastcgi_param HTTPS on;
|
||||||
fastcgi_param modHeadersAvailable true;
|
fastcgi_param modHeadersAvailable true;
|
||||||
fastcgi_param REMOTE_USER $remote_user;
|
fastcgi_param REMOTE_USER $remote_user;
|
||||||
fastcgi_pass unix:/var/run/php5-fpm-__NAME__.sock;
|
fastcgi_pass unix:/var/run/php/php7.0-fpm-__NAME__.sock;
|
||||||
fastcgi_intercept_errors on;
|
fastcgi_intercept_errors on;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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,28 +25,35 @@ 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/php7.0-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
|
||||||
; BSD-derived systems allow connections regardless of permissions.
|
; BSD-derived systems allow connections regardless of permissions.
|
||||||
; Default Values: user and group are set as the running user
|
; Default Values: user and group are set as the running user
|
||||||
; mode is set to 0660
|
; mode is set to 0660
|
||||||
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
|
||||||
; List of ipv4 addresses of FastCGI clients which are allowed to connect.
|
; 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 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:
|
||||||
|
@ -117,12 +131,12 @@ pm.max_spare_servers = 3
|
||||||
; Note: Used only when pm is set to 'ondemand'
|
; Note: Used only when pm is set to 'ondemand'
|
||||||
; Default Value: 10s
|
; Default Value: 10s
|
||||||
;pm.process_idle_timeout = 10s;
|
;pm.process_idle_timeout = 10s;
|
||||||
|
|
||||||
; The number of requests each child process should execute before respawning.
|
; The number of requests each child process should execute before respawning.
|
||||||
; This can be useful to work around memory leaks in 3rd party libraries. For
|
; This can be useful to work around memory leaks in 3rd party libraries. For
|
||||||
; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS.
|
; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS.
|
||||||
; Default Value: 0
|
; Default Value: 0
|
||||||
pm.max_requests = 500
|
;pm.max_requests = 500
|
||||||
|
|
||||||
; The URI to view the FPM status page. If this value is not set, no URI will be
|
; The URI to view the FPM status page. If this value is not set, no URI will be
|
||||||
; recognized as a status page. It shows the following informations:
|
; recognized as a status page. It shows the following informations:
|
||||||
|
@ -170,7 +184,7 @@ pm.max_requests = 500
|
||||||
;
|
;
|
||||||
; By default the status page only outputs short status. Passing 'full' in the
|
; By default the status page only outputs short status. Passing 'full' in the
|
||||||
; query string will also return status for each pool process.
|
; query string will also return status for each pool process.
|
||||||
; Example:
|
; Example:
|
||||||
; http://www.foo.bar/status?full
|
; http://www.foo.bar/status?full
|
||||||
; http://www.foo.bar/status?json&full
|
; http://www.foo.bar/status?json&full
|
||||||
; http://www.foo.bar/status?html&full
|
; http://www.foo.bar/status?html&full
|
||||||
|
@ -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
|
||||||
|
@ -283,7 +297,7 @@ pm.max_requests = 500
|
||||||
; - ....
|
; - ....
|
||||||
; %p: PID of the child that serviced the request
|
; %p: PID of the child that serviced the request
|
||||||
; %P: PID of the parent of the child that serviced the request
|
; %P: PID of the parent of the child that serviced the request
|
||||||
; %q: the query string
|
; %q: the query string
|
||||||
; %Q: the '?' character if query string exists
|
; %Q: the '?' character if query string exists
|
||||||
; %r: the request URI (without the query string, see %q and %Q)
|
; %r: the request URI (without the query string, see %q and %Q)
|
||||||
; %R: remote IP address
|
; %R: remote IP address
|
||||||
|
@ -291,47 +305,51 @@ 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"
|
||||||
;access.format = "%R - %u %t \"%m %r%Q%q\" %s %f %{mili}d %{kilo}M %C%%"
|
;access.format = "%R - %u %t \"%m %r%Q%q\" %s %f %{mili}d %{kilo}M %C%%"
|
||||||
|
|
||||||
; The log file for slow requests
|
; The log file for slow requests
|
||||||
; Default Value: not set
|
; Default Value: not set
|
||||||
; Note: slowlog is mandatory if request_slowlog_timeout is set
|
; Note: slowlog is mandatory if request_slowlog_timeout is set
|
||||||
slowlog = /var/log/nginx/__NAMETOCHANGE__.slow.log
|
;slowlog = log/$pool.log.slow
|
||||||
|
|
||||||
; The timeout for serving a single request after which a PHP backtrace will be
|
; The timeout for serving a single request after which a PHP backtrace will be
|
||||||
; dumped to the 'slowlog' file. A value of '0s' means 'off'.
|
; dumped to the 'slowlog' file. A value of '0s' means 'off'.
|
||||||
; Available units: s(econds)(default), m(inutes), h(ours), or d(ays)
|
; Available units: s(econds)(default), m(inutes), h(ours), or d(ays)
|
||||||
; Default Value: 0
|
; Default Value: 0
|
||||||
request_slowlog_timeout = 5s
|
;request_slowlog_timeout = 0
|
||||||
|
|
||||||
; The timeout for serving a single request after which the worker process will
|
; The timeout for serving a single request after which the worker process will
|
||||||
; be killed. This option should be used when the 'max_execution_time' ini option
|
; be killed. This option should be used when the 'max_execution_time' ini option
|
||||||
; does not stop script execution for some reason. A value of '0' means 'off'.
|
; does not stop script execution for some reason. A value of '0' means 'off'.
|
||||||
; Available units: s(econds)(default), m(inutes), h(ours), or d(ays)
|
; Available units: s(econds)(default), m(inutes), h(ours), or d(ays)
|
||||||
; Default Value: 0
|
; Default Value: 0
|
||||||
request_terminate_timeout = 1d
|
request_terminate_timeout = 1d
|
||||||
|
|
||||||
; Set open file descriptor rlimit.
|
; Set open file descriptor rlimit.
|
||||||
; Default Value: system defined value
|
; Default Value: system defined value
|
||||||
;rlimit_files = 1024
|
;rlimit_files = 1024
|
||||||
|
|
||||||
; Set max core size rlimit.
|
; Set max core size rlimit.
|
||||||
; Possible Values: 'unlimited' or an integer greater or equal to 0
|
; Possible Values: 'unlimited' or an integer greater or equal to 0
|
||||||
; Default Value: system defined value
|
; Default Value: system defined value
|
||||||
;rlimit_core = 0
|
;rlimit_core = 0
|
||||||
|
|
||||||
; Chroot to this directory at the start. This value must be defined as an
|
; Chroot to this directory at the start. This value must be defined as an
|
||||||
; absolute path. When this value is not set, chroot is not used.
|
; absolute path. When this value is not set, chroot is not used.
|
||||||
; Note: you can prefix with '$prefix' to chroot to the pool prefix or one
|
; Note: you can prefix with '$prefix' to chroot to the pool prefix or one
|
||||||
; of its subdirectories. If the pool prefix is not set, the global prefix
|
; of its subdirectories. If the pool prefix is not set, the global prefix
|
||||||
; will be used instead.
|
; will be used instead.
|
||||||
; Note: chrooting is a great security feature and should be used whenever
|
; Note: chrooting is a great security feature and should be used whenever
|
||||||
; possible. However, all PHP paths will be relative to the chroot
|
; possible. However, all PHP paths will be relative to the chroot
|
||||||
; (error_log, sessions.save_path, ...).
|
; (error_log, sessions.save_path, ...).
|
||||||
; Default Value: not set
|
; Default Value: not set
|
||||||
|
@ -347,16 +365,25 @@ chdir = __FINALPATH__
|
||||||
; Note: on highloaded environement, this can cause some delay in the page
|
; Note: on highloaded environement, this can cause some delay in the page
|
||||||
; process time (several ms).
|
; process time (several ms).
|
||||||
; 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.
|
||||||
; Default Value: clean env
|
; Default Value: clean env
|
||||||
|
@ -365,13 +392,12 @@ catch_workers_output = yes
|
||||||
;env[TMP] = /tmp
|
;env[TMP] = /tmp
|
||||||
;env[TMPDIR] = /tmp
|
;env[TMPDIR] = /tmp
|
||||||
;env[TEMP] = /tmp
|
;env[TEMP] = /tmp
|
||||||
env[PATH] = $PATH
|
|
||||||
|
|
||||||
; Additional php.ini defines, specific to this pool of workers. These settings
|
; Additional php.ini defines, specific to this pool of workers. These settings
|
||||||
; overwrite the values previously defined in the php.ini. The directives are the
|
; overwrite the values previously defined in the php.ini. The directives are the
|
||||||
; same as the PHP SAPI:
|
; same as the PHP SAPI:
|
||||||
; php_value/php_flag - you can set classic ini defines which can
|
; php_value/php_flag - you can set classic ini defines which can
|
||||||
; be overwritten from PHP call 'ini_set'.
|
; be overwritten from PHP call 'ini_set'.
|
||||||
; php_admin_value/php_admin_flag - these directives won't be overwritten by
|
; php_admin_value/php_admin_flag - these directives won't be overwritten by
|
||||||
; PHP call 'ini_set'
|
; PHP call 'ini_set'
|
||||||
; For php_*flag, valid values are on, off, 1, 0, true, false, yes or no.
|
; For php_*flag, valid values are on, off, 1, 0, true, false, yes or no.
|
||||||
|
@ -392,6 +418,17 @@ env[PATH] = $PATH
|
||||||
;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
|
||||||
|
|
||||||
; Additional php.ini defines, specific to this pool of workers.
|
; Additional php.ini defines, specific to this pool of workers.
|
||||||
php_value[upload_max_filesize] = 10G
|
php_value[upload_max_filesize] = 10G
|
||||||
php_value[post_max_size] = 10G
|
php_value[post_max_size] = 10G
|
||||||
|
@ -404,4 +441,3 @@ php_value[opcache.max_accelerated_files]=10000
|
||||||
php_value[opcache.memory_consumption]=128
|
php_value[opcache.memory_consumption]=128
|
||||||
php_value[opcache.save_comments]=1
|
php_value[opcache.save_comments]=1
|
||||||
php_value[opcache.revalidate_freq]=1
|
php_value[opcache.revalidate_freq]=1
|
||||||
|
|
||||||
|
|
|
@ -2,4 +2,4 @@
|
||||||
|
|
||||||
user=$1
|
user=$1
|
||||||
|
|
||||||
sudo setfacl -m g:#GROUP#:rwx /home/$user
|
sudo setfacl --modify g:__GROUP__:rwx /home/$user
|
||||||
|
|
|
@ -14,12 +14,12 @@
|
||||||
"email": "apps@yunohost.org"
|
"email": "apps@yunohost.org"
|
||||||
},
|
},
|
||||||
"requirements": {
|
"requirements": {
|
||||||
"yunohost": ">= 2.7.2"
|
"yunohost": ">= 3.2.0"
|
||||||
},
|
},
|
||||||
"multi_instance": true,
|
"multi_instance": true,
|
||||||
"services": [
|
"services": [
|
||||||
"nginx",
|
"nginx",
|
||||||
"php5-fpm",
|
"php7.0-fpm",
|
||||||
"mysql"
|
"mysql"
|
||||||
],
|
],
|
||||||
"arguments": {
|
"arguments": {
|
||||||
|
|
|
@ -3,53 +3,10 @@
|
||||||
# COMMON VARIABLES
|
# COMMON VARIABLES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
pkg_dependencies="php5-gd php5-json php5-intl php5-mcrypt php5-curl php5-apcu php5-redis php5-ldap php5-imagick imagemagick acl tar smbclient at"
|
pkg_dependencies="php-gd php-json php-intl php-mcrypt php-curl php-apcu php-redis php-ldap php-imagick php-zip php-mbstring php-xml imagemagick acl tar smbclient at"
|
||||||
|
|
||||||
if [ "$(lsb_release --codename --short)" != "jessie" ]; then
|
|
||||||
pkg_dependencies="$pkg_dependencies php-zip php-apcu php-mbstring php-xml"
|
|
||||||
fi
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# COMMON HELPERS
|
# EXPERIMENTAL HELPERS
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Execute a command with occ
|
|
||||||
exec_occ() {
|
|
||||||
(cd "$final_path" && exec_as "$app" \
|
|
||||||
php occ --no-interaction --no-ansi "$@")
|
|
||||||
}
|
|
||||||
|
|
||||||
# Create the external storage for the given folders and enable sharing
|
|
||||||
create_external_storage() {
|
|
||||||
local datadir="$1"
|
|
||||||
local mount_name="$2"
|
|
||||||
local mount_id=`exec_occ files_external:create --output=json \
|
|
||||||
"$2" 'local' 'null::null' -c "datadir=$datadir" || true`
|
|
||||||
! [[ $mount_id =~ ^[0-9]+$ ]] \
|
|
||||||
&& echo "Unable to create external storage" >&2 \
|
|
||||||
|| exec_occ files_external:option "$mount_id" enable_sharing true
|
|
||||||
}
|
|
||||||
|
|
||||||
# Rename a MySQL database and user
|
|
||||||
# Usage: rename_mysql_db DBNAME DBUSER DBPASS NEW_DBNAME_AND_USER
|
|
||||||
rename_mysql_db() {
|
|
||||||
local db_name=$1 db_user=$2 db_pwd=$3 new_db_name=$4
|
|
||||||
local sqlpath="/tmp/${db_name}-$(date '+%s').sql"
|
|
||||||
|
|
||||||
# Dump the old database
|
|
||||||
mysqldump -u "$db_user" -p"$db_pwd" --no-create-db "$db_name" > "$sqlpath"
|
|
||||||
|
|
||||||
# Create the new database and user
|
|
||||||
ynh_mysql_create_db "$new_db_name" "$new_db_name" "$db_pwd"
|
|
||||||
ynh_mysql_connect_as "$new_db_name" "$db_pwd" "$new_db_name" < "$sqlpath"
|
|
||||||
|
|
||||||
# Remove the old database
|
|
||||||
ynh_mysql_remove_db $db_name $db_name
|
|
||||||
ynh_secure_remove "$sqlpath"
|
|
||||||
}
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# COMMON HELPERS -- SHOULD BE ADDED TO YUNOHOST
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Execute a command as another user
|
# Execute a command as another user
|
||||||
|
@ -318,10 +275,36 @@ ynh_handle_app_migration () {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ynh_smart_mktemp () {
|
||||||
|
local min_size="${1:-300}"
|
||||||
|
# Transform the minimum size from megabytes to kilobytes
|
||||||
|
min_size=$(( $min_size * 1024 ))
|
||||||
|
|
||||||
|
# Check if there's enough free space in a directory
|
||||||
|
is_there_enough_space () {
|
||||||
|
local free_space=$(df --output=avail "$1" | sed 1d)
|
||||||
|
test $free_space -ge $min_size
|
||||||
|
}
|
||||||
|
|
||||||
|
if is_there_enough_space /tmp; then
|
||||||
|
local tmpdir=/tmp
|
||||||
|
elif is_there_enough_space /var; then
|
||||||
|
local tmpdir=/var
|
||||||
|
elif is_there_enough_space /; then
|
||||||
|
local tmpdir=/
|
||||||
|
elif is_there_enough_space /home; then
|
||||||
|
local tmpdir=/home
|
||||||
|
else
|
||||||
|
ynh_die "Insufficient free space to continue..."
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "$(sudo mktemp --directory --tmpdir="$tmpdir")"
|
||||||
|
}
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# EXPERIMENTAL HELPERS
|
# FUTURE OFFICIAL HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# YUNOHOST MULTIMEDIA INTEGRATION
|
# YUNOHOST MULTIMEDIA INTEGRATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -330,16 +313,20 @@ ynh_handle_app_migration () {
|
||||||
#
|
#
|
||||||
# usage: ynh_multimedia_build_main_dir
|
# usage: ynh_multimedia_build_main_dir
|
||||||
ynh_multimedia_build_main_dir () {
|
ynh_multimedia_build_main_dir () {
|
||||||
local ynh_media_release="v1.0"
|
local ynh_media_release="v1.2"
|
||||||
local checksum="4852c8607db820ad51f348da0dcf0c88"
|
local checksum="806a827ba1902d6911095602a9221181"
|
||||||
|
|
||||||
# Download yunohost.multimedia scripts
|
# Download yunohost.multimedia scripts
|
||||||
wget -nv https://github.com/YunoHost-Apps/yunohost.multimedia/archive/${ynh_media_release}.tar.gz
|
wget -nv https://github.com/YunoHost-Apps/yunohost.multimedia/archive/${ynh_media_release}.tar.gz
|
||||||
|
|
||||||
# Verify checksum
|
# Check the control sum
|
||||||
echo "${checksum} ${ynh_media_release}.tar.gz" | md5sum -c --status \
|
echo "${checksum} ${ynh_media_release}.tar.gz" | md5sum -c --status \
|
||||||
|| ynh_die "Corrupt source"
|
|| ynh_die "Corrupt source"
|
||||||
|
|
||||||
|
# Check if the package acl is installed. Or install it.
|
||||||
|
ynh_package_is_installed 'acl' \
|
||||||
|
|| ynh_package_install acl
|
||||||
|
|
||||||
# Extract
|
# Extract
|
||||||
mkdir yunohost.multimedia-master
|
mkdir yunohost.multimedia-master
|
||||||
tar -xf ${ynh_media_release}.tar.gz -C yunohost.multimedia-master --strip-components 1
|
tar -xf ${ynh_media_release}.tar.gz -C yunohost.multimedia-master --strip-components 1
|
||||||
|
|
|
@ -2,18 +2,11 @@
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC START
|
# GENERIC START
|
||||||
#=================================================
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# IMPORT GENERIC HELPERS
|
# IMPORT GENERIC HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
if [ ! -e _common.sh ]; then
|
source ../settings/scripts/_common.sh
|
||||||
# Get the _common.sh file if it's not in the current directory
|
|
||||||
cp ../settings/scripts/_common.sh ./_common.sh
|
|
||||||
chmod a+rx _common.sh
|
|
||||||
fi
|
|
||||||
source _common.sh
|
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -26,6 +19,7 @@ ynh_abort_if_errors
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Loading installation settings..."
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
|
@ -38,24 +32,28 @@ db_name=$(ynh_app_setting_get $app db_name)
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE APP MAIN DIR
|
# BACKUP THE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Backing up the main app directory..."
|
||||||
|
|
||||||
ynh_backup "$final_path"
|
ynh_backup "$final_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE NGINX CONFIGURATION
|
# BACKUP THE NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Backing up nginx web server configuration..."
|
||||||
|
|
||||||
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
|
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE PHP-FPM CONFIGURATION
|
# BACKUP THE PHP-FPM CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Backing up php-fpm configuration..."
|
||||||
|
|
||||||
ynh_backup "/etc/php5/fpm/pool.d/$app.conf"
|
ynh_backup "/etc/php/7.0/fpm/pool.d/$app.conf"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE MYSQL DATABASE
|
# BACKUP THE MYSQL DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Backing up the MySQL database..."
|
||||||
|
|
||||||
ynh_mysql_dump_db "$db_name" > db.sql
|
ynh_mysql_dump_db "$db_name" > db.sql
|
||||||
|
|
||||||
|
@ -64,6 +62,7 @@ ynh_mysql_dump_db "$db_name" > db.sql
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP LOGROTATE
|
# BACKUP LOGROTATE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Backing up logrotate configuration..."
|
||||||
|
|
||||||
ynh_backup "/etc/logrotate.d/$app"
|
ynh_backup "/etc/logrotate.d/$app"
|
||||||
|
|
||||||
|
@ -76,12 +75,15 @@ ynh_backup "/etc/cron.d/$app"
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE DATA DIRECTORY
|
# BACKUP THE DATA DIRECTORY
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Backing up data directory..."
|
||||||
|
|
||||||
backup_core_only=$(ynh_app_setting_get "$app" backup_core_only)
|
# The 1 parameter indicates the directory is "big",
|
||||||
# If backup_core_only have any value in the settings.yml file, do not backup the data directory
|
# so that it won't be backed up before upgrade
|
||||||
if [ -z $backup_core_only ]
|
# This argument has to be the third one.
|
||||||
then
|
ynh_backup "/home/yunohost.app/${app}/data" "/home/yunohost.app/${app}/data" 1
|
||||||
ynh_backup "/home/yunohost.app/${app}/data"
|
|
||||||
else
|
#=================================================
|
||||||
echo "Data dir will not be saved, because backup_core_only is set." >&2
|
# END OF SCRIPT
|
||||||
fi
|
#=================================================
|
||||||
|
|
||||||
|
ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
|
||||||
|
|
105
scripts/install
105
scripts/install
|
@ -30,6 +30,7 @@ app=$YNH_APP_INSTANCE_NAME
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Validating installation parameters..."
|
||||||
|
|
||||||
final_path=/var/www/$app
|
final_path=/var/www/$app
|
||||||
test ! -e "$final_path" || ynh_die "This path already contains a folder"
|
test ! -e "$final_path" || ynh_die "This path already contains a folder"
|
||||||
|
@ -37,14 +38,13 @@ test ! -e "$final_path" || ynh_die "This path already contains a folder"
|
||||||
# Normalize the url path syntax
|
# Normalize the url path syntax
|
||||||
path_url=$(ynh_normalize_url_path $path_url)
|
path_url=$(ynh_normalize_url_path $path_url)
|
||||||
|
|
||||||
# Check web path availability
|
|
||||||
ynh_webpath_available $domain $path_url
|
|
||||||
# Register (book) web path
|
# Register (book) web path
|
||||||
ynh_webpath_register $app $domain $path_url
|
ynh_webpath_register $app $domain $path_url
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STORE SETTINGS FROM MANIFEST
|
# STORE SETTINGS FROM MANIFEST
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Storing installation settings..."
|
||||||
|
|
||||||
ynh_app_setting_set $app domain $domain
|
ynh_app_setting_set $app domain $domain
|
||||||
ynh_app_setting_set $app path $path_url
|
ynh_app_setting_set $app path $path_url
|
||||||
|
@ -56,12 +56,14 @@ ynh_app_setting_set $app user_home $user_home
|
||||||
#=================================================
|
#=================================================
|
||||||
# INSTALL DEPENDENCIES
|
# INSTALL DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Installing dependencies..."
|
||||||
|
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
ynh_install_app_dependencies $pkg_dependencies
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE A MYSQL DATABASE
|
# CREATE A MYSQL DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Creating a MySQL database..."
|
||||||
|
|
||||||
db_name=$(ynh_sanitize_dbid $app)
|
db_name=$(ynh_sanitize_dbid $app)
|
||||||
ynh_app_setting_set $app db_name $db_name
|
ynh_app_setting_set $app db_name $db_name
|
||||||
|
@ -70,6 +72,7 @@ ynh_mysql_setup_db $db_name $db_name
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Setting up source files..."
|
||||||
|
|
||||||
# Load the last available version
|
# Load the last available version
|
||||||
source upgrade.d/upgrade.last.sh
|
source upgrade.d/upgrade.last.sh
|
||||||
|
@ -87,24 +90,21 @@ ynh_setup_source "$final_path"
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Configuring nginx web server..."
|
||||||
|
|
||||||
# Do not serve .well-known if it's already served on the domain
|
# Do not serve .well-known if it's already served on the domain
|
||||||
if is_url_handled "https://${domain}/.well-known/caldav" ; then
|
if is_url_handled "https://$domain/.well-known/caldav" ; then
|
||||||
sed -ri '/^location = \/\.well\-known\/(caldav|carddav) \{/,/\}/d' \
|
sed -ri '/^location = \/\.well\-known\/(caldav|carddav) \{/,/\}/d' \
|
||||||
"../conf/nginx.conf"
|
"../conf/nginx.conf"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Handle root path, avoid double slash.
|
|
||||||
# Temporary fix, in waiting for an upgrade of the helper. (#361)
|
|
||||||
path_url_slash_less=${path_url%/}
|
|
||||||
ynh_replace_string "__PATH__/" "$path_url_slash_less/" "../conf/nginx.conf"
|
|
||||||
|
|
||||||
# Create a dedicated nginx config
|
# Create a dedicated nginx config
|
||||||
ynh_add_nginx_config
|
ynh_add_nginx_config
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE DEDICATED USER
|
# CREATE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Configuring system user..."
|
||||||
|
|
||||||
# Create a system user
|
# Create a system user
|
||||||
ynh_system_user_create $app
|
ynh_system_user_create $app
|
||||||
|
@ -112,6 +112,7 @@ ynh_system_user_create $app
|
||||||
#=================================================
|
#=================================================
|
||||||
# PHP-FPM CONFIGURATION
|
# PHP-FPM CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Configuring php-fpm..."
|
||||||
|
|
||||||
# Create a dedicated php-fpm config
|
# Create a dedicated php-fpm config
|
||||||
ynh_add_fpm_config
|
ynh_add_fpm_config
|
||||||
|
@ -123,50 +124,62 @@ ynh_add_fpm_config
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Define app's data directory
|
# Define app's data directory
|
||||||
datadir="/home/yunohost.app/${app}/data"
|
datadir="/home/yunohost.app/$app/data"
|
||||||
# Create app folders
|
# Create app folders
|
||||||
mkdir -p "$datadir"
|
mkdir -p "$datadir"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INSTALL NEXTCLOUD
|
# INSTALL NEXTCLOUD
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Installing nextcloud..."
|
||||||
|
|
||||||
|
# Define a function to execute commands with `occ`
|
||||||
|
exec_occ() {
|
||||||
|
(cd "$final_path" && exec_as "$app" \
|
||||||
|
php occ --no-interaction --no-ansi "$@")
|
||||||
|
}
|
||||||
|
|
||||||
# Set write access for the following commands
|
# Set write access for the following commands
|
||||||
chown -R $app: "$final_path" "$datadir"
|
chown -R $app: "$final_path" "$datadir"
|
||||||
|
|
||||||
# Install Nextcloud using a temporary admin user
|
# Install Nextcloud using a temporary admin user
|
||||||
exec_occ maintenance:install \
|
exec_occ maintenance:install \
|
||||||
--database "mysql" --database-name "$db_name" \
|
--database "mysql" --database-name $db_name \
|
||||||
--database-user "$db_name" --database-pass "$db_pwd" \
|
--database-user $db_name --database-pass "$db_pwd" \
|
||||||
--admin-user "admin" --admin-pass "$(ynh_string_random 6)" \
|
--admin-user "admin" --admin-pass "$(ynh_string_random 6)" \
|
||||||
--data-dir "$datadir" \
|
--data-dir "$datadir" \
|
||||||
|| ynh_die "Unable to install Nextcloud"
|
|| ynh_die "Unable to install Nextcloud"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CONFIGURE NEXTCLOUD
|
# CONFIGURE NEXTCLOUD
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Configuring nextcloud..."
|
||||||
|
|
||||||
# Ensure that UpdateNotification app is disabled
|
# Ensure that UpdateNotification app is disabled
|
||||||
exec_occ app:disable updatenotification
|
exec_occ app:disable updatenotification
|
||||||
|
|
||||||
# Enable plugins
|
# Enable ldap plugin
|
||||||
exec_occ app:enable user_ldap
|
exec_occ app:enable user_ldap
|
||||||
exec_occ ldap:create-empty-config
|
exec_occ ldap:create-empty-config
|
||||||
|
|
||||||
# Load the installation config file in nextcloud
|
# Load the installation config file in nextcloud
|
||||||
nc_conf="${final_path}/config_install.json"
|
nc_conf="$final_path/config_install.json"
|
||||||
cp ../conf/config_install.json "$nc_conf"
|
cp ../conf/config_install.json "$nc_conf"
|
||||||
ynh_replace_string "#DOMAIN#" "$domain" "$nc_conf"
|
|
||||||
ynh_replace_string "#DATADIR#" "$datadir" "$nc_conf"
|
ynh_replace_string "__DOMAIN__" "$domain" "$nc_conf"
|
||||||
|
ynh_replace_string "__DATADIR__" "$datadir" "$nc_conf"
|
||||||
exec_occ config:import "$nc_conf"
|
exec_occ config:import "$nc_conf"
|
||||||
# Then remove it
|
|
||||||
|
# Then remove the config file
|
||||||
rm -f "$nc_conf"
|
rm -f "$nc_conf"
|
||||||
|
|
||||||
# Load the additional config file (used also for upgrade)
|
# Load the additional config file (used also for upgrade)
|
||||||
nc_conf="${final_path}/config_install.json"
|
nc_conf="$final_path/config.json"
|
||||||
cp ../conf/config.json "$nc_conf"
|
cp ../conf/config.json "$nc_conf"
|
||||||
|
|
||||||
exec_occ config:import "$nc_conf"
|
exec_occ config:import "$nc_conf"
|
||||||
# Then remove it
|
|
||||||
|
# Then remove the config file
|
||||||
rm -f "$nc_conf"
|
rm -f "$nc_conf"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -181,13 +194,26 @@ exec_occ ldap:test-config \'\' \
|
||||||
# MOUNT HOME FOLDERS AS EXTERNAL STORAGE
|
# MOUNT HOME FOLDERS AS EXTERNAL STORAGE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
# Define a function to add an external storage
|
||||||
|
# Create the external storage for the given folders and enable sharing
|
||||||
|
create_external_storage() {
|
||||||
|
local datadir="$1"
|
||||||
|
local mount_name="$2"
|
||||||
|
local mount_id=`exec_occ files_external:create --output=json \
|
||||||
|
"$mount_name" 'local' 'null::null' -c "datadir=$datadir" || true`
|
||||||
|
! [[ $mount_id =~ ^[0-9]+$ ]] \
|
||||||
|
&& echo "Unable to create external storage" >&2 \
|
||||||
|
|| exec_occ files_external:option "$mount_id" enable_sharing true
|
||||||
|
}
|
||||||
|
|
||||||
# Enable External Storage and create local mount to home folder
|
# Enable External Storage and create local mount to home folder
|
||||||
if [ $user_home -eq 1 ]; then
|
if [ $user_home -eq 1 ]
|
||||||
|
then
|
||||||
exec_occ app:enable files_external
|
exec_occ app:enable files_external
|
||||||
create_external_storage "/home/\$user" "Home"
|
create_external_storage "/home/\$user" "Home"
|
||||||
# Iterate over users to extend their home folder permissions
|
# Iterate over users to extend their home folder permissions
|
||||||
for u in $(ynh_user_list); do
|
for u in $(ynh_user_list); do
|
||||||
setfacl -m g:$app:rwx "/home/$u" || true
|
setfacl --modify g:$app:rwx "/home/$u" || true
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -203,7 +229,7 @@ exec_occ config:system:get logout_url >/dev/null 2>&1 \
|
||||||
\$main_domain = exec('cat /etc/yunohost/current_host');
|
\$main_domain = exec('cat /etc/yunohost/current_host');
|
||||||
\$CONFIG['logout_url'] = 'https://'.\$main_domain.'/yunohost/sso/?action=logout';
|
\$CONFIG['logout_url'] = 'https://'.\$main_domain.'/yunohost/sso/?action=logout';
|
||||||
//-YunoHost-
|
//-YunoHost-
|
||||||
" >> "${final_path}/config/config.php"
|
" >> "$final_path/config/config.php"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHANGE HOSTNAME FOR ACTIVITY NOTIFICATIONS
|
# CHANGE HOSTNAME FOR ACTIVITY NOTIFICATIONS
|
||||||
|
@ -226,7 +252,7 @@ exec_occ user:delete admin
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Calculate and store the config file checksum into the app settings
|
# Calculate and store the config file checksum into the app settings
|
||||||
ynh_store_file_checksum "${final_path}/config/config.php"
|
ynh_store_file_checksum "$final_path/config/config.php"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ADD A CRON JOB
|
# ADD A CRON JOB
|
||||||
|
@ -237,14 +263,15 @@ cp -a ../conf/nextcloud.cron "$cron_path"
|
||||||
chown root: "$cron_path"
|
chown root: "$cron_path"
|
||||||
chmod 644 "$cron_path"
|
chmod 644 "$cron_path"
|
||||||
|
|
||||||
ynh_replace_string "#USER#" "$app" "$cron_path"
|
ynh_replace_string "__USER__" "$app" "$cron_path"
|
||||||
ynh_replace_string "#DESTDIR#" "$final_path" "$cron_path"
|
ynh_replace_string "__DESTDIR__" "$final_path" "$cron_path"
|
||||||
|
|
||||||
exec_occ background:cron
|
exec_occ background:cron
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# POST-INSTALL MAINTENANCE
|
# POST-INSTALL MAINTENANCE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
(cd /tmp ; at now + 10 minutes <<< "(cd $final_path ; sudo -u $app php occ db:add-missing-indices ; sudo -u $app php occ db:convert-filecache-bigint -n) > /tmp/${app}_maintenance.log")
|
(cd /tmp ; at now + 10 minutes <<< "(cd $final_path ; sudo -u $app php occ db:add-missing-indices ; sudo -u $app php occ db:convert-filecache-bigint -n) > /tmp/${app}_maintenance.log")
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -252,11 +279,12 @@ exec_occ background:cron
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Set system group in hooks
|
# Set system group in hooks
|
||||||
ynh_replace_string "#GROUP#" "$app" ../hooks/post_user_create
|
ynh_replace_string "__GROUP__" "$app" ../hooks/post_user_create
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# YUNOHOST MULTIMEDIA INTEGRATION
|
# YUNOHOST MULTIMEDIA INTEGRATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Adding multimedia directories..."
|
||||||
|
|
||||||
# Build YunoHost multimedia directories
|
# Build YunoHost multimedia directories
|
||||||
ynh_multimedia_build_main_dir
|
ynh_multimedia_build_main_dir
|
||||||
|
@ -275,23 +303,25 @@ ynh_multimedia_addaccess $app
|
||||||
|
|
||||||
# Fix app ownerships & permissions
|
# Fix app ownerships & permissions
|
||||||
chown -R $app: "$final_path" "$datadir"
|
chown -R $app: "$final_path" "$datadir"
|
||||||
find ${final_path}/ -type f -print0 | xargs -0 chmod 0644
|
find $final_path/ -type f -print0 | xargs -0 chmod 0644
|
||||||
find ${final_path}/ -type d -print0 | xargs -0 chmod 0755
|
find $final_path/ -type d -print0 | xargs -0 chmod 0755
|
||||||
find ${datadir}/ -type f -print0 | xargs -0 chmod 0640
|
find $datadir/ -type f -print0 | xargs -0 chmod 0640
|
||||||
find ${datadir}/ -type d -print0 | xargs -0 chmod 0750
|
find $datadir/ -type d -print0 | xargs -0 chmod 0750
|
||||||
chmod 640 "${final_path}/config/config.php"
|
chmod 640 "$final_path/config/config.php"
|
||||||
chmod 755 /home/yunohost.app
|
chmod 755 /home/yunohost.app
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP LOGROTATE
|
# SETUP LOGROTATE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Configuring log rotation..."
|
||||||
|
|
||||||
# Use logrotate to manage application logfile
|
# Use logrotate to manage application logfile(s)
|
||||||
ynh_use_logrotate "${datadir}/nextcloud.log"
|
ynh_use_logrotate "$datadir/nextcloud.log"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SSOWAT
|
# SETUP SSOWAT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Configuring SSOwat..."
|
||||||
|
|
||||||
ynh_app_setting_set $app unprotected_uris "/"
|
ynh_app_setting_set $app unprotected_uris "/"
|
||||||
ynh_app_setting_set $app skipped_regex \
|
ynh_app_setting_set $app skipped_regex \
|
||||||
|
@ -300,5 +330,12 @@ ynh_app_setting_set $app skipped_regex \
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Reloading nginx web server..."
|
||||||
|
|
||||||
systemctl reload nginx
|
systemctl reload nginx
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# END OF SCRIPT
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_print_info "Installation of $app completed"
|
||||||
|
|
|
@ -12,6 +12,7 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Loading installation settings..."
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
|
@ -24,6 +25,7 @@ final_path=$(ynh_app_setting_get $app final_path)
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE DEPENDENCIES
|
# REMOVE DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Removing dependencies"
|
||||||
|
|
||||||
# Remove metapackage and its dependencies
|
# Remove metapackage and its dependencies
|
||||||
ynh_remove_app_dependencies
|
ynh_remove_app_dependencies
|
||||||
|
@ -31,6 +33,7 @@ ynh_remove_app_dependencies
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE THE MYSQL DATABASE
|
# REMOVE THE MYSQL DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Removing the MySQL database"
|
||||||
|
|
||||||
# Remove a database if it exists, along with the associated user
|
# Remove a database if it exists, along with the associated user
|
||||||
ynh_mysql_remove_db $db_name $db_name
|
ynh_mysql_remove_db $db_name $db_name
|
||||||
|
@ -38,6 +41,7 @@ ynh_mysql_remove_db $db_name $db_name
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE APP MAIN DIR
|
# REMOVE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Removing app main directory"
|
||||||
|
|
||||||
# Remove the app directory securely
|
# Remove the app directory securely
|
||||||
ynh_secure_remove "$final_path"
|
ynh_secure_remove "$final_path"
|
||||||
|
@ -45,6 +49,7 @@ ynh_secure_remove "$final_path"
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE NGINX CONFIGURATION
|
# REMOVE NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Removing nginx web server configuration"
|
||||||
|
|
||||||
# Remove the dedicated nginx config
|
# Remove the dedicated nginx config
|
||||||
ynh_remove_nginx_config
|
ynh_remove_nginx_config
|
||||||
|
@ -52,6 +57,7 @@ ynh_remove_nginx_config
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE PHP-FPM CONFIGURATION
|
# REMOVE PHP-FPM CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Removing php-fpm configuration"
|
||||||
|
|
||||||
# Remove the dedicated php-fpm config
|
# Remove the dedicated php-fpm config
|
||||||
ynh_remove_fpm_config
|
ynh_remove_fpm_config
|
||||||
|
@ -59,6 +65,7 @@ ynh_remove_fpm_config
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE LOGROTATE CONFIGURATION
|
# REMOVE LOGROTATE CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Removing logrotate configuration"
|
||||||
|
|
||||||
# Remove the app-specific logrotate config
|
# Remove the app-specific logrotate config
|
||||||
ynh_remove_logrotate
|
ynh_remove_logrotate
|
||||||
|
@ -78,8 +85,9 @@ ynh_secure_remove "/etc/cron.d/$app"
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
for i in $(ls /home); do
|
for i in $(ls /home); do
|
||||||
|
# Clean ACL in every directories in /home, except those which start with 'yunohost.'
|
||||||
[[ ! $i == yunohost.* ]] \
|
[[ ! $i == yunohost.* ]] \
|
||||||
&& setfacl -x g:$app:rwx 2>&1
|
&& setfacl --remove g:$app:rwx 2>&1
|
||||||
done
|
done
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -87,6 +95,13 @@ done
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE DEDICATED USER
|
# REMOVE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Removing the dedicated system user"
|
||||||
|
|
||||||
# Delete a system user
|
# Delete a system user
|
||||||
ynh_system_user_delete $app
|
ynh_system_user_delete $app
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# END OF SCRIPT
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_print_info "Removal of $app completed"
|
||||||
|
|
|
@ -2,18 +2,11 @@
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC START
|
# GENERIC START
|
||||||
#=================================================
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# IMPORT GENERIC HELPERS
|
# IMPORT GENERIC HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
if [ ! -e _common.sh ]; then
|
source ../settings/scripts/_common.sh
|
||||||
# Get the _common.sh file if it's not in the current directory
|
|
||||||
cp ../settings/scripts/_common.sh ./_common.sh
|
|
||||||
chmod a+rx _common.sh
|
|
||||||
fi
|
|
||||||
source _common.sh
|
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -26,6 +19,7 @@ ynh_abort_if_errors
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Loading settings..."
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
|
@ -37,6 +31,7 @@ db_name=$(ynh_app_setting_get $app db_name)
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK IF THE APP CAN BE RESTORED
|
# CHECK IF THE APP CAN BE RESTORED
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Validating restoration parameters..."
|
||||||
|
|
||||||
ynh_webpath_available $domain $path_url \
|
ynh_webpath_available $domain $path_url \
|
||||||
|| ynh_die "Path not available: ${domain}${path_url}"
|
|| ynh_die "Path not available: ${domain}${path_url}"
|
||||||
|
@ -54,12 +49,14 @@ ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE APP MAIN DIR
|
# RESTORE THE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Restoring the app main directory..."
|
||||||
|
|
||||||
ynh_restore_file "$final_path"
|
ynh_restore_file "$final_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE MYSQL DATABASE
|
# RESTORE THE MYSQL DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Restoring the MySQL database..."
|
||||||
|
|
||||||
db_pwd=$(ynh_app_setting_get $app mysqlpwd)
|
db_pwd=$(ynh_app_setting_get $app mysqlpwd)
|
||||||
ynh_mysql_setup_db $db_name $db_name $db_pwd
|
ynh_mysql_setup_db $db_name $db_name $db_pwd
|
||||||
|
@ -68,6 +65,7 @@ ynh_mysql_connect_as $db_name $db_pwd $db_name < ./db.sql
|
||||||
#=================================================
|
#=================================================
|
||||||
# RECREATE THE DEDICATED USER
|
# RECREATE THE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Recreating the dedicated system user..."
|
||||||
|
|
||||||
# Create the dedicated user (if not existing)
|
# Create the dedicated user (if not existing)
|
||||||
ynh_system_user_create $app
|
ynh_system_user_create $app
|
||||||
|
@ -76,13 +74,14 @@ ynh_system_user_create $app
|
||||||
# RESTORE THE PHP-FPM CONFIGURATION
|
# RESTORE THE PHP-FPM CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_restore_file "/etc/php5/fpm/pool.d/$app.conf"
|
ynh_restore_file "/etc/php/7.0/fpm/pool.d/$app.conf"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC RESTORATION
|
# SPECIFIC RESTORATION
|
||||||
#=================================================
|
#=================================================
|
||||||
# REINSTALL DEPENDENCIES
|
# REINSTALL DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Reinstalling dependencies..."
|
||||||
|
|
||||||
# Define and install dependencies
|
# Define and install dependencies
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
ynh_install_app_dependencies $pkg_dependencies
|
||||||
|
@ -102,8 +101,9 @@ ynh_restore_file "/etc/logrotate.d/$app"
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE DATA DIRECTORY
|
# RESTORE THE DATA DIRECTORY
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Restoring data directory..."
|
||||||
|
|
||||||
datadir="/home/yunohost.app/${app}/data"
|
datadir="/home/yunohost.app/$app/data"
|
||||||
|
|
||||||
# The data directory will be restored only if it exists in the backup archive
|
# The data directory will be restored only if it exists in the backup archive
|
||||||
# So only if it was backup previously.
|
# So only if it was backup previously.
|
||||||
|
@ -114,8 +114,6 @@ else
|
||||||
# Create app folders
|
# Create app folders
|
||||||
mkdir -p "$datadir"
|
mkdir -p "$datadir"
|
||||||
fi
|
fi
|
||||||
# Remove the option backup_core_only if it's in the settings.yml file
|
|
||||||
ynh_app_setting_delete $app backup_core_only
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE USER RIGHTS
|
# RESTORE USER RIGHTS
|
||||||
|
@ -123,19 +121,20 @@ ynh_app_setting_delete $app backup_core_only
|
||||||
|
|
||||||
# Fix app ownerships & permissions
|
# Fix app ownerships & permissions
|
||||||
chown -R $app: "$final_path" "$datadir"
|
chown -R $app: "$final_path" "$datadir"
|
||||||
chmod 640 "${final_path}/config/config.php"
|
chmod 640 "$final_path/config/config.php"
|
||||||
chmod 755 /home/yunohost.app
|
chmod 755 /home/yunohost.app
|
||||||
|
|
||||||
# Iterate over users to extend their home folder permissions - for the external
|
# Iterate over users to extend their home folder permissions - for the external
|
||||||
# storage plugin usage - and create relevant Nextcloud directories
|
# storage plugin usage - and create relevant Nextcloud directories
|
||||||
for u in $(ynh_user_list); do
|
for u in $(ynh_user_list); do
|
||||||
mkdir -p "${datadir}/${u}"
|
mkdir -p "$datadir/$u"
|
||||||
setfacl -m g:$app:rwx "/home/$u" || true
|
setfacl --modify g:$app:rwx "/home/$u" || true
|
||||||
done
|
done
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# YUNOHOST MULTIMEDIA INTEGRATION
|
# YUNOHOST MULTIMEDIA INTEGRATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Adding multimedia directories..."
|
||||||
|
|
||||||
# Build YunoHost multimedia directories
|
# Build YunoHost multimedia directories
|
||||||
ynh_multimedia_build_main_dir
|
ynh_multimedia_build_main_dir
|
||||||
|
@ -147,6 +146,13 @@ ynh_multimedia_addaccess $app
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX AND PHP-FPM
|
# RELOAD NGINX AND PHP-FPM
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Reloading nginx web server and php-fpm..."
|
||||||
|
|
||||||
systemctl reload php5-fpm
|
systemctl reload php7.0-fpm
|
||||||
systemctl reload nginx
|
systemctl reload nginx
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# END OF SCRIPT
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_print_info "Restoration completed for $app"
|
||||||
|
|
118
scripts/upgrade
118
scripts/upgrade
|
@ -12,6 +12,7 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Loading installation settings..."
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
|
@ -25,6 +26,7 @@ user_home=$(ynh_app_setting_get $app user_home)
|
||||||
#=================================================
|
#=================================================
|
||||||
# ENSURE DOWNWARD COMPATIBILITY
|
# ENSURE DOWNWARD COMPATIBILITY
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Ensuring downward compatibility..."
|
||||||
|
|
||||||
# If db_name doesn't exist, create it
|
# If db_name doesn't exist, create it
|
||||||
if [ -z $db_name ]; then
|
if [ -z $db_name ]; then
|
||||||
|
@ -38,34 +40,34 @@ if [ -z $final_path ]; then
|
||||||
ynh_app_setting_set $app final_path $final_path
|
ynh_app_setting_set $app final_path $final_path
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Remove the option backup_core_only if it's in the settings.yml file
|
||||||
|
ynh_app_setting_delete $app backup_core_only
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Backing up the app before upgrading (may take a while)..."
|
||||||
|
|
||||||
# Made a backup only after the version 11.0.0
|
# Made a backup only after the version 11.0.0
|
||||||
# Before, the datas will be always saved.
|
# Before, the datas will be always saved.
|
||||||
|
|
||||||
# Get the current version number of nextcloud/owncloud
|
# Get the current version number of nextcloud/owncloud
|
||||||
current_version=$(grep OC_VersionString "$final_path/version.php" | cut -d\' -f2)
|
current_version=$(grep OC_VersionString "$final_path/version.php" | cut -d\' -f2)
|
||||||
current_major_version=${current_version%%.*}
|
current_major_version=${current_version%%.*}
|
||||||
|
|
||||||
if [ $current_major_version -gt 11 ]
|
if [ $current_major_version -gt 11 ]
|
||||||
then
|
then
|
||||||
# Inform the backup/restore process that it should not save the data directory
|
|
||||||
ynh_app_setting_set $app backup_core_only 1
|
|
||||||
|
|
||||||
# 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 () {
|
||||||
# Remove the post migration script before its execution !
|
# Remove the post migration script before its execution !
|
||||||
ynh_secure_remove "/tmp/owncloud_post_migration.sh" 2>&1
|
ynh_secure_remove "/tmp/owncloud_post_migration.sh" 2>&1
|
||||||
|
|
||||||
# restore it if the upgrade fails
|
# restore it if the upgrade fails
|
||||||
ynh_restore_upgradebackup
|
ynh_restore_upgradebackup
|
||||||
}
|
}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Exit if an error occurs during the script execution
|
# Exit if an error occurs during the execution of the script
|
||||||
ynh_abort_if_errors
|
ynh_abort_if_errors
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -75,7 +77,7 @@ ynh_abort_if_errors
|
||||||
ynh_handle_app_migration "owncloud" "owncloud_migration"
|
ynh_handle_app_migration "owncloud" "owncloud_migration"
|
||||||
if [ $migration_process -eq 1 ]
|
if [ $migration_process -eq 1 ]
|
||||||
then
|
then
|
||||||
# If a migration has been perform
|
# If a migration has been performed
|
||||||
# Reload some values changed by the migration process
|
# Reload some values changed by the migration process
|
||||||
final_path=$(ynh_app_setting_get $app final_path)
|
final_path=$(ynh_app_setting_get $app final_path)
|
||||||
db_name=$(ynh_app_setting_get $app db_name)
|
db_name=$(ynh_app_setting_get $app db_name)
|
||||||
|
@ -105,20 +107,19 @@ path_url=$(ynh_normalize_url_path $path_url)
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Upgrading nginx web server configuration..."
|
||||||
|
|
||||||
|
ynh_backup_if_checksum_is_different "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
# Delete current nginx configuration to be able to check if .well-known is already served.
|
# Delete current nginx configuration to be able to check if .well-known is already served.
|
||||||
ynh_remove_nginx_config
|
ynh_remove_nginx_config
|
||||||
ynh_app_setting_delete $app "checksum__etc_nginx_conf.d_$domain.d_$app.conf" || true
|
ynh_app_setting_delete $app "checksum__etc_nginx_conf.d_$domain.d_$app.conf" || true
|
||||||
# Do not serve .well-known if it's already served on the domain
|
|
||||||
if is_url_handled "https://${domain}/.well-known/caldav" ; then
|
|
||||||
sed -ri '/^location = \/\.well\-known\/(caldav|carddav) \{/,/\}/d' \
|
|
||||||
"../conf/nginx.conf"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Handle root path, avoid double slash.
|
# Do not serve .well-known if it's already served on the domain
|
||||||
# Temporary fix, in waiting for an upgrade of the helper. (#361)
|
if is_url_handled "https://$domain/.well-known/caldav" ; then
|
||||||
path_url_slash_less=${path_url%/}
|
sed -ri '/^location = \/\.well\-known\/(caldav|carddav) \{/,/\}/d' \
|
||||||
ynh_replace_string "__PATH__/" "$path_url_slash_less/" "../conf/nginx.conf"
|
"../conf/nginx.conf"
|
||||||
|
fi
|
||||||
|
|
||||||
# Create a dedicated nginx config
|
# Create a dedicated nginx config
|
||||||
ynh_add_nginx_config
|
ynh_add_nginx_config
|
||||||
|
@ -126,13 +127,15 @@ ynh_add_nginx_config
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE DEDICATED USER
|
# CREATE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Making sure dedicated system user exists..."
|
||||||
|
|
||||||
# Create a system user
|
# Create a dedicated user (if not existing)
|
||||||
ynh_system_user_create $app
|
ynh_system_user_create $app
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# PHP-FPM CONFIGURATION
|
# PHP-FPM CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Upgrading php-fpm configuration..."
|
||||||
|
|
||||||
# Create a dedicated php-fpm config
|
# Create a dedicated php-fpm config
|
||||||
ynh_add_fpm_config
|
ynh_add_fpm_config
|
||||||
|
@ -140,6 +143,7 @@ ynh_add_fpm_config
|
||||||
#=================================================
|
#=================================================
|
||||||
# UPGRADE DEPENDENCIES
|
# UPGRADE DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Upgrading dependencies..."
|
||||||
|
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
ynh_install_app_dependencies $pkg_dependencies
|
||||||
|
|
||||||
|
@ -149,13 +153,20 @@ ynh_install_app_dependencies $pkg_dependencies
|
||||||
# MAKE SEQUENTIAL UPGRADES FROM EACH MAJOR
|
# MAKE SEQUENTIAL UPGRADES FROM EACH MAJOR
|
||||||
# VERSION TO THE NEXT ONE
|
# VERSION TO THE NEXT ONE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Upgrading nextcloud..."
|
||||||
|
|
||||||
|
# Define a function to execute commands with `occ`
|
||||||
|
exec_occ() {
|
||||||
|
(cd "$final_path" && exec_as "$app" \
|
||||||
|
php occ --no-interaction --no-ansi "$@")
|
||||||
|
}
|
||||||
|
|
||||||
# Load the last available version
|
# Load the last available version
|
||||||
source upgrade.d/upgrade.last.sh
|
source upgrade.d/upgrade.last.sh
|
||||||
last_version=$next_version
|
last_version=$next_version
|
||||||
|
|
||||||
# Define app's data directory
|
# Define app's data directory
|
||||||
datadir="/home/yunohost.app/${app}/data"
|
datadir="/home/yunohost.app/$app/data"
|
||||||
|
|
||||||
# Set write access for the following commands
|
# Set write access for the following commands
|
||||||
chown -R $app: "$final_path" "$datadir"
|
chown -R $app: "$final_path" "$datadir"
|
||||||
|
@ -183,7 +194,7 @@ do
|
||||||
# Load the value for this version
|
# Load the value for this version
|
||||||
source upgrade.d/upgrade.$current_major_version.sh
|
source upgrade.d/upgrade.$current_major_version.sh
|
||||||
|
|
||||||
echo -e "\nUpgrade to nextcloud $next_version" >&2
|
ynh_print_info "Upgrade to nextcloud $next_version"
|
||||||
|
|
||||||
# Create an app.src for this version of nextcloud
|
# Create an app.src for this version of nextcloud
|
||||||
cp ../conf/app.src.default ../conf/app.src
|
cp ../conf/app.src.default ../conf/app.src
|
||||||
|
@ -218,7 +229,7 @@ do
|
||||||
# Upgrade Nextcloud (SUCCESS = 0, UP_TO_DATE = 3)
|
# Upgrade Nextcloud (SUCCESS = 0, UP_TO_DATE = 3)
|
||||||
exec_occ maintenance:mode --off
|
exec_occ maintenance:mode --off
|
||||||
exec_occ upgrade \
|
exec_occ upgrade \
|
||||||
|| ([[ $? -eq 3 ]] || ynh_die "Unable to upgrade Nextcloud")
|
|| ([ $? -eq 3 ] || ynh_die "Unable to upgrade Nextcloud")
|
||||||
|
|
||||||
# Get the new current version number
|
# Get the new current version number
|
||||||
current_version=$(grep OC_VersionString "$final_path/version.php" | cut -d\' -f2)
|
current_version=$(grep OC_VersionString "$final_path/version.php" | cut -d\' -f2)
|
||||||
|
@ -231,14 +242,16 @@ done
|
||||||
#=================================================
|
#=================================================
|
||||||
# CONFIGURE NEXTCLOUD
|
# CONFIGURE NEXTCLOUD
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Reconfiguring nextcloud..."
|
||||||
|
|
||||||
# Verify the checksum and backup the file if it's different
|
# Verify the checksum and backup the file if it's different
|
||||||
ynh_backup_if_checksum_is_different "${final_path}/config/config.php"
|
ynh_backup_if_checksum_is_different "$final_path/config/config.php"
|
||||||
|
|
||||||
nc_conf="${final_path}/config.json"
|
nc_conf="${final_path}/config.json"
|
||||||
cp ../conf/config.json "$nc_conf"
|
cp ../conf/config.json "$nc_conf"
|
||||||
ynh_replace_string "#DOMAIN#" "$domain" "$nc_conf"
|
|
||||||
ynh_replace_string "#DATADIR#" "$datadir" "$nc_conf"
|
ynh_replace_string "__DOMAIN__" "$domain" "$nc_conf"
|
||||||
|
ynh_replace_string "__DATADIR__" "$datadir" "$nc_conf"
|
||||||
|
|
||||||
# Ensure that UpdateNotification app is disabled
|
# Ensure that UpdateNotification app is disabled
|
||||||
exec_occ app:disable updatenotification
|
exec_occ app:disable updatenotification
|
||||||
|
@ -248,7 +261,8 @@ exec_occ app:enable user_ldap
|
||||||
|
|
||||||
# Load the config file in nextcloud
|
# Load the config file in nextcloud
|
||||||
exec_occ config:import "$nc_conf"
|
exec_occ config:import "$nc_conf"
|
||||||
# Then remove it
|
|
||||||
|
# Then remove the config file
|
||||||
rm -f "$nc_conf"
|
rm -f "$nc_conf"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -263,7 +277,7 @@ exec_occ config:system:get logout_url >/dev/null 2>&1 \
|
||||||
\$main_domain = exec('cat /etc/yunohost/current_host');
|
\$main_domain = exec('cat /etc/yunohost/current_host');
|
||||||
\$CONFIG['logout_url'] = 'https://'.\$main_domain.'/yunohost/sso/?action=logout';
|
\$CONFIG['logout_url'] = 'https://'.\$main_domain.'/yunohost/sso/?action=logout';
|
||||||
//-YunoHost-
|
//-YunoHost-
|
||||||
" >> "${final_path}/config/config.php"
|
" >> "$final_path/config/config.php"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHANGE HOSTNAME FOR ACTIVITY NOTIFICATIONS
|
# CHANGE HOSTNAME FOR ACTIVITY NOTIFICATIONS
|
||||||
|
@ -275,6 +289,18 @@ ynh_replace_string "'overwrite.cli.url' => 'http://localhost'," "'overwrite.cli.
|
||||||
# MOUNT HOME FOLDERS AS EXTERNAL STORAGE
|
# MOUNT HOME FOLDERS AS EXTERNAL STORAGE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
# Define a function to add an external storage
|
||||||
|
# Create the external storage for the given folders and enable sharing
|
||||||
|
create_external_storage() {
|
||||||
|
local datadir="$1"
|
||||||
|
local mount_name="$2"
|
||||||
|
local mount_id=`exec_occ files_external:create --output=json \
|
||||||
|
"$mount_name" 'local' 'null::null' -c "datadir=$datadir" || true`
|
||||||
|
! [[ $mount_id =~ ^[0-9]+$ ]] \
|
||||||
|
&& echo "Unable to create external storage" >&2 \
|
||||||
|
|| exec_occ files_external:option "$mount_id" enable_sharing true
|
||||||
|
}
|
||||||
|
|
||||||
# Enable External Storage and create local mount to home folder as needed
|
# Enable External Storage and create local mount to home folder as needed
|
||||||
if [ $user_home -eq 1 ]; then
|
if [ $user_home -eq 1 ]; then
|
||||||
exec_occ app:enable files_external
|
exec_occ app:enable files_external
|
||||||
|
@ -283,7 +309,7 @@ if [ $user_home -eq 1 ]; then
|
||||||
|| create_external_storage "/home/\$user" "Home"
|
|| create_external_storage "/home/\$user" "Home"
|
||||||
# Iterate over users to extend their home folder permissions
|
# Iterate over users to extend their home folder permissions
|
||||||
for u in $(ynh_user_list); do
|
for u in $(ynh_user_list); do
|
||||||
setfacl -m g:$app:rwx "/home/$u" || true
|
setfacl --modify g:$app:rwx "/home/$u" || true
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -303,8 +329,8 @@ cp -a ../conf/nextcloud.cron "$cron_path"
|
||||||
chown root: "$cron_path"
|
chown root: "$cron_path"
|
||||||
chmod 644 "$cron_path"
|
chmod 644 "$cron_path"
|
||||||
|
|
||||||
ynh_replace_string "#USER#" "$app" "$cron_path"
|
ynh_replace_string "__USER__" "$app" "$cron_path"
|
||||||
ynh_replace_string "#DESTDIR#" "$final_path" "$cron_path"
|
ynh_replace_string "__DESTDIR__" "$final_path" "$cron_path"
|
||||||
|
|
||||||
exec_occ background:cron
|
exec_occ background:cron
|
||||||
|
|
||||||
|
@ -313,11 +339,12 @@ exec_occ background:cron
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Set system group in hooks
|
# Set system group in hooks
|
||||||
ynh_replace_string "#GROUP#" "$app" ../hooks/post_user_create
|
ynh_replace_string "__GROUP__" "$app" ../hooks/post_user_create
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# YUNOHOST MULTIMEDIA INTEGRATION
|
# YUNOHOST MULTIMEDIA INTEGRATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Updating multimedia directories..."
|
||||||
|
|
||||||
# Build YunoHost multimedia directories
|
# Build YunoHost multimedia directories
|
||||||
ynh_multimedia_build_main_dir
|
ynh_multimedia_build_main_dir
|
||||||
|
@ -336,11 +363,11 @@ ynh_multimedia_addaccess $app
|
||||||
|
|
||||||
# Fix app ownerships & permissions
|
# Fix app ownerships & permissions
|
||||||
chown -R $app: "$final_path" "$datadir"
|
chown -R $app: "$final_path" "$datadir"
|
||||||
find ${final_path}/ -type f -print0 | xargs -0 chmod 0644
|
find $final_path/ -type f -print0 | xargs -0 chmod 0644
|
||||||
find ${final_path}/ -type d -print0 | xargs -0 chmod 0755
|
find $final_path/ -type d -print0 | xargs -0 chmod 0755
|
||||||
find ${datadir}/ -type f -print0 | xargs -0 chmod 0640
|
find $datadir/ -type f -print0 | xargs -0 chmod 0640
|
||||||
find ${datadir}/ -type d -print0 | xargs -0 chmod 0750
|
find $datadir/ -type d -print0 | xargs -0 chmod 0750
|
||||||
chmod 640 "${final_path}/config/config.php"
|
chmod 640 "$final_path/config/config.php"
|
||||||
chmod 755 /home/yunohost.app
|
chmod 755 /home/yunohost.app
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -348,12 +375,13 @@ chmod 755 /home/yunohost.app
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Warn about possible disabled apps
|
# Warn about possible disabled apps
|
||||||
echo "Note that if you've installed some third-parties Nextcloud applications, \
|
ynh_print_warn "Note that if you've installed some third-parties Nextcloud applications, \
|
||||||
they are probably disabled and you'll have to manually enable them again." >&2
|
they are probably disabled and you'll have to manually enable them again."
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP LOGROTATE
|
# SETUP LOGROTATE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Upgrading logrotate configuration..."
|
||||||
|
|
||||||
# Use logrotate to manage app-specific logfile(s)
|
# Use logrotate to manage app-specific logfile(s)
|
||||||
ynh_use_logrotate --non-append
|
ynh_use_logrotate --non-append
|
||||||
|
@ -363,6 +391,7 @@ ynh_use_logrotate --non-append
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SSOWAT
|
# SETUP SSOWAT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Upgrading SSOwat configuration..."
|
||||||
|
|
||||||
ynh_app_setting_set $app unprotected_uris "/"
|
ynh_app_setting_set $app unprotected_uris "/"
|
||||||
ynh_app_setting_set $app skipped_regex \
|
ynh_app_setting_set $app skipped_regex \
|
||||||
|
@ -371,6 +400,7 @@ ynh_app_setting_set $app skipped_regex \
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Reloading nginx web server..."
|
||||||
|
|
||||||
systemctl reload nginx
|
systemctl reload nginx
|
||||||
|
|
||||||
|
@ -380,10 +410,10 @@ systemctl reload nginx
|
||||||
|
|
||||||
if [ $migration_process -eq 1 ]
|
if [ $migration_process -eq 1 ]
|
||||||
then
|
then
|
||||||
echo "ownCloud has been successfully migrated to Nextcloud! \
|
ynh_print_info "ownCloud has been successfully migrated to Nextcloud! \
|
||||||
A last scheduled operation will run in a couple of minutes to finish the \
|
A last scheduled operation will run in a couple of minutes to finish the \
|
||||||
migration in YunoHost side. Do not proceed any application operation while \
|
migration in YunoHost side. Do not proceed any application operation while \
|
||||||
you don't see Nextcloud as installed." >&2
|
you don't see Nextcloud as installed."
|
||||||
|
|
||||||
# Execute a post migration script after the end of this upgrade.
|
# Execute a post migration script after the end of this upgrade.
|
||||||
# Mainly for some cleaning
|
# Mainly for some cleaning
|
||||||
|
@ -394,3 +424,9 @@ you don't see Nextcloud as installed." >&2
|
||||||
chmod +x /tmp/$script_post_migration
|
chmod +x /tmp/$script_post_migration
|
||||||
(cd /tmp; echo "/tmp/$script_post_migration > /tmp/$script_post_migration.log 2>&1" | at now + 2 minutes)
|
(cd /tmp; echo "/tmp/$script_post_migration > /tmp/$script_post_migration.log 2>&1" | at now + 2 minutes)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# END OF SCRIPT
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_print_info "Upgrade of $app completed"
|
||||||
|
|
Loading…
Add table
Reference in a new issue