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
61a681c79c
15 changed files with 391 additions and 274 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"
|
||||||
admin="john"
|
|
||||||
infcloud=1
|
infcloud=1
|
||||||
language="French"
|
language="French"
|
||||||
|
admin="john"
|
||||||
; Checks
|
; Checks
|
||||||
pkg_linter=1
|
pkg_linter=1
|
||||||
setup_sub_dir=1
|
setup_sub_dir=1
|
||||||
|
@ -15,7 +15,6 @@
|
||||||
upgrade=1
|
upgrade=1
|
||||||
backup_restore=1
|
backup_restore=1
|
||||||
multi_instance=0
|
multi_instance=0
|
||||||
incorrect_path=1
|
|
||||||
port_already_use=0
|
port_already_use=0
|
||||||
# Because of the modification of the path for InfCloud, we can't try the change_url script here.
|
# Because of the modification of the path for InfCloud, we can't try the change_url script here.
|
||||||
change_url=0
|
change_url=0
|
||||||
|
@ -23,9 +22,9 @@
|
||||||
; Manifest
|
; Manifest
|
||||||
domain="domain.tld"
|
domain="domain.tld"
|
||||||
path="/path"
|
path="/path"
|
||||||
admin="john"
|
|
||||||
infcloud=0
|
infcloud=0
|
||||||
language="French"
|
language="French"
|
||||||
|
admin="john"
|
||||||
; Checks
|
; Checks
|
||||||
setup_sub_dir=1
|
setup_sub_dir=1
|
||||||
setup_root=1
|
setup_root=1
|
||||||
|
|
0
doc/.gitkeep
Normal file
0
doc/.gitkeep
Normal file
3
doc/DESCRIPTION.md
Normal file
3
doc/DESCRIPTION.md
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
Radicale is a small but powerful CalDAV (calendars, todo-lists) and CardDAV (contacts) server.
|
||||||
|
|
||||||
|
* This package bring a web interface for Radicale named InfCloud.
|
12
doc/DISCLAIMER.md
Normal file
12
doc/DISCLAIMER.md
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
## 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
|
||||||
|
|
||||||
|
## 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.
|
||||||
|
|
0
doc/screenshots/.gitkeep
Normal file
0
doc/screenshots/.gitkeep
Normal file
|
@ -8,6 +8,11 @@
|
||||||
},
|
},
|
||||||
"version": "1.1.6~ynh5",
|
"version": "1.1.6~ynh5",
|
||||||
"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"
|
||||||
|
},
|
||||||
"license": "GPL-3.0,AGPL-3.0",
|
"license": "GPL-3.0,AGPL-3.0",
|
||||||
"maintainer": {
|
"maintainer": {
|
||||||
"name": "",
|
"name": "",
|
||||||
|
@ -37,10 +42,6 @@
|
||||||
"example": "/radicale",
|
"example": "/radicale",
|
||||||
"default": "/radicale"
|
"default": "/radicale"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "admin",
|
|
||||||
"type": "user"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "infcloud",
|
"name": "infcloud",
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
|
@ -54,11 +55,15 @@
|
||||||
"name": "language",
|
"name": "language",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"ask": {
|
"ask": {
|
||||||
"en": "Choose your interface language",
|
"en": "Choose the application language",
|
||||||
"fr": "Choisissez la langue de l'interface"
|
"fr": "Choisissez la langue de l'application"
|
||||||
},
|
},
|
||||||
"choices" : ["Czech", "Danish", "German", "English/US", "Spanish", "French", "Italian", "Japan", "Hungarian", "Dutch", "Slovak", "Turkish", "Russian", "Ukrainian", "Chinese"],
|
"choices" : ["Czech", "Danish", "German", "English/US", "Spanish", "French", "Italian", "Japan", "Hungarian", "Dutch", "Slovak", "Turkish", "Russian", "Ukrainian", "Chinese"],
|
||||||
"default" : "English/US"
|
"default" : "English/US"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "admin",
|
||||||
|
"type": "user"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,15 +9,7 @@ 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...
|
# PERSONAL HELPERS
|
||||||
#=================================================
|
|
||||||
|
|
||||||
IS_PACKAGE_CHECK () {
|
|
||||||
return $(env | grep -c container=lxc)
|
|
||||||
}
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# BOOLEAN CONVERTER
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
bool_to_01 () {
|
bool_to_01 () {
|
||||||
|
@ -34,11 +26,6 @@ bool_to_true_false () {
|
||||||
echo "$var"
|
echo "$var"
|
||||||
}
|
}
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# FUTUR OFFICIAL HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# EXPERIMENTAL HELPERS
|
# EXPERIMENTAL HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -388,3 +375,7 @@ ynh_app_changelog () {
|
||||||
sed -in-place "s@\*(\([[:alnum:]]*\)) -> \(.*\)@* __URL_TAG1__\2__URL_TAG2__${repo}/commit/\1__URL_TAG3__@g" changelog
|
sed -in-place "s@\*(\([[:alnum:]]*\)) -> \(.*\)@* __URL_TAG1__\2__URL_TAG2__${repo}/commit/\1__URL_TAG3__@g" changelog
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# FUTURE OFFICIAL HELPERS
|
||||||
|
#=================================================
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
@ -37,47 +41,42 @@ 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 "/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"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# BACKUP RADICALE CONFIGURATION
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
ynh_backup "/etc/$app"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# BACKUP LOGROTATE CONFIGURATION
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_backup "/etc/logrotate.d/$app"
|
ynh_backup "/etc/logrotate.d/$app"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# BACKUP VARIOUS FILES
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_backup --src_path="/etc/$app"
|
||||||
|
ynh_backup --src_path="/opt/yunohost/$app"
|
||||||
|
ynh_backup --src_path="/etc/uwsgi/apps-available/radicale.ini"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# 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,10 +24,38 @@ app=$YNH_APP_INSTANCE_NAME
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Load settings" --weight=2
|
ynh_script_progression --message="Loading installation settings..." --weight=2
|
||||||
|
|
||||||
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)
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# 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
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# ACTIVATE MAINTENANCE MODE
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Activate maintenance mode"
|
||||||
|
|
||||||
|
path_url=$old_path
|
||||||
|
domain=$old_domain
|
||||||
|
ynh_maintenance_mode_ON
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK THE SYNTAX OF THE PATHS
|
# CHECK THE SYNTAX OF THE PATHS
|
||||||
|
@ -46,15 +73,6 @@ test -n "$new_path" || new_path="/"
|
||||||
new_path=$(ynh_normalize_url_path $new_path)
|
new_path=$(ynh_normalize_url_path $new_path)
|
||||||
old_path=$(ynh_normalize_url_path $old_path)
|
old_path=$(ynh_normalize_url_path $old_path)
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# ACTIVATE MAINTENANCE MODE
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Activate maintenance mode"
|
|
||||||
|
|
||||||
path_url=$old_path
|
|
||||||
domain=$old_domain
|
|
||||||
ynh_maintenance_mode_ON
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK WHICH PARTS SHOULD BE CHANGED
|
# CHECK WHICH PARTS SHOULD BE CHANGED
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -71,48 +89,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..." --weight=2
|
||||||
|
|
||||||
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
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -141,6 +146,8 @@ then
|
||||||
ynh_app_setting_set $app skipped_regex "$domain_regex$new_path"
|
ynh_app_setting_set $app skipped_regex "$domain_regex$new_path"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# GENERIC FINALISATION
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTART UWSGI
|
# RESTART UWSGI
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -148,14 +155,12 @@ ynh_script_progression --message="Restart Radicale" --weight=2
|
||||||
|
|
||||||
ynh_systemd_action --action=restart --service_name=uwsgi
|
ynh_systemd_action --action=restart --service_name=uwsgi
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC FINALISATION
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# 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
|
||||||
|
@ -170,4 +175,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" --last
|
||||||
|
|
126
scripts/install
126
scripts/install
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC STARTING
|
# GENERIC START
|
||||||
#=================================================
|
#=================================================
|
||||||
# IMPORT GENERIC HELPERS
|
# IMPORT GENERIC HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -10,10 +10,12 @@ source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# MANAGE FAILURE OF THE SCRIPT
|
# MANAGE SCRIPT FAILURE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Exit if an error occurs during the execution of the script
|
ynh_clean_setup () {
|
||||||
|
ynh_clean_check_starting
|
||||||
|
}# Exit if an error occurs during the execution of the script
|
||||||
ynh_abort_if_errors
|
ynh_abort_if_errors
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -23,9 +25,9 @@ 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
|
||||||
admin=$YNH_APP_ARG_ADMIN
|
|
||||||
infcloud=$YNH_APP_ARG_INFCLOUD
|
infcloud=$YNH_APP_ARG_INFCLOUD
|
||||||
language=$YNH_APP_ARG_LANGUAGE
|
language=$YNH_APP_ARG_LANGUAGE
|
||||||
|
admin=$YNH_APP_ARG_ADMIN
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
|
@ -33,47 +35,56 @@ 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="Store settings from manifest" --weight=4
|
||||||
|
|
||||||
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=language --value=$language
|
||||||
ynh_app_setting_set $app infcloud $infcloud
|
ynh_app_setting_set --app=$app --key=admin --value=$admin
|
||||||
ynh_app_setting_set $app version $version
|
ynh_app_setting_set --app=$app --key=infcloud --value=$infcloud
|
||||||
|
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..." --weight=25
|
||||||
|
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
ynh_install_app_dependencies $pkg_dependencies
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# CREATE DEDICATED USER
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Configuring system user..." --weight=2
|
||||||
|
|
||||||
|
# Create a system user
|
||||||
|
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configure NGINX" --weight=2
|
ynh_script_progression --message="Configuring NGINX web server..." --weight=2
|
||||||
|
|
||||||
ynh_add_nginx_config
|
ynh_add_nginx_config
|
||||||
if [ $infcloud -eq 1 ]
|
if [ $infcloud -eq 1 ]
|
||||||
|
@ -84,13 +95,19 @@ fi
|
||||||
ynh_store_file_checksum "/etc/nginx/conf.d/$domain.d/$app.conf"
|
ynh_store_file_checksum "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE DEDICATED USER
|
# PHP-FPM CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Create a dedicated user" --weight=2
|
|
||||||
|
|
||||||
# Create a dedicated system user
|
if [ $infcloud -eq 1 ]
|
||||||
ynh_system_user_create $app
|
then
|
||||||
|
ynh_script_progression --message="Configure PHP-FPM" --weight=4
|
||||||
|
# Create a dedicated php-fpm config
|
||||||
|
ynh_add_fpm_config
|
||||||
|
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||||
|
fi
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SPECIFIC SETUP
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC SETUP
|
# SPECIFIC SETUP
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -235,14 +252,6 @@ 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
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -252,11 +261,34 @@ ynh_replace_string "__FINALPATH__" "$final_path" ../hooks/post_user_create
|
||||||
ynh_replace_string "__FINALPATH__" "$final_path" ../hooks/post_user_delete
|
ynh_replace_string "__FINALPATH__" "$final_path" ../hooks/post_user_delete
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALISATION
|
# GENERIC FINALIZATION
|
||||||
|
#=================================================
|
||||||
|
# SETUP LOGROTATE
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Configuring log rotation..." --weight=2
|
||||||
|
|
||||||
|
# Use logrotate to manage application logfile(s)
|
||||||
|
ynh_use_logrotate
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# INTEGRATE SERVICE IN YUNOHOST
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Integrating service in YunoHost..." --weight=2
|
||||||
|
|
||||||
|
yunohost service add uwsgi --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 --action=restart --service_name=uwsgi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SSOWAT
|
# SETUP SSOWAT
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Setup SSOwat" --weight=3
|
ynh_script_progression --message="Configuring permissions..." --weight=3
|
||||||
|
|
||||||
if [ $infcloud -eq 1 ]
|
if [ $infcloud -eq 1 ]
|
||||||
then
|
then
|
||||||
|
@ -274,32 +306,12 @@ else
|
||||||
ynh_app_setting_set $app unprotected_uris "/"
|
ynh_app_setting_set $app unprotected_uris "/"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SETUP LOGROTATE
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Configure logrotate" --weight=2
|
|
||||||
|
|
||||||
# Use logrotate to manage application logfile(s)
|
|
||||||
ynh_use_logrotate
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# PHP-FPM CONFIGURATION
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
if [ $infcloud -eq 1 ]
|
|
||||||
then
|
|
||||||
ynh_script_progression --message="Configure PHP-FPM" --weight=4
|
|
||||||
# Create a dedicated php-fpm config
|
|
||||||
ynh_add_fpm_config
|
|
||||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
|
||||||
fi
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Reload NGINX" --weight=4
|
ynh_script_progression --message="Reloading NGINX web server..." --weight=4
|
||||||
|
|
||||||
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
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC STARTING
|
# GENERIC START
|
||||||
#=================================================
|
#=================================================
|
||||||
# IMPORT GENERIC HELPERS
|
# IMPORT GENERIC HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -12,18 +12,19 @@ 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
|
||||||
#=================================================
|
#=================================================
|
||||||
# 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..." --weight=3
|
||||||
|
|
||||||
# Delete uwsgi configuration
|
# Delete uwsgi configuration
|
||||||
ynh_systemd_action --action=stop --service_name=uwsgi
|
ynh_systemd_action --action=stop --service_name=uwsgi
|
||||||
|
@ -34,25 +35,25 @@ fi
|
||||||
ynh_secure_remove "/etc/uwsgi/apps-available/radicale.ini"
|
ynh_secure_remove "/etc/uwsgi/apps-available/radicale.ini"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE DEPENDENCIES
|
# REMOVE LOGROTATE CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Remove dependencies" --weight=10
|
ynh_script_progression --message="Removing logrotate configuration..." --weight=3
|
||||||
|
|
||||||
# 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"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# 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,26 +61,28 @@ 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..." --weight=3
|
||||||
|
|
||||||
# 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..." --weight=10
|
||||||
|
|
||||||
# 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"
|
ynh_secure_remove "/etc/$app"
|
||||||
|
ynh_secure_remove "/opt/yunohost/$app"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE SERVICE FROM ADMIN PANEL
|
# REMOVE SERVICE FROM ADMIN PANEL
|
||||||
|
@ -99,16 +102,17 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALISATION
|
# GENERIC FINALIZATION
|
||||||
#=================================================
|
#=================================================
|
||||||
# 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" --last
|
||||||
|
|
103
scripts/restore
103
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,26 +14,30 @@ 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..." --weight=2
|
||||||
|
|
||||||
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)
|
infcloud=$(ynh_app_setting_get --app=$app --key=infcloud)
|
||||||
infcloud=$(ynh_app_setting_get $app infcloud)
|
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||||
path_url=$(ynh_app_setting_get $app path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
admin=$(ynh_app_setting_get $app admin)
|
admin=$(ynh_app_setting_get --app=$app --key=admin)
|
||||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# 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 "There is already a directory: $final_path "
|
||||||
|
@ -47,19 +52,21 @@ ynh_script_progression --message="Activate maintenance mode" --weight=2
|
||||||
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
|
# RECREATE THE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Reinstall dependencies" --weight=25
|
ynh_script_progression --message="Recreating the dedicated system user..." --weight=3
|
||||||
|
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
# Create the dedicated user (if not existing)
|
||||||
|
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE APP MAIN DIR
|
# RESTORE THE APP MAIN DIR
|
||||||
|
@ -70,27 +77,26 @@ ynh_restore_file "$final_path"
|
||||||
mkdir -p /opt/yunohost
|
mkdir -p /opt/yunohost
|
||||||
ynh_restore_file "/opt/yunohost/$app"
|
ynh_restore_file "/opt/yunohost/$app"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RECREATE THE DEDICATED USER
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Recreate the dedicated user" --weight=3
|
|
||||||
|
|
||||||
# Create the dedicated user (if not existing)
|
|
||||||
ynh_system_user_create $app
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE PHP-FPM CONFIGURATION
|
# RESTORE THE PHP-FPM CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
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..." --weight=2
|
||||||
ynh_restore_file "/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
||||||
ynh_systemd_action --action=reload --service_name=php$phpversion-fpm
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC RESTORE
|
# SPECIFIC RESTORATION
|
||||||
|
#=================================================
|
||||||
|
# REINSTALL DEPENDENCIES
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Reinstalling dependencies..." --weight=25
|
||||||
|
|
||||||
|
# Define and install dependencies
|
||||||
|
ynh_install_app_dependencies $pkg_dependencies
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE USER RIGHTS
|
# RESTORE USER RIGHTS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -102,6 +108,13 @@ 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
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RESTORE VARIOUS FILES
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Restoring various files..."
|
||||||
|
|
||||||
|
ynh_restore_file --origin_path="/etc/$app"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE UWSGI CONFIG
|
# RESTORE THE UWSGI CONFIG
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -109,30 +122,36 @@ chown radicale -R /var/log/$app
|
||||||
ynh_restore_file "/etc/uwsgi/apps-available/radicale.ini"
|
ynh_restore_file "/etc/uwsgi/apps-available/radicale.ini"
|
||||||
ln -s /etc/uwsgi/apps-available/radicale.ini /etc/uwsgi/apps-enabled/
|
ln -s /etc/uwsgi/apps-available/radicale.ini /etc/uwsgi/apps-enabled/
|
||||||
|
|
||||||
# Advertise service in admin panel
|
#=================================================
|
||||||
|
# RESTORE THE LOGROTATE CONFIGURATION
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Restoring the logrotate configuration..."
|
||||||
|
|
||||||
|
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# INTEGRATE SERVICE IN YUNOHOST
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Integrating service in YunoHost..."
|
||||||
|
|
||||||
yunohost service add uwsgi --log="/var/log/uwsgi/app/radicale.log"
|
yunohost service add uwsgi --log="/var/log/uwsgi/app/radicale.log"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE RADICALE CONFIGURATION
|
# START SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Starting a systemd service..."
|
||||||
ynh_restore_file "/etc/$app"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# BACKUP OF THE LOGROTATE CONFIGURATION
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
ynh_restore_file "/etc/logrotate.d/$app"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC FINALISATION
|
|
||||||
#=================================================
|
|
||||||
# RELOAD NGINX AND UWSGI
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Reload nginx and restart Radicale"
|
|
||||||
|
|
||||||
ynh_systemd_action --action=restart --service_name=uwsgi
|
ynh_systemd_action --action=restart --service_name=uwsgi
|
||||||
ynh_systemd_action --action=reload --service_name=nginx
|
|
||||||
|
#=================================================
|
||||||
|
# GENERIC FINALIZATION
|
||||||
|
#=================================================
|
||||||
|
# RELOAD NGINX AND PHP-FPM
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..."
|
||||||
|
|
||||||
|
ynh_systemd_action --service_name=php$phpversion-fpm --action=reload
|
||||||
|
ynh_systemd_action --service_name=nginx --action=reload
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DEACTIVE MAINTENANCE MODE
|
# DEACTIVE MAINTENANCE MODE
|
||||||
|
@ -172,4 +191,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" --last
|
||||||
|
|
137
scripts/upgrade
137
scripts/upgrade
|
@ -18,9 +18,9 @@ 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)
|
||||||
|
language=$(ynh_app_setting_get --app=$app --key=language)
|
||||||
admin=$(ynh_app_setting_get --app=$app --key=admin)
|
admin=$(ynh_app_setting_get --app=$app --key=admin)
|
||||||
infcloud=$(ynh_app_setting_get --app=$app --key=infcloud)
|
infcloud=$(ynh_app_setting_get --app=$app --key=infcloud)
|
||||||
language=$(ynh_app_setting_get --app=$app --key=language)
|
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
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)
|
||||||
|
@ -40,27 +40,38 @@ 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" --weight=1
|
||||||
|
|
||||||
|
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 unprotected_regex
|
||||||
|
|
||||||
|
@ -116,40 +127,41 @@ 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
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# Migrate legacy permissions to new system
|
|
||||||
#=================================================
|
|
||||||
if ynh_legacy_permissions_exists
|
|
||||||
then
|
|
||||||
ynh_legacy_permissions_delete_all
|
|
||||||
|
|
||||||
ynh_app_setting_delete --app=$app --key=is_public
|
|
||||||
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
|
||||||
|
|
||||||
#=================================================
|
# Cleaning legacy permissions
|
||||||
# ACTIVATE MAINTENANCE MODE
|
if ynh_legacy_permissions_exists; then
|
||||||
#=================================================
|
ynh_legacy_permissions_delete_all
|
||||||
ynh_script_progression --message="Activate maintenance mode" --weight=1
|
|
||||||
|
|
||||||
ynh_maintenance_mode_ON
|
ynh_app_setting_delete --app=$app --key=is_public
|
||||||
|
fi
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD UPGRADE STEPS
|
# CREATE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
# UPGRADE DEPENDENCIES
|
ynh_script_progression --message="Making sure dedicated system user exists..."
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Upgrade dependencies" --weight=5
|
|
||||||
|
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
# Create a dedicated user (if not existing)
|
||||||
|
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
|
@ -158,7 +170,7 @@ ynh_install_app_dependencies $pkg_dependencies
|
||||||
# Overwrite the NGINX configuration only if it's allowed
|
# Overwrite the NGINX configuration only if it's allowed
|
||||||
if [ $overwrite_nginx -eq 1 ]
|
if [ $overwrite_nginx -eq 1 ]
|
||||||
then
|
then
|
||||||
ynh_script_progression --message="Reconfigure nginx" --weight=2
|
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=2
|
||||||
ynh_add_nginx_config
|
ynh_add_nginx_config
|
||||||
if [ $infcloud -eq 1 ]
|
if [ $infcloud -eq 1 ]
|
||||||
then
|
then
|
||||||
|
@ -169,24 +181,23 @@ then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE DEDICATED USER
|
# UPGRADE DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Create a dedicated user" --weight=2
|
ynh_script_progression --message="Upgrading dependencies..." --weight=5
|
||||||
|
|
||||||
# Create a dedicated user (if not existing)
|
ynh_install_app_dependencies $pkg_dependencies
|
||||||
ynh_system_user_create $app
|
|
||||||
|
#=================================================
|
||||||
|
# PHP-FPM CONFIGURATION
|
||||||
|
#=================================================
|
||||||
|
|
||||||
if [ $infcloud -eq 1 ]
|
if [ $infcloud -eq 1 ]
|
||||||
then
|
then
|
||||||
#=================================================
|
|
||||||
# PHP-FPM CONFIGURATION
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Overwrite the php-fpm configuration only if it's allowed
|
# Overwrite the php-fpm configuration only if it's allowed
|
||||||
if [ $overwrite_phpfpm -eq 1 ]
|
if [ $overwrite_phpfpm -eq 1 ]
|
||||||
then
|
then
|
||||||
ynh_script_progression --message="Reconfigure PHP-FPM" --weight=2
|
ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=2
|
||||||
# Create a dedicated php-fpm config
|
# Create a dedicated PHP-FPM config
|
||||||
ynh_add_fpm_config
|
ynh_add_fpm_config
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -367,14 +378,6 @@ chmod 777 $final_path/default_collections $final_path/default_collections/USER
|
||||||
|
|
||||||
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
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -383,42 +386,36 @@ yunohost service add uwsgi --log="/var/log/uwsgi/app/radicale.log"
|
||||||
ynh_replace_string "__FINALPATH__" "$final_path" ../hooks/post_user_create
|
ynh_replace_string "__FINALPATH__" "$final_path" ../hooks/post_user_create
|
||||||
ynh_replace_string "__FINALPATH__" "$final_path" ../hooks/post_user_delete
|
ynh_replace_string "__FINALPATH__" "$final_path" ../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..." --weight=3
|
||||||
|
|
||||||
|
# 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..." --weight=2
|
||||||
#=================================================
|
|
||||||
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 --action=restart --service_name=uwsgi
|
||||||
# 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
|
||||||
|
@ -466,4 +463,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" --last
|
||||||
|
|
Loading…
Add table
Reference in a new issue