diff --git a/conf/app.src b/conf/app.src deleted file mode 100644 index 8594be2..0000000 --- a/conf/app.src +++ /dev/null @@ -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= diff --git a/conf/config b/conf/config index 91c9dab..c471ea2 100644 --- a/conf/config +++ b/conf/config @@ -163,7 +163,7 @@ type = filesystem #custom_handler = # Folder for storing local collections, created if not present -filesystem_folder = __FINALPATH__/collections +filesystem_folder = __INSTALL_DIR__/collections # Database URL for SQLAlchemy # dialect+driver://user:password@host/dbname[?key=value..] diff --git a/conf/nginx.conf b/conf/nginx.conf index f947c3d..eed541d 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -24,7 +24,7 @@ location @radicale { } #INFCLOUD#location __PATH__/infcloud { -#INFCLOUD# alias __FINALPATH__/infcloud; +#INFCLOUD# alias __INSTALL_DIR__/infcloud; #INFCLOUD# if ($scheme = http) { #INFCLOUD# rewrite ^ https://$server_name$request_uri? permanent; #INFCLOUD# } diff --git a/conf/php-fpm.conf b/conf/php-fpm.conf index ba7bb38..70ce8ec 100644 --- a/conf/php-fpm.conf +++ b/conf/php-fpm.conf @@ -358,7 +358,7 @@ request_terminate_timeout = 1d ; Chdir to this directory at the start. ; Note: relative path can be used. ; 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 ; stderr will be redirected to /dev/null according to FastCGI specs. diff --git a/manifest.toml b/manifest.toml new file mode 100644 index 0000000..4673a6c --- /dev/null +++ b/manifest.toml @@ -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" diff --git a/scripts/_common.sh b/scripts/_common.sh index 3f2693c..8668b06 100755 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,9 +4,9 @@ # 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 @@ -58,7 +58,7 @@ ynh_send_readme_to_admin() { type="${type:-install}" # 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}" # Retrieve the email of users @@ -177,12 +177,12 @@ __PRE_TAG1__$(yunohost tools diagnosis | grep -B 100 "services:" | sed '/service #================================================= ynh_maintenance_mode_ON () { - # Load value of $path_url and $domain from the config if their not set - if [ -z $path_url ]; then - path_url=$(ynh_app_setting_get $app path) + # Load value of $path and $domain from the config if their not set + if [ -z $path ]; then +#REMOVEME? path=$(ynh_app_setting_get $app path) fi if [ -z $domain ]; then - domain=$(ynh_app_setting_get $app domain) +#REMOVEME? domain=$(ynh_app_setting_get $app domain) fi # Create an html to serve as maintenance notice @@ -207,10 +207,10 @@ ynh_maintenance_mode_ON () { " > "/var/www/html/maintenance.$app.html" # 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 -rewrite ^${path_url}/(.*)$ ${path_url}_maintenance/? redirect; + echo "# All request to the app will be redirected to ${path}_maintenance and fall on the maintenance notice +rewrite ^${path}/(.*)$ ${path}_maintenance/? redirect; # Use another location, to not be in conflict with the original config file -location ${path_url}_maintenance/ { +location ${path}_maintenance/ { alias /var/www/html/ ; 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. # 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. # 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. @@ -231,16 +231,16 @@ include conf.d/yunohost_panel.conf.inc; } ynh_maintenance_mode_OFF () { - # Load value of $path_url and $domain from the config if their not set - if [ -z $path_url ]; then - path_url=$(ynh_app_setting_get $app path) + # Load value of $path and $domain from the config if their not set + if [ -z $path ]; then +#REMOVEME? path=$(ynh_app_setting_get $app path) fi if [ -z $domain ]; then - domain=$(ynh_app_setting_get $app domain) +#REMOVEME? domain=$(ynh_app_setting_get $app domain) fi - # Rewrite the nginx config file to redirect from ${path_url}_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" + # Rewrite the nginx config file to redirect from ${path}_maintenance to the real url of the app. + echo "rewrite ^${path}_maintenance/(.*)$ ${path}/\$1 redirect;" > "/etc/nginx/conf.d/$domain.d/maintenance.$app.conf" systemctl reload nginx # 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 # 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}" # If a html email is required. Apply html to the changelog. diff --git a/scripts/backup b/scripts/backup index 624e324..1b36a54 100644 --- a/scripts/backup +++ b/scripts/backup @@ -14,23 +14,23 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= -ynh_clean_setup () { +#REMOVEME? ynh_clean_setup () { true } # Exit if an error occurs during the execution of the script -ynh_abort_if_errors +#REMOVEME? ynh_abort_if_errors #================================================= # 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) -domain=$(ynh_app_setting_get --app=$app --key=domain) -phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) -infcloud=$(ynh_app_setting_get --app=$app --key=infcloud) +#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) +#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) +#REMOVEME? phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) +#REMOVEME? infcloud=$(ynh_app_setting_get --app=$app --key=infcloud) #================================================= # 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 #================================================= -ynh_backup --src_path="$final_path" +ynh_backup --src_path="$install_dir" ynh_backup --src_path="/opt/yunohost/$app" #================================================= diff --git a/scripts/change_url b/scripts/change_url index 829e4ac..665b175 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -13,65 +13,65 @@ source /usr/share/yunohost/helpers # RETRIEVE ARGUMENTS #================================================= -old_domain=$YNH_APP_OLD_DOMAIN -old_path=$YNH_APP_OLD_PATH +#REMOVEME? old_domain=$YNH_APP_OLD_DOMAIN +#REMOVEME? old_path=$YNH_APP_OLD_PATH -new_domain=$YNH_APP_NEW_DOMAIN -new_path=$YNH_APP_NEW_PATH +#REMOVEME? new_domain=$YNH_APP_NEW_DOMAIN +#REMOVEME? new_path=$YNH_APP_NEW_PATH -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? app=$YNH_APP_INSTANCE_NAME #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." +#REMOVEME? ynh_script_progression --message="Loading installation settings..." -# Needed for helper "ynh_add_nginx_config" -final_path=$(ynh_app_setting_get --app=$app --key=final_path) +#REMOVEME? # Needed for helper "ynh_add_nginx_config" +#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 #================================================= ynh_script_progression --message="Activate maintenance mode" - -path_url=$old_path +#REMOVEME? +path=$old_path domain=$old_domain ynh_maintenance_mode_ON #================================================= # BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP #================================================= -ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." +#REMOVEME? 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 +#REMOVEME? ynh_backup_before_upgrade +#REMOVEME? ynh_clean_setup () { + #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. - 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 - ynh_restore_upgradebackup +#REMOVEME? ynh_restore_upgradebackup } # 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 #================================================= -change_domain=0 -if [ "$old_domain" != "$new_domain" ] +#REMOVEME? change_domain=0 +#REMOVEME? if [ "$old_domain" != "$new_domain" ] then - change_domain=1 + #REMOVEME? change_domain=1 fi -change_path=0 -if [ "$old_path" != "$new_path" ] +#REMOVEME? change_path=0 +#REMOVEME? if [ "$old_path" != "$new_path" ] then - change_path=1 + #REMOVEME? change_path=1 fi #================================================= @@ -81,28 +81,30 @@ fi #================================================= 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 if [ $change_path -eq 1 ] then # 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 - domain="$old_domain" - path_url="$new_path" +#REMOVEME? domain="$old_domain" +#REMOVEME? path="$new_path" # Create a dedicated NGINX config - ynh_add_nginx_config +#REMOVEME? ynh_add_nginx_config fi # Change the domain for NGINX if [ $change_domain -eq 1 ] then # Delete file checksum for the old conf file location - ynh_delete_file_checksum --file="$nginx_conf_path" - mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf +#REMOVEME? ynh_delete_file_checksum --file="$nginx_conf_path" +#REMOVEME? mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf # 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 #================================================= @@ -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" 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 #================================================= @@ -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 domain_regex=$(echo "$new_domain" | sed 's@-@.@g') # 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 #================================================= @@ -143,16 +145,16 @@ ynh_systemd_action --service_name=uwsgi --action="restart" #================================================= # 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 #================================================= ynh_script_progression --message="Disable maintenance mode" - -path_url=$old_path +#REMOVEME? +path=$old_path domain=$old_domain ynh_maintenance_mode_OFF diff --git a/scripts/install b/scripts/install index 77ff61a..2fbf93a 100755 --- a/scripts/install +++ b/scripts/install @@ -13,23 +13,23 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= -ynh_clean_setup () { +#REMOVEME? ynh_clean_setup () { ynh_clean_check_starting } # 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 #================================================= -domain=$YNH_APP_ARG_DOMAIN -path_url=$YNH_APP_ARG_PATH -language=$YNH_APP_ARG_LANGUAGE -admin=$YNH_APP_ARG_ADMIN -infcloud=$YNH_APP_ARG_INFCLOUD +#REMOVEME? domain=$YNH_APP_ARG_DOMAIN +#REMOVEME? path=$YNH_APP_ARG_PATH +#REMOVEME? language=$YNH_APP_ARG_LANGUAGE +#REMOVEME? admin=$YNH_APP_ARG_ADMIN +#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. version=$(ynh_app_upstream_version) @@ -37,22 +37,22 @@ version=$(ynh_app_upstream_version) #================================================= # 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 -test ! -e "$final_path" || ynh_die --message="This path already contains a folder" +#REMOVEME? install_dir=/var/www/$app +#REMOVEME? test ! -e "$install_dir" || ynh_die --message="This path already contains a folder" # 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 #================================================= -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 -ynh_app_setting_set --app=$app --key=path --value=$path_url -ynh_app_setting_set --app=$app --key=admin --value=$admin +#REMOVEME? ynh_app_setting_set --app=$app --key=domain --value=$domain +#REMOVEME? ynh_app_setting_set --app=$app --key=path --value=$path +#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=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_nginx --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 #================================================= # 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 #================================================= -ynh_script_progression --message="Configuring system user..." +#REMOVEME? ynh_script_progression --message="Configuring 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 #================================================= 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 -mkdir -p "$final_path/collections" +mkdir -p "$install_dir/collections" # Copy files to the right place -cp ../conf/radicale.wsgi $final_path +cp ../conf/radicale.wsgi $install_dir # Copy extra files -cp -a ../sources/extra_files_radicale/. "$final_path" +cp -a ../sources/extra_files_radicale/. "$install_dir" if [ $infcloud -eq 1 ] then - # Download and uncompress the source into final_path - ynh_setup_source --dest_dir="$final_path/infcloud" + # Download and uncompress the source into install_dir + ynh_setup_source --dest_dir="$install_dir/infcloud" fi -chmod 750 "$final_path" -chmod -R o-rwx "$final_path" -chown -R $app:www-data "$final_path" +chmod 750 "$install_dir" +chmod -R o-rwx "$install_dir" +chown -R $app:www-data "$install_dir" # Set default permissions as radicale do. -chmod 666 -R $final_path/default_collections -chmod 777 $final_path/default_collections $final_path/default_collections/USER +chmod 666 -R $install_dir/default_collections +chmod 777 $install_dir/default_collections $install_dir/default_collections/USER #================================================= # NGINX CONFIGURATION @@ -134,7 +134,7 @@ then # Create a dedicated PHP-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 #================================================= @@ -146,11 +146,11 @@ ynh_script_progression --message="Install Radicale in a virtualenv" # Init virtualenv 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 # 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 chown radicale: -R /opt/yunohost/$app @@ -212,10 +212,10 @@ then esac ynh_app_setting_set --app=$app --key=language --value=$language 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" - chown $app:www-data "$final_path/infcloud/config.js" + chmod 440 "$install_dir/infcloud/config.js" + chown $app:www-data "$install_dir/infcloud/config.js" 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 while read user do - cp -a $final_path/default_collections/USER $final_path/collections/$user - cp -a $final_path/default_collections/USER.props $final_path/collections/$user.props + cp -a $install_dir/default_collections/USER $install_dir/collections/$user + cp -a $install_dir/default_collections/USER.props $install_dir/collections/$user.props # List all users and remove the space after username 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. -ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --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_create" +ynh_replace_string --match_string="__INSTALL_DIR__" --replace_string="$install_dir" --target_file="../hooks/post_user_delete" #================================================= # SETUP SYSTEMD @@ -279,18 +279,18 @@ ynh_systemd_action --service_name=uwsgi --action="restart" #================================================= # SETUP SSOWAT #================================================= -ynh_script_progression --message="Configuring permissions..." +#REMOVEME? ynh_script_progression --message="Configuring permissions..." 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=$app --key=path --value="${path_url%/}/infcloud" +#REMOVEME? ynh_app_setting_set --app=$app --key=path --value="${path%/}/infcloud" # Protect InfCloud access ynh_app_setting_set --app=$app --key=protected_uris --value="/" domain_regex=$(echo "$domain" | sed 's@-@.@g') # Radicale is always accessible (For access to ressources) - ynh_app_setting_set --app=$app --key=skipped_regex --value="$domain_regex$path_url" +#REMOVEME? ynh_app_setting_set --app=$app --key=skipped_regex --value="$domain_regex$path" else # If only radicale is installed # Radicale is always accessible (For access to ressources) @@ -300,9 +300,9 @@ fi #================================================= # 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 @@ -314,7 +314,7 @@ admin_panel="https://$(grep portal_domain /etc/ssowat/conf.json | cut -d'"' -f4) if [ $infcloud -eq 1 ] then 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 infcloud_config="" diff --git a/scripts/remove b/scripts/remove index 1aacdd5..312c7ee 100644 --- a/scripts/remove +++ b/scripts/remove @@ -12,12 +12,12 @@ source /usr/share/yunohost/helpers #================================================= # 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) -final_path=$(ynh_app_setting_get --app=$app --key=final_path) +#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) +#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) #================================================= # STANDARD REMOVE @@ -58,10 +58,10 @@ ynh_remove_logrotate #================================================= # 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 -ynh_secure_remove --file="$final_path" +#REMOVEME? ynh_secure_remove --file="$install_dir" ynh_secure_remove --file="/opt/yunohost/$app" #================================================= @@ -83,10 +83,10 @@ ynh_remove_fpm_config #================================================= # REMOVE DEPENDENCIES #================================================= -ynh_script_progression --message="Removing dependencies..." +#REMOVEME? ynh_script_progression --message="Removing dependencies..." # Remove metapackage and its dependencies -ynh_remove_app_dependencies +#REMOVEME? ynh_remove_app_dependencies #================================================= # SPECIFIC REMOVE @@ -103,10 +103,10 @@ ynh_secure_remove --file="/etc/$app" #================================================= # 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 -ynh_system_user_delete --username=$app +#REMOVEME? ynh_system_user_delete --username=$app #================================================= # END OF SCRIPT diff --git a/scripts/restore b/scripts/restore index 5653b14..f83851e 100644 --- a/scripts/restore +++ b/scripts/restore @@ -14,33 +14,33 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= -ynh_clean_setup () { +#REMOVEME? ynh_clean_setup () { ynh_clean_check_starting } # Exit if an error occurs during the execution of the script -ynh_abort_if_errors +#REMOVEME? ynh_abort_if_errors #================================================= # 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) -path_url=$(ynh_app_setting_get --app=$app --key=path) -final_path=$(ynh_app_setting_get --app=$app --key=final_path) -phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) -admin=$(ynh_app_setting_get --app=$app --key=admin) -infcloud=$(ynh_app_setting_get --app=$app --key=infcloud) +#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) +#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path) +#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) +#REMOVEME? phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) +#REMOVEME? admin=$(ynh_app_setting_get --app=$app --key=admin) +#REMOVEME? infcloud=$(ynh_app_setting_get --app=$app --key=infcloud) #================================================= # 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 \ - || ynh_die --message="There is already a directory: $final_path " +#REMOVEME? test ! -d $install_dir \ + || ynh_die --message="There is already a directory: $install_dir " test ! -d "/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 #================================================= -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) -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 #================================================= 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 -R o-rwx "$final_path" -chown -R $app:www-data "$final_path" +chmod 750 "$install_dir" +chmod -R o-rwx "$install_dir" +chown -R $app:www-data "$install_dir" mkdir -p /opt/yunohost ynh_restore_file --origin_path="/opt/yunohost/$app" @@ -101,10 +101,10 @@ fi #================================================= # REINSTALL DEPENDENCIES #================================================= -ynh_script_progression --message="Reinstalling dependencies..." +#REMOVEME? ynh_script_progression --message="Reinstalling dependencies..." # Define and install dependencies -ynh_install_app_dependencies $pkg_dependencies +#REMOVEME? ynh_install_app_dependencies $pkg_dependencies #================================================= # RESTORE VARIOUS FILES @@ -177,7 +177,7 @@ admin_panel="https://$(grep portal_domain /etc/ssowat/conf.json | cut -d'"' -f4) if [ $infcloud -eq 1 ] then 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 infcloud_config="" diff --git a/scripts/upgrade b/scripts/upgrade index b7612d2..4cdf37d 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -12,30 +12,30 @@ source /usr/share/yunohost/helpers #================================================= # 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) -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) -final_path=$(ynh_app_setting_get --app=$app --key=final_path) -infcloud=$(ynh_app_setting_get --app=$app --key=infcloud) -version=$(ynh_app_setting_get --app=$app --key=version) -overwrite_logging=$(ynh_app_setting_get --app=$app --key=overwrite_logging) -overwrite_config=$(ynh_app_setting_get --app=$app --key=overwrite_config) -overwrite_infcloud=$(ynh_app_setting_get --app=$app --key=overwrite_infcloud) -overwrite_nginx=$(ynh_app_setting_get --app=$app --key=overwrite_nginx) -overwrite_phpfpm=$(ynh_app_setting_get --app=$app --key=overwrite_phpfpm) +#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) +#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path) +#REMOVEME? language=$(ynh_app_setting_get --app=$app --key=language) +#REMOVEME? admin=$(ynh_app_setting_get --app=$app --key=admin) +#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) +#REMOVEME? infcloud=$(ynh_app_setting_get --app=$app --key=infcloud) +#REMOVEME? version=$(ynh_app_setting_get --app=$app --key=version) +#REMOVEME? overwrite_logging=$(ynh_app_setting_get --app=$app --key=overwrite_logging) +#REMOVEME? overwrite_config=$(ynh_app_setting_get --app=$app --key=overwrite_config) +#REMOVEME? overwrite_infcloud=$(ynh_app_setting_get --app=$app --key=overwrite_infcloud) +#REMOVEME? overwrite_nginx=$(ynh_app_setting_get --app=$app --key=overwrite_nginx) +#REMOVEME? overwrite_phpfpm=$(ynh_app_setting_get --app=$app --key=overwrite_phpfpm) # Optional parameters from config-panel feature -firstdayofweek=$(ynh_app_setting_get --app=$app --key=firstdayofweek) -activeview=$(ynh_app_setting_get --app=$app --key=activeview) -openformmode=$(ynh_app_setting_get --app=$app --key=openformmode) -startofbusiness=$(ynh_app_setting_get --app=$app --key=startofbusiness) -endofbusiness=$(ynh_app_setting_get --app=$app --key=endofbusiness) -defaulteventduration=$(ynh_app_setting_get --app=$app --key=defaulteventduration) +#REMOVEME? firstdayofweek=$(ynh_app_setting_get --app=$app --key=firstdayofweek) +#REMOVEME? activeview=$(ynh_app_setting_get --app=$app --key=activeview) +#REMOVEME? openformmode=$(ynh_app_setting_get --app=$app --key=openformmode) +#REMOVEME? startofbusiness=$(ynh_app_setting_get --app=$app --key=startofbusiness) +#REMOVEME? endofbusiness=$(ynh_app_setting_get --app=$app --key=endofbusiness) +#REMOVEME? defaulteventduration=$(ynh_app_setting_get --app=$app --key=defaulteventduration) #================================================= # CHECK VERSION @@ -47,17 +47,17 @@ upgrade_type=$(ynh_check_app_version_changed) #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= -ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." +#REMOVEME? ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." # Backup the current version of the app -ynh_backup_before_upgrade -ynh_clean_setup () { +#REMOVEME? ynh_backup_before_upgrade +#REMOVEME? ynh_clean_setup () { ynh_clean_check_starting # Restore it if the upgrade fails - ynh_restore_upgradebackup +#REMOVEME? ynh_restore_upgradebackup } # Exit if an error occurs during the execution of the script -ynh_abort_if_errors +#REMOVEME? ynh_abort_if_errors #================================================= # ACTIVATE MAINTENANCE MODE @@ -128,8 +128,8 @@ if [ -z "$overwrite_phpfpm" ]; then fi # Cleaning legacy permissions -if ynh_legacy_permissions_exists; then - ynh_legacy_permissions_delete_all +#REMOVEME? if ynh_legacy_permissions_exists; then +#REMOVEME? ynh_legacy_permissions_delete_all ynh_app_setting_delete --app=$app --key=is_public fi @@ -137,10 +137,10 @@ fi #================================================= # 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) -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 @@ -151,27 +151,27 @@ then ynh_script_progression --message="Upgrading source files..." # Copy files to the right place - mkdir -p $final_path/collections + mkdir -p $install_dir/collections # Copy files to the right place - cp ../conf/radicale.wsgi $final_path + cp ../conf/radicale.wsgi $install_dir # Copy extra files - cp -a ../sources/extra_files_radicale/. "$final_path" + cp -a ../sources/extra_files_radicale/. "$install_dir" if [ $infcloud -eq 1 ] then - # Download and uncompress the source into final_path - ynh_setup_source --dest_dir="$final_path/infcloud" --keep="config.js" + # Download and uncompress the source into install_dir + ynh_setup_source --dest_dir="$install_dir/infcloud" --keep="config.js" fi fi -chmod 750 "$final_path" -chmod -R o-rwx "$final_path" -chown -R $app:www-data "$final_path" +chmod 750 "$install_dir" +chmod -R o-rwx "$install_dir" +chown -R $app:www-data "$install_dir" -chmod 666 -R $final_path/default_collections -chmod 777 $final_path/default_collections $final_path/default_collections/USER +chmod 666 -R $install_dir/default_collections +chmod 777 $install_dir/default_collections $install_dir/default_collections/USER #================================================= # NGINX CONFIGURATION @@ -195,9 +195,9 @@ fi #================================================= # 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 @@ -213,7 +213,7 @@ then # Create a dedicated PHP-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 @@ -229,11 +229,11 @@ then # Upgrade pip packages ynh_secure_remove --file="/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" # 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 chown radicale: -R /opt/yunohost/$app @@ -301,31 +301,31 @@ then esac ynh_app_setting_set --app=$app --key=language --value=$language 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 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 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 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 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 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 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 # Recalculate and store the checksum of the file for the next upgrade. - ynh_store_file_checksum --file="$final_path/infcloud/config.js" - chmod 440 "$final_path/infcloud/config.js" - chown $app:www-data "$final_path/infcloud/config.js" + ynh_store_file_checksum --file="$install_dir/infcloud/config.js" + chmod 440 "$install_dir/infcloud/config.js" + chown $app:www-data "$install_dir/infcloud/config.js" 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. -ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --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_create" +ynh_replace_string --match_string="__INSTALL_DIR__" --replace_string="$install_dir" --target_file="../hooks/post_user_delete" #================================================= # GENERIC FINALIZATION @@ -374,9 +374,9 @@ ynh_systemd_action --service_name=uwsgi --action="restart" #================================================= # 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 @@ -398,7 +398,7 @@ ynh_app_changelog || true if [ $infcloud -eq 1 ] then 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 infcloud_config=""