mirror of
https://github.com/YunoHost-Apps/radicale_ynh.git
synced 2024-09-03 20:16:14 +02:00
apply last example_ynh
This commit is contained in:
parent
21b5079179
commit
106fce020b
23 changed files with 648 additions and 589 deletions
55
.github/ISSUE_TEMPLATE.md
vendored
Normal file
55
.github/ISSUE_TEMPLATE.md
vendored
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
---
|
||||||
|
name: Bug report
|
||||||
|
about: When creating a bug report, please use the following template to provide all the relevant information and help debugging efficiently.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**How to post a meaningful bug report**
|
||||||
|
1. *Read this whole template first.*
|
||||||
|
2. *Determine if you are on the right place:*
|
||||||
|
- *If you were performing an action on the app from the webadmin or the CLI (install, update, backup, restore, change_url...), you are on the right place!*
|
||||||
|
- *Otherwise, the issue may be due to the app itself. Refer to its documentation or repository for help.*
|
||||||
|
- *When in doubt, post here and we will figure it out together.*
|
||||||
|
3. *Delete the italic comments as you write over them below, and remove this guide.*
|
||||||
|
---
|
||||||
|
|
||||||
|
### Describe the bug
|
||||||
|
|
||||||
|
*A clear and concise description of what the bug is.*
|
||||||
|
|
||||||
|
### Context
|
||||||
|
|
||||||
|
- Hardware: *VPS bought online / Old laptop or computer / Raspberry Pi at home / Internet Cube with VPN / Other ARM board / ...*
|
||||||
|
- YunoHost version: x.x.x
|
||||||
|
- I have access to my server: *Through SSH | through the webadmin | direct access via keyboard / screen | ...*
|
||||||
|
- Are you in a special context or did you perform some particular tweaking on your YunoHost instance?: *no / yes*
|
||||||
|
- If yes, please explain:
|
||||||
|
- Using, or trying to install package version/branch:
|
||||||
|
- If upgrading, current package version: *can be found in the admin, or with `yunohost app info $app_id`*
|
||||||
|
|
||||||
|
### Steps to reproduce
|
||||||
|
|
||||||
|
- *If you performed a command from the CLI, the command itself is enough. For example:*
|
||||||
|
```sh
|
||||||
|
sudo yunohost app install the_app
|
||||||
|
```
|
||||||
|
- *If you used the webadmin, please perform the equivalent command from the CLI first.*
|
||||||
|
- *If the error occurs in your browser, explain what you did:*
|
||||||
|
1. *Go to '...'*
|
||||||
|
2. *Click on '...'*
|
||||||
|
3. *Scroll down to '...'*
|
||||||
|
4. *See error*
|
||||||
|
|
||||||
|
### Expected behavior
|
||||||
|
|
||||||
|
*A clear and concise description of what you expected to happen. You can remove this section if the command above is enough to understand your intent.*
|
||||||
|
|
||||||
|
### Logs
|
||||||
|
|
||||||
|
*When an operation fails, YunoHost provides a simple way to share the logs.*
|
||||||
|
- *In the webadmin, the error message contains a link to the relevant log page. On that page, you will be able to 'Share with Yunopaste'. If you missed it, the logs of previous operations are also available under Tools > Logs.*
|
||||||
|
- *In command line, the command to share the logs is displayed at the end of the operation and looks like `yunohost log display [log name] --share`. If you missed it, you can find the log ID of a previous operation using `yunohost log list`.*
|
||||||
|
|
||||||
|
*After sharing the log, please copypaste directly the link provided by YunoHost (to help readability, no need to copypaste the entire content of the log here, just the link is enough...)*
|
||||||
|
|
||||||
|
*If applicable and useful, add screenshots to help explain your problem.*
|
16
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
16
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
## Problem
|
||||||
|
|
||||||
|
- *Description of why you made this PR*
|
||||||
|
|
||||||
|
## Solution
|
||||||
|
|
||||||
|
- *And how do you fix that problem*
|
||||||
|
|
||||||
|
## PR Status
|
||||||
|
|
||||||
|
- [ ] Code finished and ready to be reviewed/tested
|
||||||
|
- [ ] The fix/enhancement were manually tested (if applicable)
|
||||||
|
|
||||||
|
## Automatic tests
|
||||||
|
|
||||||
|
Automatic tests can be triggered on https://ci-apps-dev.yunohost.org/ *after creating the PR*, by commenting "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!". (N.B. : for this to work you need to be a member of the Yunohost-Apps organization)
|
|
@ -2,9 +2,9 @@
|
||||||
; Manifest
|
; Manifest
|
||||||
domain="domain.tld"
|
domain="domain.tld"
|
||||||
path="/path"
|
path="/path"
|
||||||
|
language="French"
|
||||||
admin="john"
|
admin="john"
|
||||||
infcloud=1
|
infcloud=1
|
||||||
language="French"
|
|
||||||
; Checks
|
; Checks
|
||||||
pkg_linter=1
|
pkg_linter=1
|
||||||
setup_sub_dir=1
|
setup_sub_dir=1
|
||||||
|
@ -23,9 +23,9 @@
|
||||||
; Manifest
|
; Manifest
|
||||||
domain="domain.tld"
|
domain="domain.tld"
|
||||||
path="/path"
|
path="/path"
|
||||||
|
language="French"
|
||||||
admin="john"
|
admin="john"
|
||||||
infcloud=0
|
infcloud=0
|
||||||
language="French"
|
|
||||||
; Checks
|
; Checks
|
||||||
setup_sub_dir=1
|
setup_sub_dir=1
|
||||||
setup_root=1
|
setup_root=1
|
||||||
|
@ -33,7 +33,10 @@
|
||||||
setup_private=0
|
setup_private=0
|
||||||
setup_public=0
|
setup_public=0
|
||||||
upgrade=1
|
upgrade=1
|
||||||
|
# 1.1.1
|
||||||
upgrade=1 from_commit=3be74eb1ebd9da9b13f9080fd7aa0e535ab09192
|
upgrade=1 from_commit=3be74eb1ebd9da9b13f9080fd7aa0e535ab09192
|
||||||
|
# 1.1.6~ynh5
|
||||||
|
upgrade=1 from_commit=21b5079179979dbe53e2c916df175f19f24c74ab
|
||||||
backup_restore=1
|
backup_restore=1
|
||||||
multi_instance=0
|
multi_instance=0
|
||||||
port_already_use=0
|
port_already_use=0
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
dns_lookup = True
|
dns_lookup = True
|
||||||
|
|
||||||
# Root URL of Radicale (starting and ending with a slash)
|
# Root URL of Radicale (starting and ending with a slash)
|
||||||
base_prefix = __PATH__/
|
base_prefix = __PATH__
|
||||||
|
|
||||||
# Possibility to allow URLs cleaned by a HTTP server, without the base_prefix
|
# Possibility to allow URLs cleaned by a HTTP server, without the base_prefix
|
||||||
#can_skip_base_prefix = False
|
#can_skip_base_prefix = False
|
||||||
|
|
|
@ -332,7 +332,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
// port, ... (client installed into Davical "htdocs" subdirectory;
|
// port, ... (client installed into Davical "htdocs" subdirectory;
|
||||||
// works "out of the box", no additional setup required):
|
// works "out of the box", no additional setup required):
|
||||||
var globalNetworkCheckSettings={
|
var globalNetworkCheckSettings={
|
||||||
href: 'https://__DOMAIN____PATH__/',
|
href: 'https://__DOMAIN____PATH__',
|
||||||
hrefLabel: null,
|
hrefLabel: null,
|
||||||
crossDomain: null,
|
crossDomain: null,
|
||||||
additionalResources: [],
|
additionalResources: [],
|
||||||
|
@ -474,7 +474,7 @@ var globalEnableKbNavigation=true;
|
||||||
// uk_UA (Українська [Ukrainian]; thanks Serge Yakimchuck)
|
// uk_UA (Українська [Ukrainian]; thanks Serge Yakimchuck)
|
||||||
// zh_CN (中国 [Chinese]; thanks Fandy)
|
// zh_CN (中国 [Chinese]; thanks Fandy)
|
||||||
// Example:
|
// Example:
|
||||||
var globalInterfaceLanguage='__LANG__';
|
var globalInterfaceLanguage='__LANGUAGE__';
|
||||||
|
|
||||||
|
|
||||||
// globalInterfaceCustomLanguages
|
// globalInterfaceCustomLanguages
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
location __PATH__ {
|
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
|
||||||
|
location __PATH__/ {
|
||||||
try_files $uri @radicale;
|
try_files $uri @radicale;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,8 +27,6 @@ group = __USER__
|
||||||
; Valid syntaxes are:
|
; Valid syntaxes are:
|
||||||
; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific IPv4 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
|
|
||||||
; specific port;
|
|
||||||
; '[ip:6:addr:ess]:port' - to listen on a TCP socket to a specific IPv6 address on
|
; '[ip:6:addr:ess]:port' - to listen on a TCP socket to a specific IPv6 address on
|
||||||
; a specific port;
|
; a specific port;
|
||||||
; 'port' - to listen on a TCP socket to all addresses
|
; 'port' - to listen on a TCP socket to all addresses
|
||||||
|
@ -49,7 +47,6 @@ group = __USER__
|
||||||
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
|
; When POSIX Access Control Lists are supported you can set them using
|
||||||
; these options, value is a comma separated list of user/group names.
|
; these options, value is a comma separated list of user/group names.
|
||||||
; When set, listen.owner and listen.group are ignored
|
; When set, listen.owner and listen.group are ignored
|
||||||
|
@ -420,3 +417,14 @@ chdir = __FINALPATH__
|
||||||
;php_admin_value[error_log] = /var/log/fpm-php.www.log
|
;php_admin_value[error_log] = /var/log/fpm-php.www.log
|
||||||
;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
|
||||||
|
|
0
doc/.gitkeep
Normal file
0
doc/.gitkeep
Normal file
1
doc/DESCRIPTION.md
Normal file
1
doc/DESCRIPTION.md
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Radicale is a small but powerful CalDAV (calendars, todo-lists) and CardDAV (contacts) server.
|
1
doc/DESCRIPTION_fr.md
Normal file
1
doc/DESCRIPTION_fr.md
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Radicale est un petit mais puissant serveur CalDAV (calendriers, listes de tâches) et CardDAV (contacts).
|
19
doc/DISCLAIMER.md
Normal file
19
doc/DISCLAIMER.md
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
Use the file `/etc/radicale/config` to change the main configuration of radicale.
|
||||||
|
The file `/etc/radicale/logging` to change the level of logging.
|
||||||
|
And the file `/etc/radicale/rights` to edit the way the calendars will be sharing.
|
||||||
|
|
||||||
|
InfCloud has its own config file, at /var/www/radicale/infcloud/config.js
|
||||||
|
|
||||||
|
## YunoHost specific features
|
||||||
|
|
||||||
|
* This package bring a web interface for Radicale named InfCloud.
|
||||||
|
|
||||||
|
#### Multi-users support
|
||||||
|
|
||||||
|
Supported, with LDAP and SSO only with radicale, not for InfCloud.
|
||||||
|
|
||||||
|
## Limitations
|
||||||
|
|
||||||
|
* The version 1.1.6 is relatively old. There's a version 2 of radicale, but this new version dos not support LDAP yet.
|
19
doc/DISCLAIMER_fr.md
Normal file
19
doc/DISCLAIMER_fr.md
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
Utilisez le fichier `/etc/radicale/config` pour modifier la configuration principale de radicale.
|
||||||
|
Le fichier `/etc/radicale/logging` pour changer le niveau de journalisation.
|
||||||
|
Et le fichier `/etc/radicale/rights` pour éditer la façon dont les calendriers seront partagés.
|
||||||
|
|
||||||
|
InfCloud a son propre fichier de config, à /var/www/radicale/infcloud/config.js
|
||||||
|
|
||||||
|
## Fonctionnalités spécifiques à YunoHost
|
||||||
|
|
||||||
|
* Ce package propose une interface web pour radicale nommée InfCloud.
|
||||||
|
|
||||||
|
#### Support multi-utilisateurs
|
||||||
|
|
||||||
|
Supportée, avec LDAP et SSO seulement avec radicale, pas pour InfCloud.
|
||||||
|
|
||||||
|
## Limitations
|
||||||
|
|
||||||
|
* La version 1.1.6 est relativement ancienne. Il existe une version 2 de radicale, mais cette nouvelle version ne supporte pas encore ldap.
|
0
doc/screenshots/.gitkeep
Normal file
0
doc/screenshots/.gitkeep
Normal file
|
@ -6,8 +6,14 @@
|
||||||
"en": "CalDAV (calendar) and CardDAV (contact) synchronization server",
|
"en": "CalDAV (calendar) and CardDAV (contact) synchronization server",
|
||||||
"fr": "Serveur de synchronisation CalDAV et CardDAV"
|
"fr": "Serveur de synchronisation CalDAV et CardDAV"
|
||||||
},
|
},
|
||||||
"version": "1.1.6~ynh5",
|
"version": "1.1.6~ynh6",
|
||||||
"url": "http://radicale.org",
|
"url": "http://radicale.org",
|
||||||
|
"upstream": {
|
||||||
|
"license": "GPL-3.0,AGPL-3.0",
|
||||||
|
"website": "http://radicale.org",
|
||||||
|
"admindoc": "https://github.com/Kozea/Radicale/blob/website/pages/user_documentation.rst",
|
||||||
|
"code": "https://github.com/Kozea/Radicale"
|
||||||
|
},
|
||||||
"license": "GPL-3.0,AGPL-3.0",
|
"license": "GPL-3.0,AGPL-3.0",
|
||||||
"maintainer": {
|
"maintainer": {
|
||||||
"name": "",
|
"name": "",
|
||||||
|
@ -37,6 +43,16 @@
|
||||||
"example": "/radicale",
|
"example": "/radicale",
|
||||||
"default": "/radicale"
|
"default": "/radicale"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "language",
|
||||||
|
"type": "string",
|
||||||
|
"ask": {
|
||||||
|
"en": "Choose your interface language",
|
||||||
|
"fr": "Choisissez la langue de l'interface"
|
||||||
|
},
|
||||||
|
"choices" : ["Czech", "Danish", "German", "English/US", "Spanish", "French", "Italian", "Japan", "Hungarian", "Dutch", "Slovak", "Turkish", "Russian", "Ukrainian", "Chinese"],
|
||||||
|
"default" : "English/US"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "admin",
|
"name": "admin",
|
||||||
"type": "user"
|
"type": "user"
|
||||||
|
@ -49,16 +65,6 @@
|
||||||
"fr": "Installer l'interface web InfCloud?"
|
"fr": "Installer l'interface web InfCloud?"
|
||||||
},
|
},
|
||||||
"default": true
|
"default": true
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "language",
|
|
||||||
"type": "string",
|
|
||||||
"ask": {
|
|
||||||
"en": "Choose your interface language",
|
|
||||||
"fr": "Choisissez la langue de l'interface"
|
|
||||||
},
|
|
||||||
"choices" : ["Czech", "Danish", "German", "English/US", "Spanish", "French", "Italian", "Japan", "Hungarian", "Dutch", "Slovak", "Turkish", "Russian", "Ukrainian", "Chinese"],
|
|
||||||
"default" : "English/US"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,14 +8,6 @@ YNH_PHP_VERSION="7.3"
|
||||||
|
|
||||||
pkg_dependencies="python-pip python-virtualenv virtualenv python-dev libldap2-dev libsasl2-dev libssl-dev uwsgi uwsgi-plugin-python"
|
pkg_dependencies="python-pip python-virtualenv virtualenv python-dev libldap2-dev libsasl2-dev libssl-dev uwsgi uwsgi-plugin-python"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# PACKAGE CHECK BYPASSING...
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
IS_PACKAGE_CHECK () {
|
|
||||||
return $(env | grep -c container=lxc)
|
|
||||||
}
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BOOLEAN CONVERTER
|
# BOOLEAN CONVERTER
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -263,72 +255,6 @@ ynh_maintenance_mode_OFF () {
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Download and check integrity of a file from app.src_file
|
|
||||||
#
|
|
||||||
# The file conf/app.src_file need to contains:
|
|
||||||
#
|
|
||||||
# FILE_URL=Address to download the file
|
|
||||||
# FILE_SUM=Control sum
|
|
||||||
# # (Optional) Program to check the integrity (sha256sum, md5sum...)
|
|
||||||
# # default: sha256
|
|
||||||
# FILE_SUM_PRG=sha256
|
|
||||||
# # (Optionnal) Name of the local archive (offline setup support)
|
|
||||||
# # default: Name of the downloaded file.
|
|
||||||
# FILENAME=example.deb
|
|
||||||
#
|
|
||||||
# usage: ynh_download_file --dest_dir="/destination/directory" [--source_id=myfile]
|
|
||||||
# | arg: -d, --dest_dir= - Directory where to download the file
|
|
||||||
# | arg: -s, --source_id= - Name of the source file 'app.src_file' if it isn't '$app'
|
|
||||||
ynh_download_file () {
|
|
||||||
# Declare an array to define the options of this helper.
|
|
||||||
declare -Ar args_array=( [d]=dest_dir= [s]=source_id= )
|
|
||||||
local dest_dir
|
|
||||||
local source_id
|
|
||||||
# Manage arguments with getopts
|
|
||||||
ynh_handle_getopts_args "$@"
|
|
||||||
|
|
||||||
source_id=${source_id:-app} # If the argument is not given, source_id equals "$app"
|
|
||||||
|
|
||||||
# Load value from configuration file (see above for a small doc about this file
|
|
||||||
# format)
|
|
||||||
local src_file="$YNH_CWD/../conf/${source_id}.src_file"
|
|
||||||
# If the src_file doesn't exist, use the backup path instead, with a "settings" directory
|
|
||||||
if [ ! -e "$src_file" ]
|
|
||||||
then
|
|
||||||
src_file="$YNH_CWD/../settings/conf/${source_id}.src_file"
|
|
||||||
fi
|
|
||||||
local file_url=$(grep 'FILE_URL=' "$src_file" | cut -d= -f2-)
|
|
||||||
local file_sum=$(grep 'FILE_SUM=' "$src_file" | cut -d= -f2-)
|
|
||||||
local file_sumprg=$(grep 'FILE_SUM_PRG=' "$src_file" | cut -d= -f2-)
|
|
||||||
local filename=$(grep 'FILENAME=' "$src_file" | cut -d= -f2-)
|
|
||||||
|
|
||||||
# Default value
|
|
||||||
file_sumprg=${file_sumprg:-sha256sum}
|
|
||||||
if [ "$filename" = "" ] ; then
|
|
||||||
filename="$(basename "$file_url")"
|
|
||||||
fi
|
|
||||||
local local_src="/opt/yunohost-apps-src/${YNH_APP_ID}/${filename}"
|
|
||||||
|
|
||||||
if test -e "$local_src"
|
|
||||||
then # Use the local source file if it is present
|
|
||||||
cp $local_src $filename
|
|
||||||
else # If not, download the source
|
|
||||||
local out=`wget -nv -O $filename $file_url 2>&1` || ynh_print_err $out
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Check the control sum
|
|
||||||
echo "${file_sum} ${filename}" | ${file_sumprg} -c --status \
|
|
||||||
|| ynh_die "Corrupt file"
|
|
||||||
|
|
||||||
# Create the destination directory, if it's not already.
|
|
||||||
mkdir -p "$dest_dir"
|
|
||||||
|
|
||||||
# Move the file to its destination
|
|
||||||
mv $filename $dest_dir
|
|
||||||
}
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Create a changelog for an app after an upgrade.
|
# Create a changelog for an app after an upgrade.
|
||||||
#
|
#
|
||||||
# The changelog is printed into the file ./changelog for the time of the upgrade.
|
# The changelog is printed into the file ./changelog for the time of the upgrade.
|
||||||
|
|
|
@ -36,7 +36,7 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
# INSTALL OR REMOVE INFCLOUD
|
# INSTALL OR REMOVE INFCLOUD
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="$action_print InfCloud." --weight=9
|
ynh_script_progression --message="$action_print InfCloud."
|
||||||
|
|
||||||
if [ $infcloud -eq 1 ]
|
if [ $infcloud -eq 1 ]
|
||||||
then
|
then
|
||||||
|
@ -177,4 +177,4 @@ ynh_app_setting_set $app infcloud $infcloud
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Execution completed" --last
|
ynh_script_progression --message="Execution completed"
|
||||||
|
|
|
@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
# RETRIEVE ARGUMENTS
|
# RETRIEVE ARGUMENTS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Retrieve arguments from the manifest" --weight=3
|
ynh_script_progression --message="Retrieve arguments from the manifest"
|
||||||
|
|
||||||
app=${YNH_APP_INSTANCE_NAME:-$YNH_APP_ID}
|
app=${YNH_APP_INSTANCE_NAME:-$YNH_APP_ID}
|
||||||
final_path=$(ynh_app_setting_get $app final_path)
|
final_path=$(ynh_app_setting_get $app final_path)
|
||||||
|
@ -50,7 +50,7 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESET THE CONFIG FILE
|
# RESET THE CONFIG FILE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Reset the config file $config_file" --weight=9
|
ynh_script_progression --message="Reset the config file $config_file"
|
||||||
|
|
||||||
# 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 "$config_file"
|
ynh_backup_if_checksum_is_different "$config_file"
|
||||||
|
@ -146,7 +146,7 @@ fi
|
||||||
# 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 "$config_file"
|
ynh_store_file_checksum "$config_file"
|
||||||
|
|
||||||
ynh_script_progression --message="Restart Radicale" --weight=2
|
ynh_script_progression --message="Restart Radicale"
|
||||||
|
|
||||||
# Restart uwsgi to restart radicale
|
# Restart uwsgi to restart radicale
|
||||||
ynh_systemd_action --action=restart --service_name=uwsgi
|
ynh_systemd_action --action=restart --service_name=uwsgi
|
||||||
|
@ -155,4 +155,4 @@ ynh_systemd_action --action=restart --service_name=uwsgi
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Execution completed" --last
|
ynh_script_progression --message="Execution completed"
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
# IMPORT GENERIC HELPERS
|
# IMPORT GENERIC HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
||||||
source ../settings/scripts/_common.sh
|
source ../settings/scripts/_common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
@ -13,6 +14,9 @@ source /usr/share/yunohost/helpers
|
||||||
# MANAGE SCRIPT FAILURE
|
# MANAGE SCRIPT FAILURE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
ynh_clean_setup () {
|
||||||
|
true
|
||||||
|
}
|
||||||
# Exit if an error occurs during the execution of the script
|
# Exit if an error occurs during the execution of the script
|
||||||
ynh_abort_if_errors
|
ynh_abort_if_errors
|
||||||
|
|
||||||
|
@ -23,10 +27,10 @@ ynh_print_info --message="Loading installation settings..."
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
final_path=$(ynh_app_setting_get $app final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
domain=$(ynh_app_setting_get $app domain)
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||||
infcloud=$(ynh_app_setting_get $app infcloud)
|
|
||||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||||
|
infcloud=$(ynh_app_setting_get --app=$app --key=infcloud)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DECLARE DATA AND CONF FILES TO BACKUP
|
# DECLARE DATA AND CONF FILES TO BACKUP
|
||||||
|
@ -37,47 +41,46 @@ ynh_print_info --message="Declaring files to be backed up..."
|
||||||
# BACKUP THE APP MAIN DIR
|
# BACKUP THE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_backup "$final_path"
|
ynh_backup --src_path="$final_path"
|
||||||
|
ynh_backup --src_path="/opt/yunohost/$app"
|
||||||
ynh_backup "/opt/yunohost/$app"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP NGINX CONFIGURATION
|
# BACKUP THE NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
|
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP PHP-FPM CONFIGURATION
|
# BACKUP THE PHP-FPM CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
if [ $infcloud -eq 1 ]
|
if [ $infcloud -eq 1 ]
|
||||||
then
|
then
|
||||||
ynh_backup "/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC BACKUP
|
# SPECIFIC BACKUP
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP UWSGI CONFIG
|
# BACKUP LOGROTATE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_backup "/etc/uwsgi/apps-available/radicale.ini"
|
ynh_backup --src_path="/etc/logrotate.d/$app"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP RADICALE CONFIGURATION
|
# BACKUP SYSTEMD
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_backup "/etc/$app"
|
ynh_backup --src_path="/etc/uwsgi/apps-available/radicale.ini"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP LOGROTATE CONFIGURATION
|
# BACKUP VARIOUS FILES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_backup "/etc/logrotate.d/$app"
|
ynh_backup --src_path="/etc/$app/"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_print_info --message="Backup script completed. Please wait for YunoHost to create the backup."
|
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
|
||||||
|
|
|
@ -12,7 +12,6 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
# RETRIEVE ARGUMENTS
|
# RETRIEVE ARGUMENTS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Retrieve arguments from the manifest"
|
|
||||||
|
|
||||||
old_domain=$YNH_APP_OLD_DOMAIN
|
old_domain=$YNH_APP_OLD_DOMAIN
|
||||||
old_path=$YNH_APP_OLD_PATH
|
old_path=$YNH_APP_OLD_PATH
|
||||||
|
@ -25,26 +24,12 @@ app=$YNH_APP_INSTANCE_NAME
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Load settings" --weight=2
|
ynh_script_progression --message="Loading installation settings..."
|
||||||
|
|
||||||
infcloud=$(ynh_app_setting_get $app infcloud)
|
# Needed for helper "ynh_add_nginx_config"
|
||||||
final_path=$(ynh_app_setting_get $app final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
|
|
||||||
#=================================================
|
infcloud=$(ynh_app_setting_get --app=$app --key=infcloud)
|
||||||
# CHECK THE SYNTAX OF THE PATHS
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Check the syntax of the paths"
|
|
||||||
|
|
||||||
# Remove /infcloud in $old_path
|
|
||||||
if [ $infcloud -eq 1 ]
|
|
||||||
then
|
|
||||||
old_path="${old_path%/infcloud}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
test -n "$old_path" || old_path="/"
|
|
||||||
test -n "$new_path" || new_path="/"
|
|
||||||
new_path=$(ynh_normalize_url_path $new_path)
|
|
||||||
old_path=$(ynh_normalize_url_path $old_path)
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ACTIVATE MAINTENANCE MODE
|
# ACTIVATE MAINTENANCE MODE
|
||||||
|
@ -55,6 +40,24 @@ path_url=$old_path
|
||||||
domain=$old_domain
|
domain=$old_domain
|
||||||
ynh_maintenance_mode_ON
|
ynh_maintenance_mode_ON
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# 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
|
# CHECK WHICH PARTS SHOULD BE CHANGED
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -71,48 +74,35 @@ then
|
||||||
change_path=1
|
change_path=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# MANAGE FAILURE OF THE SCRIPT
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Exit if an error occurs during the execution of the script
|
|
||||||
ynh_abort_if_errors
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD MODIFICATIONS
|
# STANDARD MODIFICATIONS
|
||||||
#=================================================
|
#=================================================
|
||||||
# MODIFY URL IN NGINX CONF
|
# MODIFY URL IN NGINX CONF
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Modify url in nginx configuration" --weight=2
|
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 path in the nginx config file
|
# Change the path in the NGINX config file
|
||||||
if [ $change_path -eq 1 ]
|
if [ $change_path -eq 1 ]
|
||||||
then
|
then
|
||||||
# Make a backup of the original nginx config file if modified
|
# Make a backup of the original NGINX config file if modified
|
||||||
ynh_backup_if_checksum_is_different "$nginx_conf_path"
|
ynh_backup_if_checksum_is_different --file="$nginx_conf_path"
|
||||||
|
# Set global variables for NGINX helper
|
||||||
# Set global variables for nginx helper
|
|
||||||
domain="$old_domain"
|
domain="$old_domain"
|
||||||
path_url="$new_path"
|
path_url="$new_path"
|
||||||
|
# Create a dedicated NGINX config
|
||||||
# Store path_url setting
|
|
||||||
ynh_app_setting_set $app path_url "$path_url"
|
|
||||||
|
|
||||||
# Create a dedicated nginx config
|
|
||||||
ynh_add_nginx_config
|
ynh_add_nginx_config
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Change the domain for nginx
|
# Change the domain for NGINX
|
||||||
if [ $change_domain -eq 1 ]
|
if [ $change_domain -eq 1 ]
|
||||||
then
|
then
|
||||||
# Delete file checksum for the old conf file location
|
# Delete file checksum for the old conf file location
|
||||||
ynh_delete_file_checksum "$nginx_conf_path"
|
ynh_delete_file_checksum --file="$nginx_conf_path"
|
||||||
mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
|
mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
|
||||||
|
|
||||||
# Store file checksum for the new config file location
|
# Store file checksum for the new config file location
|
||||||
ynh_store_file_checksum "/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -120,11 +110,10 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
# MODIFY CONFIG FILES
|
# MODIFY CONFIG FILES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_replace_string --match_string="^base_prefix = $old_path.*" --replace_string="base_prefix = ${new_path%/}/" --target_file="/etc/$app/config"
|
||||||
ynh_replace_string "^base_prefix = $old_path.*" "base_prefix = ${new_path%/}/" /etc/$app/config
|
|
||||||
|
|
||||||
if [ $infcloud -eq 1 ]; then
|
if [ $infcloud -eq 1 ]; then
|
||||||
ynh_replace_string "href: 'https://$old_domain$old_path'," "href: 'https://$new_domain${new_path%/}/'," "$final_path/infcloud/config.js"
|
ynh_replace_string --match_string="href: 'https://$old_domain$old_path'," --replace_string="href: 'https://$new_domain${new_path%/}/'," --target_file="$final_path/infcloud/config.js"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -138,29 +127,30 @@ then
|
||||||
echo "sudo yunohost --verbose app setting $app path -v \"${new_path%/}/infcloud\"; sudo yunohost app ssowatconf" | at now + 1 min >&2
|
echo "sudo yunohost --verbose app setting $app path -v \"${new_path%/}/infcloud\"; sudo yunohost app ssowatconf" | at now + 1 min >&2
|
||||||
domain_regex=$(echo "$new_domain" | sed 's@-@.@g')
|
domain_regex=$(echo "$new_domain" | sed 's@-@.@g')
|
||||||
# Radicale is always accessible (For access to ressources)
|
# Radicale is always accessible (For access to ressources)
|
||||||
ynh_app_setting_set $app skipped_regex "$domain_regex$new_path"
|
ynh_app_setting_set --app=$app --key=skipped_regex --value="$domain_regex$new_path"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RESTART UWSGI
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Restart Radicale" --weight=2
|
|
||||||
|
|
||||||
ynh_systemd_action --action=restart --service_name=uwsgi
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALISATION
|
# GENERIC FINALISATION
|
||||||
|
#=================================================
|
||||||
|
# START SYSTEMD SERVICE
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Starting a systemd service..."
|
||||||
|
|
||||||
|
# Start a systemd service
|
||||||
|
ynh_systemd_action --service_name=uwsgi --action="restart"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Reload nginx"
|
ynh_script_progression --message="Reloading NGINX web server..."
|
||||||
|
|
||||||
ynh_systemd_action --action=reload --service_name=nginx
|
ynh_systemd_action --service_name=nginx --action=reload
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DEACTIVE MAINTENANCE MODE
|
# DEACTIVE MAINTENANCE MODE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Disable maintenance mode" --weight=4
|
ynh_script_progression --message="Disable maintenance mode"
|
||||||
|
|
||||||
path_url=$old_path
|
path_url=$old_path
|
||||||
domain=$old_domain
|
domain=$old_domain
|
||||||
|
@ -170,4 +160,4 @@ ynh_maintenance_mode_OFF
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Change of URL completed" --last
|
ynh_script_progression --message="Change of URL completed for $app"
|
||||||
|
|
296
scripts/install
296
scripts/install
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC STARTING
|
# GENERIC START
|
||||||
#=================================================
|
#=================================================
|
||||||
# IMPORT GENERIC HELPERS
|
# IMPORT GENERIC HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -10,22 +10,24 @@ source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# MANAGE FAILURE OF THE SCRIPT
|
# 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
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Retrieve arguments from the manifest"
|
|
||||||
|
|
||||||
domain=$YNH_APP_ARG_DOMAIN
|
domain=$YNH_APP_ARG_DOMAIN
|
||||||
path_url=$YNH_APP_ARG_PATH
|
path_url=$YNH_APP_ARG_PATH
|
||||||
|
language=$YNH_APP_ARG_LANGUAGE
|
||||||
admin=$YNH_APP_ARG_ADMIN
|
admin=$YNH_APP_ARG_ADMIN
|
||||||
infcloud=$YNH_APP_ARG_INFCLOUD
|
infcloud=$YNH_APP_ARG_INFCLOUD
|
||||||
language=$YNH_APP_ARG_LANGUAGE
|
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
|
@ -33,92 +35,69 @@ app=$YNH_APP_INSTANCE_NAME
|
||||||
version=$(ynh_app_upstream_version)
|
version=$(ynh_app_upstream_version)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK IF THE APP CAN BE INSTALLED WITH THIS ARGS
|
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Check if the app can be installed"
|
ynh_script_progression --message="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 --message="This path already contains a folder"
|
||||||
|
|
||||||
# Register (book) web path
|
# Register (book) web path
|
||||||
ynh_webpath_register $app $domain $path_url
|
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STORE SETTINGS FROM MANIFEST
|
# STORE SETTINGS FROM MANIFEST
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Store settings from manifest" --weight=4
|
ynh_script_progression --message="Storing installation settings..."
|
||||||
|
|
||||||
ynh_app_setting_set $app domain $domain
|
ynh_app_setting_set --app=$app --key=domain --value=$domain
|
||||||
ynh_app_setting_set $app path $path_url
|
ynh_app_setting_set --app=$app --key=path --value=$path_url
|
||||||
ynh_app_setting_set $app admin $admin
|
ynh_app_setting_set --app=$app --key=admin --value=$admin
|
||||||
ynh_app_setting_set $app infcloud $infcloud
|
ynh_app_setting_set --app=$app --key=infcloud --value=$infcloud
|
||||||
ynh_app_setting_set $app version $version
|
ynh_app_setting_set --app=$app --key=version --value=$version
|
||||||
|
|
||||||
ynh_app_setting_set $app overwrite_logging "1"
|
ynh_app_setting_set --app=$app --key=overwrite_logging --value="1"
|
||||||
ynh_app_setting_set $app overwrite_config "1"
|
ynh_app_setting_set --app=$app --key=overwrite_config --value="1"
|
||||||
ynh_app_setting_set $app overwrite_infcloud "1"
|
ynh_app_setting_set --app=$app --key=overwrite_infcloud --value="1"
|
||||||
ynh_app_setting_set $app overwrite_nginx "1"
|
ynh_app_setting_set --app=$app --key=overwrite_nginx --value="1"
|
||||||
ynh_app_setting_set $app overwrite_phpfpm "1"
|
ynh_app_setting_set --app=$app --key=overwrite_phpfpm --value="1"
|
||||||
ynh_app_setting_set $app admin_mail_html "1"
|
ynh_app_setting_set --app=$app --key=admin_mail_html --value="1"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD MODIFICATIONS
|
# STANDARD MODIFICATIONS
|
||||||
#=================================================
|
#=================================================
|
||||||
# INSTALL DEPENDENCIES
|
# INSTALL DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Install dependencies" --weight=25
|
ynh_script_progression --message="Installing dependencies..."
|
||||||
|
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
ynh_install_app_dependencies $pkg_dependencies
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# NGINX CONFIGURATION
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Configure NGINX" --weight=2
|
|
||||||
|
|
||||||
ynh_add_nginx_config
|
|
||||||
if [ $infcloud -eq 1 ]
|
|
||||||
then
|
|
||||||
# Add InfCloud in NGINX config
|
|
||||||
ynh_replace_string "#INFCLOUD#" "" /etc/nginx/conf.d/$domain.d/$app.conf
|
|
||||||
fi
|
|
||||||
ynh_store_file_checksum "/etc/nginx/conf.d/$domain.d/$app.conf"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE DEDICATED USER
|
# CREATE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Create a dedicated user" --weight=2
|
ynh_script_progression --message="Configuring system user..."
|
||||||
|
|
||||||
# Create a dedicated system user
|
# Create a system user
|
||||||
ynh_system_user_create $app
|
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC SETUP
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
# INSTALL RADICALE IN A VIRTUALENV
|
ynh_script_progression --message="Setting up source files..."
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Install Radicale in a virtualenv" --weight=15
|
|
||||||
|
|
||||||
# Init virtualenv
|
|
||||||
virtualenv /opt/yunohost/$app
|
|
||||||
version=$(ynh_app_setting_get $app version $version)
|
|
||||||
/opt/yunohost/$app/bin/pip install radicale==$version python-ldap
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# COPY FILES INTO $FINAL_PATH
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Download, check and unpack source" --weight=2
|
|
||||||
|
|
||||||
|
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||||
# Create the directory and set the path in the config
|
# Create the directory and set the path in the config
|
||||||
mkdir "$final_path"
|
mkdir -p "$final_path/collections"
|
||||||
ynh_app_setting_set $app final_path $final_path
|
|
||||||
|
|
||||||
# Copy files to the right place
|
# Copy files to the right place
|
||||||
mkdir -p $final_path/collections
|
|
||||||
cp ../conf/radicale.wsgi $final_path
|
cp ../conf/radicale.wsgi $final_path
|
||||||
|
|
||||||
# Copy extra files
|
# Copy extra files
|
||||||
cp -a ../sources/extra_files_radicale/. "$final_path"
|
cp -a ../sources/extra_files_radicale/. "$final_path"
|
||||||
|
|
||||||
# regex.py file is patched to fix the awful commit e807c3d35bea9cfcfcacac83b1b17d748ea15a39 that stop the reading of "rights" file after the first match.
|
# regex.py file is patched to fix the awful commit e807c3d35bea9cfcfcacac83b1b17d748ea15a39 that stop the reading of "rights" file after the first match.
|
||||||
mv "$final_path/regex.py" /opt/yunohost/$app/lib/python*/site-packages/radicale/rights/regex.py
|
mv "$final_path/regex.py" /opt/yunohost/$app/lib/python*/site-packages/radicale/rights/regex.py
|
||||||
|
|
||||||
if [ $infcloud -eq 1 ]
|
if [ $infcloud -eq 1 ]
|
||||||
then
|
then
|
||||||
#Instal InfCloud
|
#Instal InfCloud
|
||||||
|
@ -127,26 +106,81 @@ then
|
||||||
# Modify final_path for InfCloud installation
|
# Modify final_path for InfCloud installation
|
||||||
final_path=$final_path/infcloud
|
final_path=$final_path/infcloud
|
||||||
# Download and uncompress the source into final_path
|
# Download and uncompress the source into final_path
|
||||||
ynh_setup_source "$final_path"
|
ynh_setup_source --dest_dir="$final_path"
|
||||||
# Restore the content of $final_path
|
# Restore the content of $final_path
|
||||||
final_path=$final_path_backup
|
final_path=$final_path_backup
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
chmod 750 "$final_path"
|
||||||
|
chmod -R o-rwx "$final_path"
|
||||||
|
chown -R $app:www-data "$final_path"
|
||||||
|
|
||||||
|
# Set default permissions as radicale do.
|
||||||
|
chmod 666 -R $final_path/default_collections
|
||||||
|
chmod 777 $final_path/default_collections $final_path/default_collections/USER
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CONFIGURE RADICALE
|
# NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configure Radicale" --weight=5
|
ynh_script_progression --message="Configuring NGINX web server..."
|
||||||
|
|
||||||
|
# Create a dedicated NGINX config
|
||||||
|
ynh_add_nginx_config
|
||||||
|
|
||||||
|
if [ $infcloud -eq 1 ]
|
||||||
|
then
|
||||||
|
# Add InfCloud in NGINX config
|
||||||
|
ynh_replace_string --match_string="#INFCLOUD#" --replace_string="" --target_file="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
fi
|
||||||
|
ynh_store_file_checksum --file="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# PHP-FPM CONFIGURATION
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
if [ $infcloud -eq 1 ]
|
||||||
|
then
|
||||||
|
ynh_script_progression --message="Configuring PHP-FPM..."
|
||||||
|
|
||||||
|
# Create a dedicated PHP-FPM config
|
||||||
|
ynh_add_fpm_config
|
||||||
|
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||||
|
fi
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SPECIFIC SETUP
|
||||||
|
#=================================================
|
||||||
|
# INSTALL RADICALE IN A VIRTUALENV
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Install Radicale in a virtualenv"
|
||||||
|
|
||||||
|
# Init virtualenv
|
||||||
|
virtualenv /opt/yunohost/$app
|
||||||
|
version=$(ynh_app_setting_get --app=$app --key=version)
|
||||||
|
/opt/yunohost/$app/bin/pip install radicale==$version python-ldap
|
||||||
|
|
||||||
|
# useradd radicale -d /opt/yunohost/$app
|
||||||
|
chown radicale: -R /opt/yunohost/$app
|
||||||
|
|
||||||
|
find /opt/yunohost/$app/ -type d -exec chmod 2755 {} \;
|
||||||
|
find /opt/yunohost/$app/ -type f -exec chmod g+r,o+r {} \;
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# ADD A CONFIGURATION
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Adding a configuration file..."
|
||||||
|
|
||||||
mkdir -p /etc/$app
|
mkdir -p /etc/$app
|
||||||
cp ../conf/config /etc/$app/
|
|
||||||
cp ../conf/logging /etc/$app/
|
ynh_add_config --template="../conf/config" --destination="/etc/$app/config"
|
||||||
cp ../conf/rights /etc/$app/
|
|
||||||
ynh_replace_string "__PATH__" "${path_url%/}" /etc/$app/config
|
ynh_add_config --template="../conf/logging" --destination="/etc/$app/logging"
|
||||||
ynh_replace_string "__FINALPATH__" "$final_path" /etc/$app/config
|
|
||||||
# Calculate and store the config file checksum into the app settings
|
ynh_add_config --template="../conf/rights" --destination="/etc/$app/rights"
|
||||||
ynh_store_file_checksum "/etc/$app/config"
|
|
||||||
# Calculate and store the config file checksum into the app settings
|
chmod 755 /etc/$app/
|
||||||
ynh_store_file_checksum "/etc/$app/logging"
|
chmod 644 /etc/$app/*
|
||||||
|
|
||||||
if [ $infcloud -eq 1 ]
|
if [ $infcloud -eq 1 ]
|
||||||
then
|
then
|
||||||
# InfCloud configuration
|
# InfCloud configuration
|
||||||
|
@ -183,49 +217,18 @@ then
|
||||||
"Chinese") language="zh_CN"
|
"Chinese") language="zh_CN"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
ynh_app_setting_set $app language $language
|
ynh_app_setting_set --app=$app --key=language --value=$language
|
||||||
cp ../conf/config.js "$final_path/infcloud/"
|
timezone=$(cat /etc/timezone)
|
||||||
ynh_replace_string "__DOMAIN__" "$domain" "$final_path/infcloud/config.js"
|
ynh_add_config --template="../conf/config.js" --destination="$final_path/infcloud/config.js"
|
||||||
ynh_replace_string "__PATH__" "${path_url%/}" "$final_path/infcloud/config.js"
|
|
||||||
ynh_replace_string "__LANG__" "$language" "$final_path/infcloud/config.js"
|
chmod 400 "$final_path/infcloud/config.js"
|
||||||
ynh_replace_string "__ADMIN__" "$admin" "$final_path/infcloud/config.js"
|
chown $app:$app "$final_path/infcloud/config.js"
|
||||||
ynh_replace_string "__TIMEZONE__" "$(cat /etc/timezone)" "$final_path/infcloud/config.js"
|
|
||||||
# Calculate and store the config file checksum into the app settings
|
|
||||||
ynh_store_file_checksum "$final_path/infcloud/config.js"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SET PERMISSIONS ON RADICALE'S DIRECTORIES
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# useradd radicale -d /opt/yunohost/$app
|
|
||||||
chown radicale: -R /opt/yunohost/$app
|
|
||||||
|
|
||||||
chown -R radicale: $final_path
|
|
||||||
mkdir -p /var/log/$app
|
|
||||||
touch /var/log/$app/$app.log
|
|
||||||
chown radicale -R /var/log/$app
|
|
||||||
# Set default permissions as radicale do.
|
|
||||||
chmod 666 -R $final_path/default_collections
|
|
||||||
chmod 777 $final_path/default_collections $final_path/default_collections/USER
|
|
||||||
|
|
||||||
# Set permissions
|
|
||||||
chmod 755 /etc/$app/
|
|
||||||
find /opt/yunohost/$app/ -type d -exec chmod 2755 {} \;
|
|
||||||
find /opt/yunohost/$app/ -type f -exec chmod g+r,o+r {} \;
|
|
||||||
chmod 644 /etc/$app/*
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CONFIGURE UWSGI FOR RADICALE
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
cp ../conf/radicale.ini /etc/uwsgi/apps-available/
|
|
||||||
ln -s /etc/uwsgi/apps-available/radicale.ini /etc/uwsgi/apps-enabled/
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERATE CALENDARS AND ADDRESS BOOKS FOR ALL USERS
|
# GENERATE CALENDARS AND ADDRESS BOOKS FOR ALL USERS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Generate calendars and address books for all users" --weight=3
|
ynh_script_progression --message="Generate calendars and address books for all users"
|
||||||
|
|
||||||
# Create default calendars and address books for each users
|
# Create default calendars and address books for each users
|
||||||
while read user
|
while read user
|
||||||
|
@ -235,71 +238,78 @@ do
|
||||||
# List all users and remove the space after username
|
# List all users and remove the space after username
|
||||||
done <<< "$(yunohost user list | grep username | cut -d ":" -f 2 | cut -c 2-)"
|
done <<< "$(yunohost user list | grep username | cut -d ":" -f 2 | cut -c 2-)"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# ADVERTISE SERVICE IN ADMIN PANEL
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Restart Radicale" --weight=2
|
|
||||||
|
|
||||||
ynh_systemd_action --action=restart --service_name=uwsgi
|
|
||||||
yunohost service add uwsgi --log="/var/log/uwsgi/app/radicale.log"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# PREPARE THE HOOKS
|
# PREPARE THE HOOKS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Modify the hooks for create user collections and to remove them.
|
# Modify the hooks for create user collections and to remove them.
|
||||||
ynh_replace_string "__FINALPATH__" "$final_path" ../hooks/post_user_create
|
ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="../hooks/post_user_create"
|
||||||
ynh_replace_string "__FINALPATH__" "$final_path" ../hooks/post_user_delete
|
ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="../hooks/post_user_delete"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALISATION
|
# SETUP SYSTEMD
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SSOWAT
|
ynh_script_progression --message="Configuring a systemd service..."
|
||||||
|
|
||||||
|
cp ../conf/radicale.ini /etc/uwsgi/apps-available/
|
||||||
|
ln -s /etc/uwsgi/apps-available/radicale.ini /etc/uwsgi/apps-enabled/
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Setup SSOwat" --weight=3
|
# GENERIC FINALIZATION
|
||||||
|
|
||||||
if [ $infcloud -eq 1 ]
|
|
||||||
then
|
|
||||||
# Add /infcloud to the path of radicale to access it from the portal
|
|
||||||
# Replace radicale by InfCloud into YunoHost portal
|
|
||||||
ynh_app_setting_set $app path ${path_url%/}/infcloud
|
|
||||||
# Protect InfCloud access
|
|
||||||
ynh_app_setting_set $app protected_uris "/"
|
|
||||||
domain_regex=$(echo "$domain" | sed 's@-@.@g')
|
|
||||||
# Radicale is always accessible (For access to ressources)
|
|
||||||
ynh_app_setting_set $app skipped_regex "$domain_regex$path_url"
|
|
||||||
else
|
|
||||||
# If only radicale is installed
|
|
||||||
# Radicale is always accessible (For access to ressources)
|
|
||||||
ynh_app_setting_set $app unprotected_uris "/"
|
|
||||||
fi
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP LOGROTATE
|
# SETUP LOGROTATE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configure logrotate" --weight=2
|
ynh_script_progression --message="Configuring log rotation..."
|
||||||
|
|
||||||
|
mkdir -p /var/log/$app
|
||||||
|
touch /var/log/$app/$app.log
|
||||||
|
chown radicale -R /var/log/$app
|
||||||
|
|
||||||
# Use logrotate to manage application logfile(s)
|
# Use logrotate to manage application logfile(s)
|
||||||
ynh_use_logrotate
|
ynh_use_logrotate
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# PHP-FPM CONFIGURATION
|
# INTEGRATE SERVICE IN YUNOHOST
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Integrating service in YunoHost..."
|
||||||
|
|
||||||
|
yunohost service add $app --log="/var/log/uwsgi/app/radicale.log"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# START SYSTEMD SERVICE
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Starting a systemd service..."
|
||||||
|
|
||||||
|
# Start a systemd service
|
||||||
|
ynh_systemd_action --service_name=uwsgi --action="restart"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SETUP SSOWAT
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Configuring permissions..."
|
||||||
|
|
||||||
if [ $infcloud -eq 1 ]
|
if [ $infcloud -eq 1 ]
|
||||||
then
|
then
|
||||||
ynh_script_progression --message="Configure PHP-FPM" --weight=4
|
# Add /infcloud to the path of radicale to access it from the portal
|
||||||
# Create a dedicated php-fpm config
|
# Replace radicale by InfCloud into YunoHost portal
|
||||||
ynh_add_fpm_config
|
ynh_app_setting_set --app=$app --key=path --value="${path_url%/}/infcloud"
|
||||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
# Protect InfCloud access
|
||||||
|
ynh_app_setting_set --app=$app --key=protected_uris --value="/"
|
||||||
|
domain_regex=$(echo "$domain" | sed 's@-@.@g')
|
||||||
|
# Radicale is always accessible (For access to ressources)
|
||||||
|
ynh_app_setting_set --app=$app --key=skipped_regex --value="$domain_regex$path_url"
|
||||||
|
else
|
||||||
|
# If only radicale is installed
|
||||||
|
# Radicale is always accessible (For access to ressources)
|
||||||
|
ynh_app_setting_set --app=$app --key=unprotected_uris --value="/"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Reload NGINX" --weight=4
|
ynh_script_progression --message="Reloading NGINX web server..."
|
||||||
|
|
||||||
ynh_systemd_action --action=reload --service_name=nginx
|
ynh_systemd_action --service_name=nginx --action=reload
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SEND A README FOR THE ADMIN
|
# SEND A README FOR THE ADMIN
|
||||||
|
@ -332,4 +342,4 @@ ynh_send_readme_to_admin --app_message="mail_to_send" --recipients="$admin" --ty
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Installation completed" --last
|
ynh_script_progression --message="Installation of $app completed"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC STARTING
|
# GENERIC START
|
||||||
#=================================================
|
#=================================================
|
||||||
# IMPORT GENERIC HELPERS
|
# IMPORT GENERIC HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -12,47 +12,62 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Load settings"
|
ynh_script_progression --message="Loading installation settings..."
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||||
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD REMOVE
|
# STANDARD REMOVE
|
||||||
|
#=================================================
|
||||||
|
# REMOVE SERVICE INTEGRATION IN YUNOHOST
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
|
||||||
|
if ynh_exec_warn_less yunohost service status $app >/dev/null
|
||||||
|
then
|
||||||
|
ynh_script_progression --message="Removing $app service integration..."
|
||||||
|
yunohost service remove $app
|
||||||
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STOP AND REMOVE SERVICE
|
# STOP AND REMOVE SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Stop and remove the service" --weight=3
|
ynh_script_progression --message="Stopping and removing the systemd service..."
|
||||||
|
|
||||||
# Delete uwsgi configuration
|
# Delete uwsgi configuration
|
||||||
ynh_systemd_action --action=stop --service_name=uwsgi
|
|
||||||
if [ -h "/etc/uwsgi/apps-enabled/radicale.ini" ]; then
|
if [ -h "/etc/uwsgi/apps-enabled/radicale.ini" ]; then
|
||||||
echo "Delete uwsgi config"
|
echo "Delete uwsgi config"
|
||||||
ynh_secure_remove "/etc/uwsgi/apps-enabled/radicale.ini"
|
ynh_secure_remove --file="/etc/uwsgi/apps-enabled/radicale.ini"
|
||||||
fi
|
fi
|
||||||
ynh_secure_remove "/etc/uwsgi/apps-available/radicale.ini"
|
|
||||||
|
ynh_secure_remove --file="/etc/uwsgi/apps-available/radicale.ini"
|
||||||
|
|
||||||
|
ynh_systemd_action --action="restart" --service_name=uwsgi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE DEPENDENCIES
|
# REMOVE LOGROTATE CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Remove dependencies" --weight=10
|
ynh_script_progression --message="Removing logrotate configuration..."
|
||||||
|
|
||||||
# Remove metapackage and its dependencies
|
# Remove the app-specific logrotate config
|
||||||
ynh_remove_app_dependencies
|
ynh_remove_logrotate
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE APP MAIN DIR
|
# REMOVE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Remove app main directory"
|
ynh_script_progression --message="Removing app main directory..."
|
||||||
|
|
||||||
ynh_secure_remove "/var/www/$app"
|
# Remove the app directory securely
|
||||||
ynh_secure_remove "/opt/yunohost/$app"
|
ynh_secure_remove --file="$final_path"
|
||||||
|
ynh_secure_remove --file="/opt/yunohost/$app"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE NGINX CONFIGURATION
|
# REMOVE NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Remove NGINX configuration"
|
ynh_script_progression --message="Removing NGINX web server configuration..."
|
||||||
|
|
||||||
# Remove the dedicated NGINX config
|
# Remove the dedicated NGINX config
|
||||||
ynh_remove_nginx_config
|
ynh_remove_nginx_config
|
||||||
|
@ -60,55 +75,41 @@ ynh_remove_nginx_config
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE PHP-FPM CONFIGURATION
|
# REMOVE PHP-FPM CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Remove PHP-FPM configuration" --weight=3
|
ynh_script_progression --message="Removing PHP-FPM configuration..."
|
||||||
|
|
||||||
# Remove the dedicated php-fpm config
|
# Remove the dedicated PHP-FPM config
|
||||||
ynh_remove_fpm_config
|
ynh_remove_fpm_config
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE LOGROTATE CONFIG
|
# REMOVE DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Remove logrotate configuration" --weight=3
|
ynh_script_progression --message="Removing dependencies..."
|
||||||
|
|
||||||
# Remove the app-specific logrotate config
|
# Remove metapackage and its dependencies
|
||||||
ynh_remove_logrotate
|
ynh_remove_app_dependencies
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC REMOVE
|
# SPECIFIC REMOVE
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE RADICALE CONFIG
|
# REMOVE VARIOUS FILES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Removing various files..."
|
||||||
|
|
||||||
ynh_secure_remove "/etc/$app"
|
# Remove a directory securely
|
||||||
|
ynh_secure_remove --file="/etc/$app"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE SERVICE FROM ADMIN PANEL
|
# GENERIC FINALIZATION
|
||||||
#=================================================
|
|
||||||
|
|
||||||
if [ -e /etc/init.d/uwsgi ]
|
|
||||||
then
|
|
||||||
# Restart uwsgi service
|
|
||||||
ynh_systemd_action --action=start --service_name=uwsgi
|
|
||||||
else
|
|
||||||
# Check if the service is declared in YunoHost
|
|
||||||
if yunohost service status | grep -q uwsgi
|
|
||||||
then
|
|
||||||
ynh_print_info "Remove uwsgi service" >&2
|
|
||||||
yunohost service remove uwsgi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC FINALISATION
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE DEDICATED USER
|
# REMOVE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Remove the dedicated user"
|
ynh_script_progression --message="Removing the dedicated system user..."
|
||||||
|
|
||||||
ynh_system_user_delete $app
|
# Delete a system user
|
||||||
|
ynh_system_user_delete --username=$app
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Deletion completed" --last
|
ynh_script_progression --message="Removal of $app completed"
|
||||||
|
|
138
scripts/restore
138
scripts/restore
|
@ -6,6 +6,7 @@
|
||||||
# IMPORT GENERIC HELPERS
|
# IMPORT GENERIC HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
||||||
source ../settings/scripts/_common.sh
|
source ../settings/scripts/_common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
@ -13,70 +14,76 @@ source /usr/share/yunohost/helpers
|
||||||
# MANAGE SCRIPT FAILURE
|
# 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
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Load settings" --weight=2
|
ynh_script_progression --message="Loading installation settings..."
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
final_path=$(ynh_app_setting_get $app final_path)
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||||
domain=$(ynh_app_setting_get $app domain)
|
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||||
infcloud=$(ynh_app_setting_get $app infcloud)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
path_url=$(ynh_app_setting_get $app path)
|
|
||||||
admin=$(ynh_app_setting_get $app admin)
|
|
||||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||||
|
admin=$(ynh_app_setting_get --app=$app --key=admin)
|
||||||
|
infcloud=$(ynh_app_setting_get --app=$app --key=infcloud)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK IF THE APP CAN BE RESTORED
|
# CHECK IF THE APP CAN BE RESTORED
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Validating restoration parameters..."
|
||||||
|
|
||||||
test ! -d $final_path \
|
test ! -d $final_path \
|
||||||
|| ynh_die "There is already a directory: $final_path "
|
|| ynh_die --message="There is already a directory: $final_path "
|
||||||
test ! -d "/opt/yunohost/$app" \
|
test ! -d "/opt/yunohost/$app" \
|
||||||
|| ynh_die "There is already a directory: /opt/yunohost/$app "
|
|| ynh_die --message="There is already a directory: /opt/yunohost/$app "
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ACTIVATE MAINTENANCE MODE
|
# ACTIVATE MAINTENANCE MODE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Activate maintenance mode" --weight=2
|
ynh_script_progression --message="Activate maintenance mode"
|
||||||
|
|
||||||
ynh_maintenance_mode_ON
|
ynh_maintenance_mode_ON
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD RESTORE STEPS
|
# STANDARD RESTORATION STEPS
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE NGINX CONFIGURATION
|
# RESTORE THE NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Restoring the NGINX web server configuration..."
|
||||||
|
|
||||||
ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf"
|
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# REINSTALL DEPENDENCIES
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Reinstall dependencies" --weight=25
|
|
||||||
|
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RESTORE THE APP MAIN DIR
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Restore the app main directory"
|
|
||||||
|
|
||||||
ynh_restore_file "$final_path"
|
|
||||||
mkdir -p /opt/yunohost
|
|
||||||
ynh_restore_file "/opt/yunohost/$app"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RECREATE THE DEDICATED USER
|
# RECREATE THE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Recreate the dedicated user" --weight=3
|
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 $app
|
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RESTORE THE APP MAIN DIR
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Restoring the app main directory..."
|
||||||
|
|
||||||
|
ynh_restore_file --origin_path="$final_path"
|
||||||
|
|
||||||
|
chmod 750 "$final_path"
|
||||||
|
chmod -R o-rwx "$final_path"
|
||||||
|
chown -R $app:www-data "$final_path"
|
||||||
|
|
||||||
|
mkdir -p /opt/yunohost
|
||||||
|
ynh_restore_file --origin_path="/opt/yunohost/$app"
|
||||||
|
|
||||||
|
chown -R radicale: "/opt/yunohost/$app"
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE PHP-FPM CONFIGURATION
|
# RESTORE THE PHP-FPM CONFIGURATION
|
||||||
|
@ -84,60 +91,79 @@ ynh_system_user_create $app
|
||||||
|
|
||||||
if [ $infcloud -eq 1 ]
|
if [ $infcloud -eq 1 ]
|
||||||
then
|
then
|
||||||
ynh_script_progression --message="Reload PHP-FPM" --weight=2
|
ynh_script_progression --message="Restoring the PHP-FPM configuration..."
|
||||||
ynh_restore_file "/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
|
||||||
ynh_systemd_action --action=reload --service_name=php$phpversion-fpm
|
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC RESTORE
|
# SPECIFIC RESTORATION
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE USER RIGHTS
|
# REINSTALL DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Reinstalling dependencies..."
|
||||||
|
|
||||||
chown radicale: -R /opt/yunohost/$app
|
# Define and install dependencies
|
||||||
|
ynh_install_app_dependencies $pkg_dependencies
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RESTORE VARIOUS FILES
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Restoring various files..."
|
||||||
|
|
||||||
|
ynh_restore_file --origin_path="/etc/$app/"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RESTORE SYSTEMD
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Restoring the systemd configuration..."
|
||||||
|
|
||||||
|
ynh_restore_file --origin_path="/etc/uwsgi/apps-available/radicale.ini"
|
||||||
|
ln -s /etc/uwsgi/apps-available/radicale.ini /etc/uwsgi/apps-enabled/
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RESTORE THE LOGROTATE CONFIGURATION
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Restoring the logrotate configuration..."
|
||||||
|
|
||||||
chown -R radicale: $final_path
|
|
||||||
mkdir -p /var/log/$app
|
mkdir -p /var/log/$app
|
||||||
touch /var/log/$app/$app.log
|
touch /var/log/$app/$app.log
|
||||||
chown radicale -R /var/log/$app
|
chown radicale -R /var/log/$app
|
||||||
|
|
||||||
#=================================================
|
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
||||||
# RESTORE THE UWSGI CONFIG
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
ynh_restore_file "/etc/uwsgi/apps-available/radicale.ini"
|
|
||||||
ln -s /etc/uwsgi/apps-available/radicale.ini /etc/uwsgi/apps-enabled/
|
|
||||||
|
|
||||||
# Advertise service in admin panel
|
|
||||||
yunohost service add uwsgi --log="/var/log/uwsgi/app/radicale.log"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE RADICALE CONFIGURATION
|
# INTEGRATE SERVICE IN YUNOHOST
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Integrating service in YunoHost..."
|
||||||
|
|
||||||
ynh_restore_file "/etc/$app"
|
yunohost service add $app --log="/var/log/uwsgi/app/radicale.log"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP OF THE LOGROTATE CONFIGURATION
|
# START SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Starting a systemd service..."
|
||||||
|
|
||||||
ynh_restore_file "/etc/logrotate.d/$app"
|
ynh_systemd_action --service_name=uwsgi --action=restart
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALISATION
|
# GENERIC FINALIZATION
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX AND UWSGI
|
# RELOAD NGINX AND PHP-FPM
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Reload nginx and restart Radicale"
|
ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..."
|
||||||
|
|
||||||
ynh_systemd_action --action=restart --service_name=uwsgi
|
if [ $infcloud -eq 1 ]
|
||||||
ynh_systemd_action --action=reload --service_name=nginx
|
then
|
||||||
|
ynh_systemd_action --service_name=php$phpversion-fpm --action=reload
|
||||||
|
fi
|
||||||
|
|
||||||
|
ynh_systemd_action --service_name=nginx --action=reload
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DEACTIVE MAINTENANCE MODE
|
# DEACTIVE MAINTENANCE MODE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Disable maintenance mode" --weight=4
|
ynh_script_progression --message="Disable maintenance mode"
|
||||||
|
|
||||||
ynh_maintenance_mode_OFF
|
ynh_maintenance_mode_OFF
|
||||||
|
|
||||||
|
@ -172,4 +198,4 @@ ynh_send_readme_to_admin --app_message="mail_to_send" --recipients="$admin" --ty
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Restoration completed" --last
|
ynh_script_progression --message="Restoration completed for $app"
|
||||||
|
|
308
scripts/upgrade
308
scripts/upgrade
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC STARTING
|
# GENERIC START
|
||||||
#=================================================
|
#=================================================
|
||||||
# IMPORT GENERIC HELPERS
|
# IMPORT GENERIC HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -12,16 +12,16 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Load settings" --weight=6
|
ynh_script_progression --message="Loading installation settings..."
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
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)
|
||||||
admin=$(ynh_app_setting_get --app=$app --key=admin)
|
|
||||||
infcloud=$(ynh_app_setting_get --app=$app --key=infcloud)
|
|
||||||
language=$(ynh_app_setting_get --app=$app --key=language)
|
language=$(ynh_app_setting_get --app=$app --key=language)
|
||||||
|
admin=$(ynh_app_setting_get --app=$app --key=admin)
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
|
infcloud=$(ynh_app_setting_get --app=$app --key=infcloud)
|
||||||
version=$(ynh_app_setting_get --app=$app --key=version)
|
version=$(ynh_app_setting_get --app=$app --key=version)
|
||||||
overwrite_logging=$(ynh_app_setting_get --app=$app --key=overwrite_logging)
|
overwrite_logging=$(ynh_app_setting_get --app=$app --key=overwrite_logging)
|
||||||
overwrite_config=$(ynh_app_setting_get --app=$app --key=overwrite_config)
|
overwrite_config=$(ynh_app_setting_get --app=$app --key=overwrite_config)
|
||||||
|
@ -40,29 +40,40 @@ defaulteventduration=$(ynh_app_setting_get --app=$app --key=defaulteventduration
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK VERSION
|
# CHECK VERSION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Checking version..."
|
||||||
|
|
||||||
upgrade_type=$(ynh_check_app_version_changed)
|
upgrade_type=$(ynh_check_app_version_changed)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Backup the app before upgrading"
|
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
|
||||||
ynh_abort_if_errors
|
ynh_abort_if_errors
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# ACTIVATE MAINTENANCE MODE
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Activate maintenance mode"
|
||||||
|
|
||||||
|
ynh_maintenance_mode_ON
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# STANDARD UPGRADE STEPS
|
||||||
#=================================================
|
#=================================================
|
||||||
# ENSURE DOWNWARD COMPATIBILITY
|
# ENSURE DOWNWARD COMPATIBILITY
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Ensure downward compatibility"
|
ynh_script_progression --message="Ensuring downward compatibility..."
|
||||||
|
|
||||||
ynh_app_setting_delete $app unprotected_regex
|
ynh_app_setting_delete --app=$app --key=unprotected_regex
|
||||||
|
|
||||||
if [ -d /usr/local/radicale ]
|
if [ -d /usr/local/radicale ]
|
||||||
then
|
then
|
||||||
|
@ -116,111 +127,46 @@ if [ -z "$overwrite_phpfpm" ]; then
|
||||||
ynh_app_setting_set $app overwrite_phpfpm $overwrite_phpfpm
|
ynh_app_setting_set $app overwrite_phpfpm $overwrite_phpfpm
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
# Cleaning legacy permissions
|
||||||
# Migrate legacy permissions to new system
|
if ynh_legacy_permissions_exists; then
|
||||||
#=================================================
|
|
||||||
if ynh_legacy_permissions_exists
|
|
||||||
then
|
|
||||||
ynh_legacy_permissions_delete_all
|
ynh_legacy_permissions_delete_all
|
||||||
|
|
||||||
ynh_app_setting_delete --app=$app --key=is_public
|
ynh_app_setting_delete --app=$app --key=is_public
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CHECK THE PATH
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
if [ $infcloud -eq 1 ]; then
|
if [ $infcloud -eq 1 ]; then
|
||||||
# Remove /infcloud to deal with the path only.
|
# Remove /infcloud to deal with the path only.
|
||||||
path_url=$(echo $path_url | sed "s@/infcloud@@")
|
path_url=$(echo $path_url | sed "s@/infcloud@@")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# ACTIVATE MAINTENANCE MODE
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Activate maintenance mode" --weight=1
|
|
||||||
|
|
||||||
ynh_maintenance_mode_ON
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# STANDARD UPGRADE STEPS
|
|
||||||
#=================================================
|
|
||||||
# UPGRADE DEPENDENCIES
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Upgrade dependencies" --weight=5
|
|
||||||
|
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# NGINX CONFIGURATION
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Overwrite the NGINX configuration only if it's allowed
|
|
||||||
if [ $overwrite_nginx -eq 1 ]
|
|
||||||
then
|
|
||||||
ynh_script_progression --message="Reconfigure nginx" --weight=2
|
|
||||||
ynh_add_nginx_config
|
|
||||||
if [ $infcloud -eq 1 ]
|
|
||||||
then
|
|
||||||
# Add InfCloud in NGINX config
|
|
||||||
ynh_replace_string "#INFCLOUD#" "" /etc/nginx/conf.d/$domain.d/$app.conf
|
|
||||||
fi
|
|
||||||
ynh_store_file_checksum "/etc/nginx/conf.d/$domain.d/$app.conf"
|
|
||||||
fi
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE DEDICATED USER
|
# CREATE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Create a dedicated user" --weight=2
|
ynh_script_progression --message="Making sure dedicated system user exists..."
|
||||||
|
|
||||||
# Create a dedicated user (if not existing)
|
# Create a dedicated user (if not existing)
|
||||||
ynh_system_user_create $app
|
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||||
|
|
||||||
if [ $infcloud -eq 1 ]
|
|
||||||
then
|
|
||||||
#=================================================
|
|
||||||
# PHP-FPM CONFIGURATION
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Overwrite the php-fpm configuration only if it's allowed
|
|
||||||
if [ $overwrite_phpfpm -eq 1 ]
|
|
||||||
then
|
|
||||||
ynh_script_progression --message="Reconfigure PHP-FPM" --weight=2
|
|
||||||
# Create a dedicated php-fpm config
|
|
||||||
ynh_add_fpm_config
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC UPGRADE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
|
||||||
# UPGRADE RADICALE IN ITS VIRTUALENV
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||||
then
|
then
|
||||||
ynh_script_progression --message="Upgrade Radicale in its virtualenv" --weight=6
|
ynh_script_progression --message="Upgrading source files..."
|
||||||
# Upgrade pip packages
|
|
||||||
ynh_secure_remove /opt/yunohost/$app
|
|
||||||
virtualenv /opt/yunohost/$app
|
|
||||||
version=$(ynh_app_setting_get $app version $version)
|
|
||||||
bash -c "source /opt/yunohost/radicale/bin/activate && pip install radicale==$version python-ldap"
|
|
||||||
fi
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# COPY FILES INTO $FINAL_PATH
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Download, check and unpack source"
|
|
||||||
|
|
||||||
# Copy files to the right place
|
# Copy files to the right place
|
||||||
mkdir -p $final_path/collections
|
mkdir -p $final_path/collections
|
||||||
|
|
||||||
|
# Copy files to the right place
|
||||||
cp ../conf/radicale.wsgi $final_path
|
cp ../conf/radicale.wsgi $final_path
|
||||||
|
|
||||||
# Copy extra files
|
# Copy extra files
|
||||||
cp -a ../sources/extra_files_radicale/. "$final_path"
|
cp -a ../sources/extra_files_radicale/. "$final_path"
|
||||||
|
|
||||||
# regex.py file is patched to fix the awful commit e807c3d35bea9cfcfcacac83b1b17d748ea15a39 that stop the reading of "rights" file after the first match.
|
# regex.py file is patched to fix the awful commit e807c3d35bea9cfcfcacac83b1b17d748ea15a39 that stop the reading of "rights" file after the first match.
|
||||||
mv "$final_path/regex.py" /opt/yunohost/$app/lib/python*/site-packages/radicale/rights/regex.py
|
mv "$final_path/regex.py" /opt/yunohost/$app/lib/python*/site-packages/radicale/rights/regex.py
|
||||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
|
||||||
then
|
|
||||||
if [ "$infcloud" = "1" ]
|
if [ "$infcloud" = "1" ]
|
||||||
then
|
then
|
||||||
#Instal InfCloud
|
#Instal InfCloud
|
||||||
|
@ -233,7 +179,7 @@ then
|
||||||
cp -a $final_path/config.js ./config.js
|
cp -a $final_path/config.js ./config.js
|
||||||
fi
|
fi
|
||||||
# Download and uncompress the source into final_path
|
# Download and uncompress the source into final_path
|
||||||
ynh_setup_source "$final_path"
|
ynh_setup_source --dest_dir="$final_path"
|
||||||
if [ $overwrite_infcloud -eq 0 ]; then
|
if [ $overwrite_infcloud -eq 0 ]; then
|
||||||
mv ./config.js $final_path/config.js
|
mv ./config.js $final_path/config.js
|
||||||
fi
|
fi
|
||||||
|
@ -242,33 +188,96 @@ then
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
chmod 750 "$final_path"
|
||||||
|
chmod -R o-rwx "$final_path"
|
||||||
|
chown -R $app:www-data "$final_path"
|
||||||
|
|
||||||
|
chmod 666 -R $final_path/default_collections
|
||||||
|
chmod 777 $final_path/default_collections $final_path/default_collections/USER
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# NGINX CONFIGURATION
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Overwrite the NGINX configuration only if it's allowed
|
||||||
|
if [ $overwrite_nginx -eq 1 ]
|
||||||
|
then
|
||||||
|
ynh_script_progression --message="Upgrading NGINX web server configuration..."
|
||||||
|
|
||||||
|
# Create a dedicated NGINX config
|
||||||
|
ynh_add_nginx_config
|
||||||
|
if [ $infcloud -eq 1 ]
|
||||||
|
then
|
||||||
|
# Add InfCloud in NGINX config
|
||||||
|
ynh_replace_string --match_string="#INFCLOUD#" --replace_string="" --target_file="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
fi
|
||||||
|
ynh_store_file_checksum --file="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
fi
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# UPGRADE DEPENDENCIES
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Upgrading dependencies..."
|
||||||
|
|
||||||
|
ynh_install_app_dependencies $pkg_dependencies
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# PHP-FPM CONFIGURATION
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
if [ $infcloud -eq 1 ]
|
||||||
|
then
|
||||||
|
|
||||||
|
# Overwrite the php-fpm configuration only if it's allowed
|
||||||
|
if [ $overwrite_phpfpm -eq 1 ]
|
||||||
|
then
|
||||||
|
ynh_script_progression --message="Upgrading PHP-FPM configuration..."
|
||||||
|
|
||||||
|
# Create a dedicated PHP-FPM config
|
||||||
|
ynh_add_fpm_config
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SPECIFIC UPGRADE
|
||||||
|
#=================================================
|
||||||
|
# UPGRADE RADICALE IN ITS VIRTUALENV
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||||
|
then
|
||||||
|
ynh_script_progression --message="Upgrade Radicale in its virtualenv"
|
||||||
|
# Upgrade pip packages
|
||||||
|
ynh_secure_remove --file="/opt/yunohost/$app"
|
||||||
|
virtualenv /opt/yunohost/$app
|
||||||
|
version=$(ynh_app_setting_get $app version $version)
|
||||||
|
bash -c "source /opt/yunohost/radicale/bin/activate && pip install radicale==$version python-ldap"
|
||||||
|
fi
|
||||||
|
|
||||||
|
chown radicale: -R /opt/yunohost/$app
|
||||||
|
find /opt/yunohost/$app/ -type d -exec chmod 2755 {} \;
|
||||||
|
find /opt/yunohost/$app/ -type f -exec chmod g+r,o+r {} \;
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CONFIGURE RADICALE
|
# CONFIGURE RADICALE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Reconfigure Radicale" --weight=5
|
ynh_script_progression --message="Reconfigure Radicale"
|
||||||
|
|
||||||
# Overwrite the logging config file only if it's allowed
|
# Overwrite the logging config file only if it's allowed
|
||||||
if [ $overwrite_logging -eq 1 ]
|
if [ $overwrite_logging -eq 1 ]
|
||||||
then
|
then
|
||||||
# Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script.
|
ynh_add_config --template="../conf/logging" --destination="/etc/$app/logging"
|
||||||
ynh_backup_if_checksum_is_different "/etc/$app/logging"
|
|
||||||
cp ../conf/logging /etc/$app/
|
|
||||||
# Recalculate and store the checksum of the file for the next upgrade.
|
|
||||||
ynh_store_file_checksum "/etc/$app/logging"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Overwrite the config file only if it's allowed
|
# Overwrite the config file only if it's allowed
|
||||||
if [ $overwrite_config -eq 1 ]
|
if [ $overwrite_config -eq 1 ]
|
||||||
then
|
then
|
||||||
# Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script.
|
ynh_add_config --template="../conf/config" --destination="/etc/$app/config"
|
||||||
ynh_backup_if_checksum_is_different "/etc/$app/config"
|
|
||||||
cp ../conf/config /etc/$app/
|
|
||||||
ynh_replace_string "__PATH__" "${path_url%/}" /etc/$app/config
|
|
||||||
ynh_replace_string "__FINALPATH__" "$final_path" /etc/$app/config
|
|
||||||
# Recalculate and store the checksum of the file for the next upgrade.
|
|
||||||
ynh_store_file_checksum "/etc/$app/config"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
chmod 755 /etc/$app/
|
||||||
|
chmod 644 /etc/$app/*
|
||||||
|
|
||||||
# Overwrite the InfCloud config file only if it's allowed
|
# Overwrite the InfCloud config file only if it's allowed
|
||||||
if [ $overwrite_infcloud -eq 1 ]
|
if [ $overwrite_infcloud -eq 1 ]
|
||||||
then
|
then
|
||||||
|
@ -308,122 +317,87 @@ then
|
||||||
"Chinese") language="zh_CN"
|
"Chinese") language="zh_CN"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
ynh_app_setting_set $app language $language
|
ynh_app_setting_set --app=$app --key=language --value=$language
|
||||||
# Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script.
|
timezone=$(cat /etc/timezone)
|
||||||
ynh_backup_if_checksum_is_different "$final_path/infcloud/config.js"
|
ynh_add_config --template="../conf/config.js" --destination="$final_path/infcloud/config.js"
|
||||||
cp ../conf/config.js "$final_path/infcloud/"
|
|
||||||
ynh_replace_string "__DOMAIN__" "$domain" "$final_path/infcloud/config.js"
|
|
||||||
ynh_replace_string "__PATH__" "${path_url%/}" "$final_path/infcloud/config.js"
|
|
||||||
ynh_replace_string "__LANG__" "$language" "$final_path/infcloud/config.js"
|
|
||||||
ynh_replace_string "__ADMIN__" "$admin" "$final_path/infcloud/config.js"
|
|
||||||
ynh_replace_string "__TIMEZONE__" "$(cat /etc/timezone)" "$final_path/infcloud/config.js"
|
|
||||||
|
|
||||||
# Optional parameters from config-panel feature
|
# Optional parameters from config-panel feature
|
||||||
if [ -n "$firstdayofweek" ]; then
|
if [ -n "$firstdayofweek" ]; then
|
||||||
ynh_replace_string "\(^var globalDatepickerFirstDayOfWeek=\).*" "\1$firstdayofweek;" "$final_path/infcloud/config.js"
|
ynh_replace_string --match_string="\(^var globalDatepickerFirstDayOfWeek=\).*" --replace_string="\1$firstdayofweek;" --target_file="$final_path/infcloud/config.js"
|
||||||
fi
|
fi
|
||||||
if [ -n "$activeview" ]; then
|
if [ -n "$activeview" ]; then
|
||||||
ynh_replace_string "\(^var globalActiveView=\).*" "\1\'$activeview\';" "$final_path/infcloud/config.js"
|
ynh_replace_string --match_string="\(^var globalActiveView=\).*" --replace_string="\1\'$activeview\';" --target_file="$final_path/infcloud/config.js"
|
||||||
fi
|
fi
|
||||||
if [ -n "$openformmode" ]; then
|
if [ -n "$openformmode" ]; then
|
||||||
ynh_replace_string "\(^var globalOpenFormMode=\).*" "\1\'$openformmode\';" "$final_path/infcloud/config.js"
|
ynh_replace_string --match_string="\(^var globalOpenFormMode=\).*" --replace_string="\1\'$openformmode\';" --target_file="$final_path/infcloud/config.js"
|
||||||
fi
|
fi
|
||||||
if [ -n "$startofbusiness" ]; then
|
if [ -n "$startofbusiness" ]; then
|
||||||
ynh_replace_string "\(^var globalCalendarStartOfBusiness=\).*" "\1$startofbusiness;" "$final_path/infcloud/config.js"
|
ynh_replace_string --match_string="\(^var globalCalendarStartOfBusiness=\).*" --replace_string="\1$startofbusiness;" --target_file="$final_path/infcloud/config.js"
|
||||||
fi
|
fi
|
||||||
if [ -n "$endofbusiness" ]; then
|
if [ -n "$endofbusiness" ]; then
|
||||||
ynh_replace_string "\(^var globalCalendarEndOfBusiness=\).*" "\1$endofbusiness;" "$final_path/infcloud/config.js"
|
ynh_replace_string --match_string="\(^var globalCalendarEndOfBusiness=\).*" --replace_string="\1$endofbusiness;" --target_file="$final_path/infcloud/config.js"
|
||||||
fi
|
fi
|
||||||
if [ -n "$defaulteventduration" ]; then
|
if [ -n "$defaulteventduration" ]; then
|
||||||
ynh_replace_string "\(^var globalDefaultEventDuration=\).*" "\1$defaulteventduration;" "$final_path/infcloud/config.js"
|
ynh_replace_string --match_string="\(^var globalDefaultEventDuration=\).*" --replace_string="\1$defaulteventduration;" --target_file="$final_path/infcloud/config.js"
|
||||||
fi
|
fi
|
||||||
# Recalculate and store the checksum of the file for the next upgrade.
|
# Recalculate and store the checksum of the file for the next upgrade.
|
||||||
ynh_store_file_checksum "$final_path/infcloud/config.js"
|
ynh_store_file_checksum --file="$final_path/infcloud/config.js"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SET PERMISSIONS ON RADICALE DIRECTORIES
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
chown radicale: -R /opt/yunohost/$app
|
|
||||||
|
|
||||||
# Fix permission
|
|
||||||
chmod 755 /etc/$app/
|
|
||||||
find /opt/yunohost/$app/ -type d -exec chmod 2755 {} \;
|
|
||||||
find /opt/yunohost/$app/ -type f -exec chmod g+r,o+r {} \;
|
|
||||||
chmod 644 /etc/$app/*
|
|
||||||
chown -R radicale: $final_path
|
|
||||||
mkdir -p /var/log/$app
|
|
||||||
touch /var/log/$app/$app.log
|
|
||||||
chown radicale -R /var/log/$app
|
|
||||||
# Set default permissions as radicale do.
|
|
||||||
chmod 666 -R $final_path/default_collections
|
|
||||||
chmod 777 $final_path/default_collections $final_path/default_collections/USER
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CONFIGURE UWSGI FOR RADICALE
|
# CONFIGURE UWSGI FOR RADICALE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
cp ../conf/radicale.ini /etc/uwsgi/apps-available/
|
cp ../conf/radicale.ini /etc/uwsgi/apps-available/
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# ADVERTISE SERVICE IN ADMIN PANEL
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Restart Radicale" --weight=2
|
|
||||||
|
|
||||||
ynh_systemd_action --action=restart --service_name=uwsgi
|
|
||||||
yunohost service add uwsgi --log="/var/log/uwsgi/app/radicale.log"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# PREPARE THE HOOKS
|
# PREPARE THE HOOKS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Modify the hooks for create user collections and to remove them.
|
# Modify the hooks for create user collections and to remove them.
|
||||||
ynh_replace_string "__FINALPATH__" "$final_path" ../hooks/post_user_create
|
ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="../hooks/post_user_create"
|
||||||
ynh_replace_string "__FINALPATH__" "$final_path" ../hooks/post_user_delete
|
ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="../hooks/post_user_delete"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# GENERIC FINALIZATION
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP LOGROTATE
|
# SETUP LOGROTATE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Reconfigure logrotate" --weight=3
|
ynh_script_progression --message="Upgrading logrotate configuration..."
|
||||||
|
|
||||||
|
mkdir -p /var/log/$app
|
||||||
|
touch /var/log/$app/$app.log
|
||||||
|
chown radicale -R /var/log/$app
|
||||||
|
|
||||||
|
# Use logrotate to manage app-specific logfile(s)
|
||||||
ynh_use_logrotate --non-append
|
ynh_use_logrotate --non-append
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALISATION
|
# INTEGRATE SERVICE IN YUNOHOST
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SSOWAT
|
ynh_script_progression --message="Integrating service in YunoHost..."
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Reconfigure SSOwat" --weight=2
|
|
||||||
|
|
||||||
if [ $infcloud -eq 1 ]
|
yunohost service add uwsgi --log="/var/log/uwsgi/app/radicale.log"
|
||||||
then
|
|
||||||
# Add /infcloud to the path of radicale to access it from the portal
|
#=================================================
|
||||||
# Replace radicale by InfCloud into YunoHost portal
|
# START SYSTEMD SERVICE
|
||||||
ynh_app_setting_set $app path ${path_url%/}/infcloud
|
#=================================================
|
||||||
# Protect InfCloud access
|
ynh_script_progression --message="Starting a systemd service..."
|
||||||
ynh_app_setting_set $app protected_uris "/"
|
|
||||||
domain_regex=$(echo "$domain" | sed 's@-@.@g')
|
ynh_systemd_action --service_name=$app --action="restart"
|
||||||
# Radicale is always accessible (For access to ressources)
|
|
||||||
ynh_app_setting_set $app skipped_regex "$domain_regex$path_url"
|
|
||||||
else
|
|
||||||
# If only radicale is installed
|
|
||||||
# Radicale is always accessible (For access to ressources)
|
|
||||||
ynh_app_setting_set $app unprotected_uris "/"
|
|
||||||
fi
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Reload NGINX"
|
ynh_script_progression --message="Reloading NGINX web server..."
|
||||||
|
|
||||||
ynh_systemd_action --action=reload --service_name=nginx
|
ynh_systemd_action --service_name=nginx --action=reload
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DEACTIVE MAINTENANCE MODE
|
# DEACTIVE MAINTENANCE MODE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Disable maintenance mode" --weight=5
|
ynh_script_progression --message="Disable maintenance mode"
|
||||||
|
|
||||||
ynh_maintenance_mode_OFF
|
ynh_maintenance_mode_OFF
|
||||||
|
|
||||||
|
@ -466,4 +440,4 @@ ynh_send_readme_to_admin --app_message="mail_to_send" --recipients="$admin" --ty
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Upgrade completed" --last
|
ynh_script_progression --message="Upgrade of $app completed"
|
||||||
|
|
Loading…
Reference in a new issue