1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/radicale_ynh.git synced 2024-09-03 20:16:14 +02:00

Automated packaging v2 conversion

This commit is contained in:
Salamandar 2024-06-06 12:01:55 +02:00
parent 9e6dd816e2
commit c1e3b47de7
12 changed files with 282 additions and 213 deletions

View file

@ -1,6 +0,0 @@
SOURCE_URL=https://www.inf-it.com/InfCloud_0.13.1.zip
SOURCE_SUM=9fa95edd2dcc2b864a10b503ab9220895ea28d4c5541ab02117de1511d5464d4
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=zip
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=

View file

@ -163,7 +163,7 @@ type = filesystem
#custom_handler = #custom_handler =
# Folder for storing local collections, created if not present # Folder for storing local collections, created if not present
filesystem_folder = __FINALPATH__/collections filesystem_folder = __INSTALL_DIR__/collections
# Database URL for SQLAlchemy # Database URL for SQLAlchemy
# dialect+driver://user:password@host/dbname[?key=value..] # dialect+driver://user:password@host/dbname[?key=value..]

View file

@ -24,7 +24,7 @@ location @radicale {
} }
#INFCLOUD#location __PATH__/infcloud { #INFCLOUD#location __PATH__/infcloud {
#INFCLOUD# alias __FINALPATH__/infcloud; #INFCLOUD# alias __INSTALL_DIR__/infcloud;
#INFCLOUD# if ($scheme = http) { #INFCLOUD# if ($scheme = http) {
#INFCLOUD# rewrite ^ https://$server_name$request_uri? permanent; #INFCLOUD# rewrite ^ https://$server_name$request_uri? permanent;
#INFCLOUD# } #INFCLOUD# }

View file

@ -358,7 +358,7 @@ request_terminate_timeout = 1d
; Chdir to this directory at the start. ; Chdir to this directory at the start.
; Note: relative path can be used. ; Note: relative path can be used.
; Default Value: current directory or / when chroot ; Default Value: current directory or / when chroot
chdir = __FINALPATH__ chdir = __INSTALL_DIR__
; Redirect worker stdout and stderr into main error log. If not set, stdout and ; Redirect worker stdout and stderr into main error log. If not set, stdout and
; stderr will be redirected to /dev/null according to FastCGI specs. ; stderr will be redirected to /dev/null according to FastCGI specs.

73
manifest.toml Normal file
View file

@ -0,0 +1,73 @@
#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/manifest.v2.schema.json
packaging_format = 2
id = "radicale"
name = "Radicale"
description.en = "CalDAV (calendar) and CardDAV (contact) synchronization server"
description.fr = "Serveur de synchronisation CalDAV et CardDAV"
version = "1.1.6~ynh6"
maintainers = []
[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"
cpe = "???" # FIXME: optional but recommended if relevant, this is meant to contain the Common Platform Enumeration, which is sort of a standard id for applications defined by the NIST. In particular, Yunohost may use this is in the future to easily track CVE (=security reports) related to apps. The CPE may be obtained by searching here: https://nvd.nist.gov/products/cpe/search. For example, for Nextcloud, the CPE is 'cpe:2.3:a:nextcloud:nextcloud' (no need to include the version number)
fund = "???" # FIXME: optional but recommended (or remove if irrelevant / not applicable). This is meant to be an URL where people can financially support this app, especially when its development is based on volunteers and/or financed by its community. YunoHost may later advertise it in the webadmin.
[integration]
yunohost = ">= 4.3.0"
architectures = "all" # FIXME: can be replaced by a list of supported archs using the dpkg --print-architecture nomenclature (amd64/i386/armhf/arm64), for example: ["amd64", "i386"]
multi_instance = false
ldap = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "sso" key : the "ldap" key corresponds to wether or not a user *can* login on the app using its YunoHost credentials.
sso = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "ldap" key : the "sso" key corresponds to wether or not a user is *automatically logged-in* on the app when logged-in on the YunoHost portal.
disk = "50M" # FIXME: replace with an **estimate** minimum disk requirement. e.g. 20M, 400M, 1G, ...
ram.build = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ...
ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ...
[install]
[install.domain]
# this is a generic question - ask strings are automatically handled by Yunohost's core
type = "domain"
[install.path]
# this is a generic question - ask strings are automatically handled by Yunohost's core
type = "path"
default = "/radicale"
[install.language]
ask.en = "Choose your interface language"
ask.fr = "Choisissez la langue de l'interface"
type = "string"
choices = ["Czech", "Danish", "German", "English/US", "Spanish", "French", "Italian", "Japan", "Hungarian", "Dutch", "Slovak", "Turkish", "Russian", "Ukrainian", "Chinese"]
default = "English/US"
[install.admin]
# this is a generic question - ask strings are automatically handled by Yunohost's core
type = "user"
[install.infcloud]
ask.en = "Install InfCloud web interface?"
ask.fr = "Installer l'interface web InfCloud?"
type = "boolean"
default = true
[resources]
[resources.sources.main]
url = "https://www.inf-it.com/InfCloud_0.13.1.zip"
sha256 = "9fa95edd2dcc2b864a10b503ab9220895ea28d4c5541ab02117de1511d5464d4"
[resources.system_user]
[resources.install_dir]
[resources.permissions]
main.url = "/"
[resources.apt]
packages = "python-pip, python-virtualenv, virtualenv, python-dev, libldap2-dev, libsasl2-dev, libssl-dev, uwsgi, uwsgi-plugin-python"

View file

@ -4,9 +4,9 @@
# COMMON VARIABLES # COMMON VARIABLES
#================================================= #=================================================
YNH_PHP_VERSION="7.3" #REMOVEME? YNH_PHP_VERSION="7.3"
pkg_dependencies="python-pip python-virtualenv virtualenv python-dev libldap2-dev libsasl2-dev libssl-dev uwsgi uwsgi-plugin-python" #REMOVEME? pkg_dependencies="python-pip python-virtualenv virtualenv python-dev libldap2-dev libsasl2-dev libssl-dev uwsgi uwsgi-plugin-python"
#================================================= #=================================================
# BOOLEAN CONVERTER # BOOLEAN CONVERTER
@ -58,7 +58,7 @@ ynh_send_readme_to_admin() {
type="${type:-install}" type="${type:-install}"
# Get the value of admin_mail_html # Get the value of admin_mail_html
admin_mail_html=$(ynh_app_setting_get $app admin_mail_html) #REMOVEME? admin_mail_html=$(ynh_app_setting_get $app admin_mail_html)
admin_mail_html="${admin_mail_html:-0}" admin_mail_html="${admin_mail_html:-0}"
# Retrieve the email of users # Retrieve the email of users
@ -177,12 +177,12 @@ __PRE_TAG1__$(yunohost tools diagnosis | grep -B 100 "services:" | sed '/service
#================================================= #=================================================
ynh_maintenance_mode_ON () { ynh_maintenance_mode_ON () {
# Load value of $path_url and $domain from the config if their not set # Load value of $path and $domain from the config if their not set
if [ -z $path_url ]; then if [ -z $path ]; then
path_url=$(ynh_app_setting_get $app path) #REMOVEME? path=$(ynh_app_setting_get $app path)
fi fi
if [ -z $domain ]; then if [ -z $domain ]; then
domain=$(ynh_app_setting_get $app domain) #REMOVEME? domain=$(ynh_app_setting_get $app domain)
fi fi
# Create an html to serve as maintenance notice # Create an html to serve as maintenance notice
@ -207,10 +207,10 @@ ynh_maintenance_mode_ON () {
</html>" > "/var/www/html/maintenance.$app.html" </html>" > "/var/www/html/maintenance.$app.html"
# Create a new nginx config file to redirect all access to the app to the maintenance notice instead. # Create a new nginx config file to redirect all access to the app to the maintenance notice instead.
echo "# All request to the app will be redirected to ${path_url}_maintenance and fall on the maintenance notice echo "# All request to the app will be redirected to ${path}_maintenance and fall on the maintenance notice
rewrite ^${path_url}/(.*)$ ${path_url}_maintenance/? redirect; rewrite ^${path}/(.*)$ ${path}_maintenance/? redirect;
# Use another location, to not be in conflict with the original config file # Use another location, to not be in conflict with the original config file
location ${path_url}_maintenance/ { location ${path}_maintenance/ {
alias /var/www/html/ ; alias /var/www/html/ ;
try_files maintenance.$app.html =503; try_files maintenance.$app.html =503;
@ -221,7 +221,7 @@ include conf.d/yunohost_panel.conf.inc;
# The current config file will redirect all requests to the root of the app. # The current config file will redirect all requests to the root of the app.
# To keep the full path, we can use the following rewrite rule: # To keep the full path, we can use the following rewrite rule:
# rewrite ^${path_url}/(.*)$ ${path_url}_maintenance/\$1? redirect; # rewrite ^${path}/(.*)$ ${path}_maintenance/\$1? redirect;
# The difference will be in the $1 at the end, which keep the following queries. # The difference will be in the $1 at the end, which keep the following queries.
# But, if it works perfectly for a html request, there's an issue with any php files. # But, if it works perfectly for a html request, there's an issue with any php files.
# This files are treated as simple files, and will be downloaded by the browser. # This files are treated as simple files, and will be downloaded by the browser.
@ -231,16 +231,16 @@ include conf.d/yunohost_panel.conf.inc;
} }
ynh_maintenance_mode_OFF () { ynh_maintenance_mode_OFF () {
# Load value of $path_url and $domain from the config if their not set # Load value of $path and $domain from the config if their not set
if [ -z $path_url ]; then if [ -z $path ]; then
path_url=$(ynh_app_setting_get $app path) #REMOVEME? path=$(ynh_app_setting_get $app path)
fi fi
if [ -z $domain ]; then if [ -z $domain ]; then
domain=$(ynh_app_setting_get $app domain) #REMOVEME? domain=$(ynh_app_setting_get $app domain)
fi fi
# Rewrite the nginx config file to redirect from ${path_url}_maintenance to the real url of the app. # Rewrite the nginx config file to redirect from ${path}_maintenance to the real url of the app.
echo "rewrite ^${path_url}_maintenance/(.*)$ ${path_url}/\$1 redirect;" > "/etc/nginx/conf.d/$domain.d/maintenance.$app.conf" echo "rewrite ^${path}_maintenance/(.*)$ ${path}/\$1 redirect;" > "/etc/nginx/conf.d/$domain.d/maintenance.$app.conf"
systemctl reload nginx systemctl reload nginx
# Sleep 4 seconds to let the browser reload the pages and redirect the user to the app. # Sleep 4 seconds to let the browser reload the pages and redirect the user to the app.
@ -305,7 +305,7 @@ ynh_app_changelog () {
sed -i '/Merge branch .* into/d' changelog sed -i '/Merge branch .* into/d' changelog
# Get the value of admin_mail_html # Get the value of admin_mail_html
admin_mail_html=$(ynh_app_setting_get $app admin_mail_html) #REMOVEME? admin_mail_html=$(ynh_app_setting_get $app admin_mail_html)
admin_mail_html="${admin_mail_html:-0}" admin_mail_html="${admin_mail_html:-0}"
# If a html email is required. Apply html to the changelog. # If a html email is required. Apply html to the changelog.

View file

@ -14,23 +14,23 @@ source /usr/share/yunohost/helpers
# MANAGE SCRIPT FAILURE # MANAGE SCRIPT FAILURE
#================================================= #=================================================
ynh_clean_setup () { #REMOVEME? ynh_clean_setup () {
true 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 #REMOVEME? ynh_abort_if_errors
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_print_info --message="Loading installation settings..." #REMOVEME? ynh_print_info --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME #REMOVEME? app=$YNH_APP_INSTANCE_NAME
final_path=$(ynh_app_setting_get --app=$app --key=final_path) #REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
domain=$(ynh_app_setting_get --app=$app --key=domain) #REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #REMOVEME? phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
infcloud=$(ynh_app_setting_get --app=$app --key=infcloud) #REMOVEME? infcloud=$(ynh_app_setting_get --app=$app --key=infcloud)
#================================================= #=================================================
# DECLARE DATA AND CONF FILES TO BACKUP # DECLARE DATA AND CONF FILES TO BACKUP
@ -41,7 +41,7 @@ ynh_print_info --message="Declaring files to be backed up..."
# BACKUP THE APP MAIN DIR # BACKUP THE APP MAIN DIR
#================================================= #=================================================
ynh_backup --src_path="$final_path" ynh_backup --src_path="$install_dir"
ynh_backup --src_path="/opt/yunohost/$app" ynh_backup --src_path="/opt/yunohost/$app"
#================================================= #=================================================

View file

@ -13,65 +13,65 @@ source /usr/share/yunohost/helpers
# RETRIEVE ARGUMENTS # RETRIEVE ARGUMENTS
#================================================= #=================================================
old_domain=$YNH_APP_OLD_DOMAIN #REMOVEME? old_domain=$YNH_APP_OLD_DOMAIN
old_path=$YNH_APP_OLD_PATH #REMOVEME? old_path=$YNH_APP_OLD_PATH
new_domain=$YNH_APP_NEW_DOMAIN #REMOVEME? new_domain=$YNH_APP_NEW_DOMAIN
new_path=$YNH_APP_NEW_PATH #REMOVEME? new_path=$YNH_APP_NEW_PATH
app=$YNH_APP_INSTANCE_NAME #REMOVEME? app=$YNH_APP_INSTANCE_NAME
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Loading installation settings..." #REMOVEME? ynh_script_progression --message="Loading installation settings..."
# Needed for helper "ynh_add_nginx_config" #REMOVEME? # Needed for helper "ynh_add_nginx_config"
final_path=$(ynh_app_setting_get --app=$app --key=final_path) #REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
infcloud=$(ynh_app_setting_get --app=$app --key=infcloud) #REMOVEME? infcloud=$(ynh_app_setting_get --app=$app --key=infcloud)
#================================================= #=================================================
# ACTIVATE MAINTENANCE MODE # ACTIVATE MAINTENANCE MODE
#================================================= #=================================================
ynh_script_progression --message="Activate maintenance mode" ynh_script_progression --message="Activate maintenance mode"
#REMOVEME?
path_url=$old_path path=$old_path
domain=$old_domain domain=$old_domain
ynh_maintenance_mode_ON ynh_maintenance_mode_ON
#================================================= #=================================================
# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP # BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
#================================================= #=================================================
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." #REMOVEME? ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..."
# Backup the current version of the app # Backup the current version of the app
ynh_backup_before_upgrade #REMOVEME? ynh_backup_before_upgrade
ynh_clean_setup () { #REMOVEME? ynh_clean_setup () {
ynh_clean_check_starting #REMOVEME? 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. # 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" #REMOVEME? ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
# Restore it if the upgrade fails # Restore it if the upgrade fails
ynh_restore_upgradebackup #REMOVEME? 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 #REMOVEME? ynh_abort_if_errors
#================================================= #=================================================
# CHECK WHICH PARTS SHOULD BE CHANGED # CHECK WHICH PARTS SHOULD BE CHANGED
#================================================= #=================================================
change_domain=0 #REMOVEME? change_domain=0
if [ "$old_domain" != "$new_domain" ] #REMOVEME? if [ "$old_domain" != "$new_domain" ]
then then
change_domain=1 #REMOVEME? change_domain=1
fi fi
change_path=0 #REMOVEME? change_path=0
if [ "$old_path" != "$new_path" ] #REMOVEME? if [ "$old_path" != "$new_path" ]
then then
change_path=1 #REMOVEME? change_path=1
fi fi
#================================================= #=================================================
@ -81,28 +81,30 @@ fi
#================================================= #=================================================
ynh_script_progression --message="Updating NGINX web server configuration..." ynh_script_progression --message="Updating NGINX web server configuration..."
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf ynh_change_url_nginx_config
#REMOVEME? 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 --file="$nginx_conf_path" #REMOVEME? 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" #REMOVEME? domain="$old_domain"
path_url="$new_path" #REMOVEME? path="$new_path"
# Create a dedicated NGINX config # Create a dedicated NGINX config
ynh_add_nginx_config #REMOVEME? 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 --file="$nginx_conf_path" #REMOVEME? ynh_delete_file_checksum --file="$nginx_conf_path"
mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf #REMOVEME? 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 --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" #REMOVEME? ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
fi fi
#================================================= #=================================================
@ -113,7 +115,7 @@ fi
ynh_replace_string --match_string="^base_prefix = $old_path.*" --replace_string="base_prefix = ${new_path%/}/" --target_file="/etc/$app/config" ynh_replace_string --match_string="^base_prefix = $old_path.*" --replace_string="base_prefix = ${new_path%/}/" --target_file="/etc/$app/config"
if [ $infcloud -eq 1 ]; then if [ $infcloud -eq 1 ]; then
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" ynh_replace_string --match_string="href: 'https://$old_domain$old_path'," --replace_string="href: 'https://$new_domain${new_path%/}/'," --target_file="$install_dir/infcloud/config.js"
fi fi
#================================================= #=================================================
@ -127,7 +129,7 @@ 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=$app --key=skipped_regex --value="$domain_regex$new_path" #REMOVEME? ynh_app_setting_set --app=$app --key=skipped_regex --value="$domain_regex$new_path"
fi fi
#================================================= #=================================================
@ -143,16 +145,16 @@ ynh_systemd_action --service_name=uwsgi --action="restart"
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================
ynh_script_progression --message="Reloading NGINX web server..." #REMOVEME? ynh_script_progression --message="Reloading NGINX web server..."
ynh_systemd_action --service_name=nginx --action=reload #REMOVEME? #REMOVEME? ynh_systemd_action --service_name=nginx --action=reload
#================================================= #=================================================
# DEACTIVE MAINTENANCE MODE # DEACTIVE MAINTENANCE MODE
#================================================= #=================================================
ynh_script_progression --message="Disable maintenance mode" ynh_script_progression --message="Disable maintenance mode"
#REMOVEME?
path_url=$old_path path=$old_path
domain=$old_domain domain=$old_domain
ynh_maintenance_mode_OFF ynh_maintenance_mode_OFF

View file

@ -13,23 +13,23 @@ source /usr/share/yunohost/helpers
# MANAGE SCRIPT FAILURE # MANAGE SCRIPT FAILURE
#================================================= #=================================================
ynh_clean_setup () { #REMOVEME? ynh_clean_setup () {
ynh_clean_check_starting 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 #REMOVEME? ynh_abort_if_errors
#================================================= #=================================================
# RETRIEVE ARGUMENTS FROM THE MANIFEST # RETRIEVE ARGUMENTS FROM THE MANIFEST
#================================================= #=================================================
domain=$YNH_APP_ARG_DOMAIN #REMOVEME? domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH #REMOVEME? path=$YNH_APP_ARG_PATH
language=$YNH_APP_ARG_LANGUAGE #REMOVEME? language=$YNH_APP_ARG_LANGUAGE
admin=$YNH_APP_ARG_ADMIN #REMOVEME? admin=$YNH_APP_ARG_ADMIN
infcloud=$YNH_APP_ARG_INFCLOUD #REMOVEME? infcloud=$YNH_APP_ARG_INFCLOUD
app=$YNH_APP_INSTANCE_NAME #REMOVEME? app=$YNH_APP_INSTANCE_NAME
# Retrieve the version number in the manifest file. # Retrieve the version number in the manifest file.
version=$(ynh_app_upstream_version) version=$(ynh_app_upstream_version)
@ -37,22 +37,22 @@ version=$(ynh_app_upstream_version)
#================================================= #=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#================================================= #=================================================
ynh_script_progression --message="Validating installation parameters..." #REMOVEME? ynh_script_progression --message="Validating installation parameters..."
final_path=/var/www/$app #REMOVEME? install_dir=/var/www/$app
test ! -e "$final_path" || ynh_die --message="This path already contains a folder" #REMOVEME? test ! -e "$install_dir" || ynh_die --message="This path already contains a folder"
# Register (book) web path # Register (book) web path
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url #REMOVEME? ynh_webpath_register --app=$app --domain=$domain --path=$path
#================================================= #=================================================
# STORE SETTINGS FROM MANIFEST # STORE SETTINGS FROM MANIFEST
#================================================= #=================================================
ynh_script_progression --message="Storing installation settings..." #REMOVEME? ynh_script_progression --message="Storing installation settings..."
ynh_app_setting_set --app=$app --key=domain --value=$domain #REMOVEME? ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set --app=$app --key=path --value=$path_url #REMOVEME? ynh_app_setting_set --app=$app --key=path --value=$path
ynh_app_setting_set --app=$app --key=admin --value=$admin #REMOVEME? ynh_app_setting_set --app=$app --key=admin --value=$admin
ynh_app_setting_set --app=$app --key=infcloud --value=$infcloud 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=$app --key=version --value=$version
@ -61,53 +61,53 @@ ynh_app_setting_set --app=$app --key=overwrite_config --value="1"
ynh_app_setting_set --app=$app --key=overwrite_infcloud --value="1" ynh_app_setting_set --app=$app --key=overwrite_infcloud --value="1"
ynh_app_setting_set --app=$app --key=overwrite_nginx --value="1" ynh_app_setting_set --app=$app --key=overwrite_nginx --value="1"
ynh_app_setting_set --app=$app --key=overwrite_phpfpm --value="1" ynh_app_setting_set --app=$app --key=overwrite_phpfpm --value="1"
ynh_app_setting_set --app=$app --key=admin_mail_html --value="1" #REMOVEME? ynh_app_setting_set --app=$app --key=admin_mail_html --value="1"
#================================================= #=================================================
# STANDARD MODIFICATIONS # STANDARD MODIFICATIONS
#================================================= #=================================================
# INSTALL DEPENDENCIES # INSTALL DEPENDENCIES
#================================================= #=================================================
ynh_script_progression --message="Installing dependencies..." #REMOVEME? ynh_script_progression --message="Installing dependencies..."
ynh_install_app_dependencies $pkg_dependencies #REMOVEME? ynh_install_app_dependencies $pkg_dependencies
#================================================= #=================================================
# CREATE DEDICATED USER # CREATE DEDICATED USER
#================================================= #=================================================
ynh_script_progression --message="Configuring system user..." #REMOVEME? ynh_script_progression --message="Configuring system user..."
# Create a system user # Create a system user
ynh_system_user_create --username=$app --home_dir="$final_path" #REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir"
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
ynh_script_progression --message="Setting up source files..." ynh_script_progression --message="Setting up source files..."
ynh_app_setting_set --app=$app --key=final_path --value=$final_path #REMOVEME? ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir
# Create the directory and set the path in the config # Create the directory and set the path in the config
mkdir -p "$final_path/collections" mkdir -p "$install_dir/collections"
# Copy files to the right place # Copy files to the right place
cp ../conf/radicale.wsgi $final_path cp ../conf/radicale.wsgi $install_dir
# Copy extra files # Copy extra files
cp -a ../sources/extra_files_radicale/. "$final_path" cp -a ../sources/extra_files_radicale/. "$install_dir"
if [ $infcloud -eq 1 ] if [ $infcloud -eq 1 ]
then then
# Download and uncompress the source into final_path # Download and uncompress the source into install_dir
ynh_setup_source --dest_dir="$final_path/infcloud" ynh_setup_source --dest_dir="$install_dir/infcloud"
fi fi
chmod 750 "$final_path" chmod 750 "$install_dir"
chmod -R o-rwx "$final_path" chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$final_path" chown -R $app:www-data "$install_dir"
# Set default permissions as radicale do. # Set default permissions as radicale do.
chmod 666 -R $final_path/default_collections chmod 666 -R $install_dir/default_collections
chmod 777 $final_path/default_collections $final_path/default_collections/USER chmod 777 $install_dir/default_collections $install_dir/default_collections/USER
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
@ -134,7 +134,7 @@ then
# Create a dedicated PHP-FPM config # Create a dedicated PHP-FPM config
ynh_add_fpm_config ynh_add_fpm_config
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #REMOVEME? phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
fi fi
#================================================= #=================================================
@ -146,11 +146,11 @@ ynh_script_progression --message="Install Radicale in a virtualenv"
# Init virtualenv # Init virtualenv
virtualenv /opt/yunohost/$app virtualenv /opt/yunohost/$app
version=$(ynh_app_setting_get --app=$app --key=version) #REMOVEME? version=$(ynh_app_setting_get --app=$app --key=version)
/opt/yunohost/$app/bin/pip install radicale==$version python-ldap /opt/yunohost/$app/bin/pip install radicale==$version python-ldap
# 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 "$install_dir/regex.py" /opt/yunohost/$app/lib/python*/site-packages/radicale/rights/regex.py
# useradd radicale -d /opt/yunohost/$app # useradd radicale -d /opt/yunohost/$app
chown radicale: -R /opt/yunohost/$app chown radicale: -R /opt/yunohost/$app
@ -212,10 +212,10 @@ then
esac esac
ynh_app_setting_set --app=$app --key=language --value=$language ynh_app_setting_set --app=$app --key=language --value=$language
timezone=$(cat /etc/timezone) timezone=$(cat /etc/timezone)
ynh_add_config --template="../conf/config.js" --destination="$final_path/infcloud/config.js" ynh_add_config --template="../conf/config.js" --destination="$install_dir/infcloud/config.js"
chmod 440 "$final_path/infcloud/config.js" chmod 440 "$install_dir/infcloud/config.js"
chown $app:www-data "$final_path/infcloud/config.js" chown $app:www-data "$install_dir/infcloud/config.js"
fi fi
#================================================= #=================================================
@ -226,8 +226,8 @@ ynh_script_progression --message="Generate calendars and address books for all u
# Create default calendars and address books for each users # Create default calendars and address books for each users
while read user while read user
do do
cp -a $final_path/default_collections/USER $final_path/collections/$user cp -a $install_dir/default_collections/USER $install_dir/collections/$user
cp -a $final_path/default_collections/USER.props $final_path/collections/$user.props cp -a $install_dir/default_collections/USER.props $install_dir/collections/$user.props
# 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-)"
@ -236,8 +236,8 @@ done <<< "$(yunohost user list | grep username | cut -d ":" -f 2 | cut -c 2-)"
#================================================= #=================================================
# 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 --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="../hooks/post_user_create" ynh_replace_string --match_string="__INSTALL_DIR__" --replace_string="$install_dir" --target_file="../hooks/post_user_create"
ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="../hooks/post_user_delete" ynh_replace_string --match_string="__INSTALL_DIR__" --replace_string="$install_dir" --target_file="../hooks/post_user_delete"
#================================================= #=================================================
# SETUP SYSTEMD # SETUP SYSTEMD
@ -279,18 +279,18 @@ ynh_systemd_action --service_name=uwsgi --action="restart"
#================================================= #=================================================
# SETUP SSOWAT # SETUP SSOWAT
#================================================= #=================================================
ynh_script_progression --message="Configuring permissions..." #REMOVEME? ynh_script_progression --message="Configuring permissions..."
if [ $infcloud -eq 1 ] if [ $infcloud -eq 1 ]
then then
# Add /infcloud to the path of radicale to access it from the portal # Add /infcloud to the path of radicale to access it from the portal
# Replace radicale by InfCloud into YunoHost portal # Replace radicale by InfCloud into YunoHost portal
ynh_app_setting_set --app=$app --key=path --value="${path_url%/}/infcloud" #REMOVEME? ynh_app_setting_set --app=$app --key=path --value="${path%/}/infcloud"
# Protect InfCloud access # Protect InfCloud access
ynh_app_setting_set --app=$app --key=protected_uris --value="/" ynh_app_setting_set --app=$app --key=protected_uris --value="/"
domain_regex=$(echo "$domain" | sed 's@-@.@g') domain_regex=$(echo "$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=$app --key=skipped_regex --value="$domain_regex$path_url" #REMOVEME? ynh_app_setting_set --app=$app --key=skipped_regex --value="$domain_regex$path"
else else
# If only radicale is installed # If only radicale is installed
# Radicale is always accessible (For access to ressources) # Radicale is always accessible (For access to ressources)
@ -300,9 +300,9 @@ fi
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================
ynh_script_progression --message="Reloading NGINX web server..." #REMOVEME? ynh_script_progression --message="Reloading NGINX web server..."
ynh_systemd_action --service_name=nginx --action=reload #REMOVEME? ynh_systemd_action --service_name=nginx --action=reload
#================================================= #=================================================
# SEND A README FOR THE ADMIN # SEND A README FOR THE ADMIN
@ -314,7 +314,7 @@ admin_panel="https://$(grep portal_domain /etc/ssowat/conf.json | cut -d'"' -f4)
if [ $infcloud -eq 1 ] if [ $infcloud -eq 1 ]
then then
infcloud_config=" infcloud_config="
InfCloud has its own config file, at $final_path/infcloud/config.js InfCloud has its own config file, at $install_dir/infcloud/config.js
" "
else else
infcloud_config="" infcloud_config=""

View file

@ -12,12 +12,12 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Loading installation settings..." #REMOVEME? ynh_script_progression --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME #REMOVEME? app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain) #REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain)
final_path=$(ynh_app_setting_get --app=$app --key=final_path) #REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
#================================================= #=================================================
# STANDARD REMOVE # STANDARD REMOVE
@ -58,10 +58,10 @@ ynh_remove_logrotate
#================================================= #=================================================
# REMOVE APP MAIN DIR # REMOVE APP MAIN DIR
#================================================= #=================================================
ynh_script_progression --message="Removing app main directory..." #REMOVEME? ynh_script_progression --message="Removing app main directory..."
# Remove the app directory securely # Remove the app directory securely
ynh_secure_remove --file="$final_path" #REMOVEME? ynh_secure_remove --file="$install_dir"
ynh_secure_remove --file="/opt/yunohost/$app" ynh_secure_remove --file="/opt/yunohost/$app"
#================================================= #=================================================
@ -83,10 +83,10 @@ ynh_remove_fpm_config
#================================================= #=================================================
# REMOVE DEPENDENCIES # REMOVE DEPENDENCIES
#================================================= #=================================================
ynh_script_progression --message="Removing dependencies..." #REMOVEME? ynh_script_progression --message="Removing dependencies..."
# Remove metapackage and its dependencies # Remove metapackage and its dependencies
ynh_remove_app_dependencies #REMOVEME? ynh_remove_app_dependencies
#================================================= #=================================================
# SPECIFIC REMOVE # SPECIFIC REMOVE
@ -103,10 +103,10 @@ ynh_secure_remove --file="/etc/$app"
#================================================= #=================================================
# REMOVE DEDICATED USER # REMOVE DEDICATED USER
#================================================= #=================================================
ynh_script_progression --message="Removing the dedicated system user..." #REMOVEME? ynh_script_progression --message="Removing the dedicated system user..."
# Delete a system user # Delete a system user
ynh_system_user_delete --username=$app #REMOVEME? ynh_system_user_delete --username=$app
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT

View file

@ -14,33 +14,33 @@ source /usr/share/yunohost/helpers
# MANAGE SCRIPT FAILURE # MANAGE SCRIPT FAILURE
#================================================= #=================================================
ynh_clean_setup () { #REMOVEME? ynh_clean_setup () {
ynh_clean_check_starting 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 #REMOVEME? ynh_abort_if_errors
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Loading installation settings..." #REMOVEME? ynh_script_progression --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME #REMOVEME? app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain) #REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path) #REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path) #REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #REMOVEME? phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
admin=$(ynh_app_setting_get --app=$app --key=admin) #REMOVEME? admin=$(ynh_app_setting_get --app=$app --key=admin)
infcloud=$(ynh_app_setting_get --app=$app --key=infcloud) #REMOVEME? 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..." #REMOVEME? ynh_script_progression --message="Validating restoration parameters..."
test ! -d $final_path \ #REMOVEME? test ! -d $install_dir \
|| ynh_die --message="There is already a directory: $final_path " || ynh_die --message="There is already a directory: $install_dir "
test ! -d "/opt/yunohost/$app" \ test ! -d "/opt/yunohost/$app" \
|| ynh_die --message="There is already a directory: /opt/yunohost/$app " || ynh_die --message="There is already a directory: /opt/yunohost/$app "
@ -63,21 +63,21 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#================================================= #=================================================
# RECREATE THE DEDICATED USER # RECREATE THE DEDICATED USER
#================================================= #=================================================
ynh_script_progression --message="Recreating the dedicated system user..." #REMOVEME? ynh_script_progression --message="Recreating the dedicated system user..."
# Create the dedicated user (if not existing) # Create the dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir="$final_path" #REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir"
#================================================= #=================================================
# RESTORE THE APP MAIN DIR # RESTORE THE APP MAIN DIR
#================================================= #=================================================
ynh_script_progression --message="Restoring the app main directory..." ynh_script_progression --message="Restoring the app main directory..."
ynh_restore_file --origin_path="$final_path" ynh_restore_file --origin_path="$install_dir"
chmod 750 "$final_path" chmod 750 "$install_dir"
chmod -R o-rwx "$final_path" chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$final_path" chown -R $app:www-data "$install_dir"
mkdir -p /opt/yunohost mkdir -p /opt/yunohost
ynh_restore_file --origin_path="/opt/yunohost/$app" ynh_restore_file --origin_path="/opt/yunohost/$app"
@ -101,10 +101,10 @@ fi
#================================================= #=================================================
# REINSTALL DEPENDENCIES # REINSTALL DEPENDENCIES
#================================================= #=================================================
ynh_script_progression --message="Reinstalling dependencies..." #REMOVEME? ynh_script_progression --message="Reinstalling dependencies..."
# Define and install dependencies # Define and install dependencies
ynh_install_app_dependencies $pkg_dependencies #REMOVEME? ynh_install_app_dependencies $pkg_dependencies
#================================================= #=================================================
# RESTORE VARIOUS FILES # RESTORE VARIOUS FILES
@ -177,7 +177,7 @@ admin_panel="https://$(grep portal_domain /etc/ssowat/conf.json | cut -d'"' -f4)
if [ $infcloud -eq 1 ] if [ $infcloud -eq 1 ]
then then
infcloud_config=" infcloud_config="
InfCloud has its own config file, at $final_path/infcloud/config.js InfCloud has its own config file, at $install_dir/infcloud/config.js
" "
else else
infcloud_config="" infcloud_config=""

View file

@ -12,30 +12,30 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Loading installation settings..." #REMOVEME? ynh_script_progression --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME #REMOVEME? app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain) #REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path) #REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path)
language=$(ynh_app_setting_get --app=$app --key=language) #REMOVEME? language=$(ynh_app_setting_get --app=$app --key=language)
admin=$(ynh_app_setting_get --app=$app --key=admin) #REMOVEME? admin=$(ynh_app_setting_get --app=$app --key=admin)
final_path=$(ynh_app_setting_get --app=$app --key=final_path) #REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
infcloud=$(ynh_app_setting_get --app=$app --key=infcloud) #REMOVEME? infcloud=$(ynh_app_setting_get --app=$app --key=infcloud)
version=$(ynh_app_setting_get --app=$app --key=version) #REMOVEME? version=$(ynh_app_setting_get --app=$app --key=version)
overwrite_logging=$(ynh_app_setting_get --app=$app --key=overwrite_logging) #REMOVEME? overwrite_logging=$(ynh_app_setting_get --app=$app --key=overwrite_logging)
overwrite_config=$(ynh_app_setting_get --app=$app --key=overwrite_config) #REMOVEME? overwrite_config=$(ynh_app_setting_get --app=$app --key=overwrite_config)
overwrite_infcloud=$(ynh_app_setting_get --app=$app --key=overwrite_infcloud) #REMOVEME? overwrite_infcloud=$(ynh_app_setting_get --app=$app --key=overwrite_infcloud)
overwrite_nginx=$(ynh_app_setting_get --app=$app --key=overwrite_nginx) #REMOVEME? overwrite_nginx=$(ynh_app_setting_get --app=$app --key=overwrite_nginx)
overwrite_phpfpm=$(ynh_app_setting_get --app=$app --key=overwrite_phpfpm) #REMOVEME? overwrite_phpfpm=$(ynh_app_setting_get --app=$app --key=overwrite_phpfpm)
# Optional parameters from config-panel feature # Optional parameters from config-panel feature
firstdayofweek=$(ynh_app_setting_get --app=$app --key=firstdayofweek) #REMOVEME? firstdayofweek=$(ynh_app_setting_get --app=$app --key=firstdayofweek)
activeview=$(ynh_app_setting_get --app=$app --key=activeview) #REMOVEME? activeview=$(ynh_app_setting_get --app=$app --key=activeview)
openformmode=$(ynh_app_setting_get --app=$app --key=openformmode) #REMOVEME? openformmode=$(ynh_app_setting_get --app=$app --key=openformmode)
startofbusiness=$(ynh_app_setting_get --app=$app --key=startofbusiness) #REMOVEME? startofbusiness=$(ynh_app_setting_get --app=$app --key=startofbusiness)
endofbusiness=$(ynh_app_setting_get --app=$app --key=endofbusiness) #REMOVEME? endofbusiness=$(ynh_app_setting_get --app=$app --key=endofbusiness)
defaulteventduration=$(ynh_app_setting_get --app=$app --key=defaulteventduration) #REMOVEME? defaulteventduration=$(ynh_app_setting_get --app=$app --key=defaulteventduration)
#================================================= #=================================================
# CHECK VERSION # CHECK VERSION
@ -47,17 +47,17 @@ upgrade_type=$(ynh_check_app_version_changed)
#================================================= #=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#================================================= #=================================================
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." #REMOVEME? 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 #REMOVEME? ynh_backup_before_upgrade
ynh_clean_setup () { #REMOVEME? ynh_clean_setup () {
ynh_clean_check_starting ynh_clean_check_starting
# Restore it if the upgrade fails # Restore it if the upgrade fails
ynh_restore_upgradebackup #REMOVEME? 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 #REMOVEME? ynh_abort_if_errors
#================================================= #=================================================
# ACTIVATE MAINTENANCE MODE # ACTIVATE MAINTENANCE MODE
@ -128,8 +128,8 @@ if [ -z "$overwrite_phpfpm" ]; then
fi fi
# Cleaning legacy permissions # Cleaning legacy permissions
if ynh_legacy_permissions_exists; then #REMOVEME? if ynh_legacy_permissions_exists; then
ynh_legacy_permissions_delete_all #REMOVEME? 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
@ -137,10 +137,10 @@ fi
#================================================= #=================================================
# CREATE DEDICATED USER # CREATE DEDICATED USER
#================================================= #=================================================
ynh_script_progression --message="Making sure dedicated system user exists..." #REMOVEME? 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 --username=$app --home_dir="$final_path" #REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir"
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
@ -151,27 +151,27 @@ then
ynh_script_progression --message="Upgrading source files..." ynh_script_progression --message="Upgrading source files..."
# Copy files to the right place # Copy files to the right place
mkdir -p $final_path/collections mkdir -p $install_dir/collections
# Copy files to the right place # Copy files to the right place
cp ../conf/radicale.wsgi $final_path cp ../conf/radicale.wsgi $install_dir
# Copy extra files # Copy extra files
cp -a ../sources/extra_files_radicale/. "$final_path" cp -a ../sources/extra_files_radicale/. "$install_dir"
if [ $infcloud -eq 1 ] if [ $infcloud -eq 1 ]
then then
# Download and uncompress the source into final_path # Download and uncompress the source into install_dir
ynh_setup_source --dest_dir="$final_path/infcloud" --keep="config.js" ynh_setup_source --dest_dir="$install_dir/infcloud" --keep="config.js"
fi fi
fi fi
chmod 750 "$final_path" chmod 750 "$install_dir"
chmod -R o-rwx "$final_path" chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$final_path" chown -R $app:www-data "$install_dir"
chmod 666 -R $final_path/default_collections chmod 666 -R $install_dir/default_collections
chmod 777 $final_path/default_collections $final_path/default_collections/USER chmod 777 $install_dir/default_collections $install_dir/default_collections/USER
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
@ -195,9 +195,9 @@ fi
#================================================= #=================================================
# UPGRADE DEPENDENCIES # UPGRADE DEPENDENCIES
#================================================= #=================================================
ynh_script_progression --message="Upgrading dependencies..." #REMOVEME? ynh_script_progression --message="Upgrading dependencies..."
ynh_install_app_dependencies $pkg_dependencies #REMOVEME? ynh_install_app_dependencies $pkg_dependencies
#================================================= #=================================================
# PHP-FPM CONFIGURATION # PHP-FPM CONFIGURATION
@ -213,7 +213,7 @@ then
# Create a dedicated PHP-FPM config # Create a dedicated PHP-FPM config
ynh_add_fpm_config ynh_add_fpm_config
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #REMOVEME? phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
fi fi
fi fi
@ -229,11 +229,11 @@ then
# Upgrade pip packages # Upgrade pip packages
ynh_secure_remove --file="/opt/yunohost/$app" ynh_secure_remove --file="/opt/yunohost/$app"
virtualenv /opt/yunohost/$app virtualenv /opt/yunohost/$app
version=$(ynh_app_setting_get $app version $version) #REMOVEME? version=$(ynh_app_setting_get $app version $version)
bash -c "source /opt/yunohost/radicale/bin/activate && pip install radicale==$version python-ldap" bash -c "source /opt/yunohost/radicale/bin/activate && pip install radicale==$version python-ldap"
# 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 "$install_dir/regex.py" /opt/yunohost/$app/lib/python*/site-packages/radicale/rights/regex.py
fi fi
chown radicale: -R /opt/yunohost/$app chown radicale: -R /opt/yunohost/$app
@ -301,31 +301,31 @@ then
esac esac
ynh_app_setting_set --app=$app --key=language --value=$language ynh_app_setting_set --app=$app --key=language --value=$language
timezone=$(cat /etc/timezone) timezone=$(cat /etc/timezone)
ynh_add_config --template="../conf/config.js" --destination="$final_path/infcloud/config.js" ynh_add_config --template="../conf/config.js" --destination="$install_dir/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 --match_string="\(^var globalDatepickerFirstDayOfWeek=\).*" --replace_string="\1$firstdayofweek;" --target_file="$final_path/infcloud/config.js" ynh_replace_string --match_string="\(^var globalDatepickerFirstDayOfWeek=\).*" --replace_string="\1$firstdayofweek;" --target_file="$install_dir/infcloud/config.js"
fi fi
if [ -n "$activeview" ]; then if [ -n "$activeview" ]; then
ynh_replace_string --match_string="\(^var globalActiveView=\).*" --replace_string="\1\'$activeview\';" --target_file="$final_path/infcloud/config.js" ynh_replace_string --match_string="\(^var globalActiveView=\).*" --replace_string="\1\'$activeview\';" --target_file="$install_dir/infcloud/config.js"
fi fi
if [ -n "$openformmode" ]; then if [ -n "$openformmode" ]; then
ynh_replace_string --match_string="\(^var globalOpenFormMode=\).*" --replace_string="\1\'$openformmode\';" --target_file="$final_path/infcloud/config.js" ynh_replace_string --match_string="\(^var globalOpenFormMode=\).*" --replace_string="\1\'$openformmode\';" --target_file="$install_dir/infcloud/config.js"
fi fi
if [ -n "$startofbusiness" ]; then if [ -n "$startofbusiness" ]; then
ynh_replace_string --match_string="\(^var globalCalendarStartOfBusiness=\).*" --replace_string="\1$startofbusiness;" --target_file="$final_path/infcloud/config.js" ynh_replace_string --match_string="\(^var globalCalendarStartOfBusiness=\).*" --replace_string="\1$startofbusiness;" --target_file="$install_dir/infcloud/config.js"
fi fi
if [ -n "$endofbusiness" ]; then if [ -n "$endofbusiness" ]; then
ynh_replace_string --match_string="\(^var globalCalendarEndOfBusiness=\).*" --replace_string="\1$endofbusiness;" --target_file="$final_path/infcloud/config.js" ynh_replace_string --match_string="\(^var globalCalendarEndOfBusiness=\).*" --replace_string="\1$endofbusiness;" --target_file="$install_dir/infcloud/config.js"
fi fi
if [ -n "$defaulteventduration" ]; then if [ -n "$defaulteventduration" ]; then
ynh_replace_string --match_string="\(^var globalDefaultEventDuration=\).*" --replace_string="\1$defaulteventduration;" --target_file="$final_path/infcloud/config.js" ynh_replace_string --match_string="\(^var globalDefaultEventDuration=\).*" --replace_string="\1$defaulteventduration;" --target_file="$install_dir/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 --file="$final_path/infcloud/config.js" ynh_store_file_checksum --file="$install_dir/infcloud/config.js"
chmod 440 "$final_path/infcloud/config.js" chmod 440 "$install_dir/infcloud/config.js"
chown $app:www-data "$final_path/infcloud/config.js" chown $app:www-data "$install_dir/infcloud/config.js"
fi fi
fi fi
@ -340,8 +340,8 @@ cp ../conf/radicale.ini /etc/uwsgi/apps-available/
#================================================= #=================================================
# 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 --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="../hooks/post_user_create" ynh_replace_string --match_string="__INSTALL_DIR__" --replace_string="$install_dir" --target_file="../hooks/post_user_create"
ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="../hooks/post_user_delete" ynh_replace_string --match_string="__INSTALL_DIR__" --replace_string="$install_dir" --target_file="../hooks/post_user_delete"
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
@ -374,9 +374,9 @@ ynh_systemd_action --service_name=uwsgi --action="restart"
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================
ynh_script_progression --message="Reloading NGINX web server..." #REMOVEME? ynh_script_progression --message="Reloading NGINX web server..."
ynh_systemd_action --service_name=nginx --action=reload #REMOVEME? ynh_systemd_action --service_name=nginx --action=reload
#================================================= #=================================================
# DEACTIVE MAINTENANCE MODE # DEACTIVE MAINTENANCE MODE
@ -398,7 +398,7 @@ ynh_app_changelog || true
if [ $infcloud -eq 1 ] if [ $infcloud -eq 1 ]
then then
infcloud_config=" infcloud_config="
InfCloud has its own config file, at $final_path/infcloud/config.js InfCloud has its own config file, at $install_dir/infcloud/config.js
" "
else else
infcloud_config="" infcloud_config=""