diff --git a/check_process b/check_process index 48d5cbd..a7f9ebe 100644 --- a/check_process +++ b/check_process @@ -27,7 +27,8 @@ Level 2=auto Level 3=auto # Level 4: - Level 4=0 +# Not implimented by upstream + Level 4=na # Level 5: Level 5=auto Level 6=auto diff --git a/manifest.json b/manifest.json index b818bdf..6e86c5d 100644 --- a/manifest.json +++ b/manifest.json @@ -17,7 +17,7 @@ "url": "https://github.com/shaarli/Shaarli", "license": "free", "version": "0.10.2", - "multi_instance": "true", + "multi_instance": true, "services": [ "nginx", "php5-fpm" diff --git a/scripts/change_url b/scripts/change_url index 2c5f46e..8b7446a 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -21,6 +21,17 @@ new_path=$YNH_APP_NEW_PATH app=$YNH_APP_INSTANCE_NAME +#================================================= +# LOAD SETTINGS +#================================================= + +# Needed for helper "ynh_add_nginx_config" +final_path=$(ynh_app_setting_get $app final_path) + +# Add settings here as needed by your application +#db_name=$(ynh_app_setting_get "$app" db_name) +#db_pwd=$(ynh_app_setting_get $app db_pwd) + #================================================= # CHECK THE SYNTAX OF THE PATHS #================================================= @@ -30,6 +41,7 @@ test -n "$new_path" || new_path="/" new_path=$(ynh_normalize_url_path $new_path) old_path=$(ynh_normalize_url_path $old_path) + #================================================= # CHECK WHICH PARTS SHOULD BE CHANGED #================================================= @@ -57,26 +69,35 @@ 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 "$nginx_conf_path" - # Replace locations starting with old_path - # Look for every location possible patterns (see https://nginx.org/en/docs/http/ngx_http_core_module.html#location) - ynh_replace_string "location\( \(=\|~\|~\*\|\^~\)\)\? $old_path" "location\1 $new_path" "$nginx_conf_path" - # Replace path in "return" directives - ynh_replace_string "return \([[:digit:]]\{3\}\) $old_path" "return \1 $new_path" "$nginx_conf_path" - # Calculate and store the nginx config file checksum - ynh_store_file_checksum "$nginx_conf_path" + # Make a backup of the original nginx config file if modified + ynh_backup_if_checksum_is_different "$nginx_conf_path" + # Set global variables for nginx helper + domain="$old_domain" + path_url="$new_path" + # Create a dedicated nginx config + 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 "$nginx_conf_path" + # Delete file checksum for the old conf file location + ynh_delete_file_checksum "$nginx_conf_path" 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 "/etc/nginx/conf.d/$new_domain.d/$app.conf" + # Store file checksum for the new config file location + ynh_store_file_checksum "/etc/nginx/conf.d/$new_domain.d/$app.conf" fi +#================================================= +# SPECIFIC MODIFICATIONS +#================================================= +# ... +#================================================= + +#================================================= +# GENERIC FINALISATION +#================================================= +# RELOAD NGINX +#================================================= systemctl reload nginx diff --git a/scripts/install b/scripts/install index 27037c6..5045773 100644 --- a/scripts/install +++ b/scripts/install @@ -13,9 +13,14 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= +ynh_clean_setup () { + ### Remove this function if there's nothing to clean before calling the remove script. + true +} # Exit if an error occurs during the execution of the script ynh_abort_if_errors + #================================================= # RETRIEVE ARGUMENTS FROM THE MANIFEST #================================================= @@ -42,9 +47,11 @@ app=$YNH_APP_INSTANCE_NAME #================================================= -# CHECK IF THE APP CAN BE INSTALLED WITH THIS ARGS +# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= +### If the app uses nginx as web server (written in HTML/PHP in most cases), the final path should be "/var/www/$app". +### If the app provides an internal web server (or uses another application server such as uwsgi), the final path should be "/opt/yunohost/$app" final_path=/var/www/$app test ! -e "$final_path" || ynh_die "This path already contains a folder" @@ -57,14 +64,6 @@ ynh_webpath_available $domain $path_url ynh_webpath_register $app $domain $path_url - -# Check that the options are compatible -if [ $is_public = "Yes" ]; then - if [ $privateinstance = "Yes" ] ; then - ynh_die "Incompatible options: the instance cannot be both public and private" 1 - fi -fi - #================================================= # STORE SETTINGS FROM MANIFEST #================================================= @@ -75,7 +74,7 @@ ynh_app_setting_set $app is_public $is_public # Install dependencies -ynh_install_app_dependencies php-cli +ynh_install_app_dependencies 'php5-cli|php-cli' php-gettext 'php5-curl|php-curl' 'php-intl|php5-intl' php-gd 'php-mbstring|base-files(<<9.0)' openssl #================================================= diff --git a/scripts/restore b/scripts/restore index 121780c..d329468 100644 --- a/scripts/restore +++ b/scripts/restore @@ -83,7 +83,7 @@ ynh_restore_file "/etc/php5/fpm/conf.d/20-$app.ini" #================================================= # Define and install dependencies -ynh_install_app_dependencies php-cli +ynh_install_app_dependencies 'php5-cli|php-cli' php-gettext 'php5-curl|php-curl' 'php-intl|php5-intl' php-gd 'php-mbstring|base-files(<<9.0)' openssl #================================================= # RESTORE THE LOGROTATE CONFIGURATION @@ -105,7 +105,6 @@ systemctl restart fail2ban # RELOAD NGINX AND PHP-FPM #================================================= -systemctl reload php5-fpm systemctl reload nginx diff --git a/scripts/upgrade b/scripts/upgrade index 7ec1e66..d27f0cc 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -88,7 +88,7 @@ sudo rm -Rf "$tmpdir" ynh_add_nginx_config # Install dependencies -ynh_install_app_dependencies php-cli +ynh_install_app_dependencies 'php5-cli|php-cli' php-gettext 'php5-curl|php-curl' 'php-intl|php5-intl' php-gd 'php-mbstring|base-files(<<9.0)' openssl #================================================= # CREATE DEDICATED USER