diff --git a/check_process b/check_process index b991b3d..591c655 100644 --- a/check_process +++ b/check_process @@ -2,43 +2,30 @@ # First Run of complete test ; Manifest domain="domain.tld" (DOMAIN) - path="/calibre" (PATH) + path="/path" (PATH) calibre_path="/home/yunohost.app/calibreweb" admin="john" (USER) - language="en" is_public=0 (PUBLIC|public=1|private=0) + language="en" upload=1 - password="a very long password" + public_library=1 ; Checks pkg_linter=1 setup_sub_dir=1 setup_root=1 + setup_nourl=0 setup_private=1 setup_public=1 upgrade=1 upgrade=1 from_commit=11f5b96df7d8850beff47f9904745fa53a6f7ed9 backup_restore=1 multi_instance=1 - port_already_use=1 (8083) + # This test is no longer necessary since the version 2.7 (PR: https://github.com/YunoHost/yunohost/pull/304), you can still do it if your app could be installed with this version. + # incorrect_path=1 + port_already_use=0 change_url=1 -#;; Failed upgrade -#Run to trigger an error during upgrade to check backup_restore -# ; pre-install -# touch /tmp/upgrade_error -# ; Manifest -# domain="domain.tld" (DOMAIN) -# path="/calibre" (PATH) -# calibre_path="/home/yunohost.app/calibreweb" -# admin="john" (USER) -# language="en" -# is_public=0 (PUBLIC|public=1|private=0) -# upload=1 -# password="a very long password" -# ; Checks -# setup_sub_dir=1 -# setup_root=1 -# upgrade=1 from_commit=3b9c5041e4fa73cb965368379f2b83d076c65341 ;;; Levels + # If the level 5 (Package linter) is forced to 1. Please add justifications here. Level 5=auto ;;; Options Email=nicolas@aubonalbanais.ovh @@ -46,4 +33,4 @@ Notification=none ;;; Upgrade options ; commit=11f5b96df7d8850beff47f9904745fa53a6f7ed9 name=Version 0.96.0~ynh4 - manifest_arg=domain=DOMAIN&path=PATH&admin=USER&password=pass&is_public=1& \ No newline at end of file + manifest_arg=domain=DOMAIN&path=PATH&admin=USER&password=pass&is_public=1& diff --git a/conf/app.src b/conf/app.src index e9c3099..2bdb44a 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,3 +1,6 @@ SOURCE_URL=https://github.com/janeczku/calibre-web/releases/download/0.6.8/calibre-web-0.6.8.zip SOURCE_SUM=41ff00685893bad9794102d20a757c221704f10976f8aa7e6a0fecc817c329bf -SOURCE_FORMAT=zip \ No newline at end of file +SOURCE_SUM_PRG=sha256sum +SOURCE_FORMAT=zip +SOURCE_IN_SUBDIR=true +SOURCE_FILENAME= diff --git a/conf/nginx.conf b/conf/nginx.conf index fb0e725..befdf07 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -7,13 +7,13 @@ location __PATH__/ { client_max_body_size 200M; - proxy_pass http://localhost:__PORT__; - proxy_set_header X-Forwarded-For $remote_addr; - proxy_set_header Host $http_host; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Scheme $scheme; - proxy_set_header X-Script-Name __PATH__; -# proxy_set_header X-Remote-User $remote_user; + proxy_pass http://localhost:__PORT__; + proxy_set_header X-Forwarded-For $remote_addr; + proxy_set_header Host $http_host; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Scheme $scheme; + proxy_set_header X-Script-Name __PATH__; +# proxy_set_header X-Remote-User $remote_user; # Include SSOWAT user panel. include conf.d/yunohost_panel.conf.inc; diff --git a/scripts/backup b/scripts/backup index e6ac387..7b02578 100755 --- a/scripts/backup +++ b/scripts/backup @@ -28,7 +28,6 @@ ynh_script_progression --message="Loading installation settings..." --weight=1 app=$YNH_APP_INSTANCE_NAME final_path=$(ynh_app_setting_get --app=$app --key=final_path) -path_url=$(ynh_app_setting_get --app=$app --key=path) domain=$(ynh_app_setting_get --app=$app --key=domain) port=$(ynh_app_setting_get --app=$app --key=port) @@ -36,7 +35,7 @@ port=$(ynh_app_setting_get --app=$app --key=port) calibre_dir=$(sqlite3 $final_path/app.db "SELECT config_calibre_dir FROM settings WHERE ID=1") #Save it in settings so that it can be used back afterward calibre_dir=${calibre_dir%/} -ynh_app_setting_set $app calibre_dir $calibre_dir +ynh_app_setting_set --app=$app --key=calibre_dir --value=$calibre_dir #================================================= # DECLARE DATA AND CONF FILES TO BACKUP diff --git a/scripts/change_url b/scripts/change_url index 7225497..ca7430c 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -29,7 +29,7 @@ ynh_script_progression --message="Loading installation settings..." --weight=1 # Needed for helper "ynh_add_nginx_config" final_path=$(ynh_app_setting_get --app=$app --key=final_path) -port=$(ynh_app_setting_get $app port) +port=$(ynh_app_setting_get --app=$app --key=port) #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP @@ -49,15 +49,6 @@ ynh_clean_setup () { # Exit if an error occurs during the execution of the script ynh_abort_if_errors -#================================================= -# CHECK THE SYNTAX OF THE PATHS -#================================================= - -test -n "$old_path" || old_path="/" -test -n "$new_path" || new_path="/" -new_path=$(ynh_normalize_url_path $new_path) -old_path=$(ynh_normalize_url_path $old_path) - #================================================= # CHECK WHICH PARTS SHOULD BE CHANGED #================================================= @@ -98,10 +89,12 @@ then # Set global variables for nginx helper domain="$old_domain" path_url="$new_path" - #Cannot use empty string for X-script-name, causes an issue in the python prg + + # Cannot use empty string for X-script-name, causes an issue in the python prg if [ $path_url = "/" ] ; then - ynh_replace_string " proxy_set_header X-Script-Name" "# proxy_set_header X-Script-Name" ../conf/nginx.conf + ynh_replace_string --match_string="proxy_set_header X-Script-Name __PATH__;" --replace_string="#proxy_set_header X-Script-Name __PATH__;" --target_file=../conf/nginx.conf fi + # Create a dedicated nginx config ynh_add_nginx_config fi diff --git a/scripts/install b/scripts/install index 29f419a..71bf41f 100755 --- a/scripts/install +++ b/scripts/install @@ -60,6 +60,9 @@ 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 ynh_app_setting_set --app=$app --key=is_public --value=$is_public +ynh_app_setting_set --app=$app --key=language --value=$language +ynh_app_setting_set --app=$app --key=upload --value=$upload +ynh_app_setting_set --app=$app --key=public_library --value=$public_library #================================================= # STANDARD MODIFICATIONS @@ -100,9 +103,9 @@ ynh_setup_source --dest_dir="$final_path" #================================================= ynh_script_progression --message="Configuring nginx web server..." --weight=5 -#Cannot use empty string for X-script-name, causes an issue in the python prg +# Cannot use empty string for X-script-name, causes an issue in the python prg if [ $path_url = "/" ] ; then - ynh_replace_string " proxy_set_header X-Script-Name" "# proxy_set_header X-Script-Name" ../conf/nginx.conf + ynh_replace_string --match_string="proxy_set_header X-Script-Name __PATH__;" --replace_string="#proxy_set_header X-Script-Name __PATH__;" --target_file=../conf/nginx.conf fi # Create a dedicated nginx config @@ -245,7 +248,7 @@ ynh_script_progression --message="Configuring SSOwat..." if [ $is_public -eq 1 ] then # unprotected_uris allows SSO credentials to be passed anyway. - #ynh_app_setting_set $app unprotected_uris "/" + # ynh_app_setting_set --app=$app --key=unprotected_uris --value="/" ynh_permission_update --permission "main" --add visitors fi if [ $public_library -eq 0 ]; then diff --git a/scripts/remove b/scripts/remove index a4276fb..d731715 100755 --- a/scripts/remove +++ b/scripts/remove @@ -104,14 +104,10 @@ ynh_script_progression --message="Removing the dedicated system user..." --weigh # Delete a system user ynh_system_user_delete --username=$app -#================================================= -# MESSAGE TO USER -#================================================= -ynh_script_progression --message="Removal of $app completed" --last -ynh_print_warn "!!!The library folder $calibre_dir was not deleted. Delete it manually if required!!!" - #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Removal of $app completed" +ynh_script_progression --message="Removal of $app completed" --last + +ynh_print_warn "!!!The library folder $calibre_dir was not deleted. Delete it manually if required!!!" diff --git a/scripts/upgrade b/scripts/upgrade index 8fb15aa..9c3c8aa 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -130,9 +130,11 @@ fi #================================================= ynh_script_progression --message="Upgrading nginx web server configuration..." --weight=5 +# Cannot use empty string for X-script-name, causes an issue in the python prg if [ $path_url = "/" ] ; then - ynh_replace_string " proxy_set_header X-Script-Name" "# proxy_set_header X-Script-Name" ../conf/nginx.conf + ynh_replace_string --match_string="proxy_set_header X-Script-Name __PATH__;" --replace_string="#proxy_set_header X-Script-Name __PATH__;" --target_file=../conf/nginx.conf fi + # Create a dedicated nginx config ynh_add_nginx_config @@ -252,18 +254,10 @@ ynh_script_progression --message="Upgrading SSOwat configuration..." if [ $is_public -eq 1 ] then # unprotected_uris allows SSO credentials to be passed anyway - #ynh_app_setting_set $app unprotected_uris "/" + # ynh_app_setting_set --app=$app --key=unprotected_uris --value="/" ynh_permission_update --permission "main" --add visitors fi -#================================================= -# PACKAGE_CHECK -#================================================= -#This line of code is just used to caused an error in upgrade to be tested by package_check -if [ -e /tmp/upgrade_error ]; then - ynh_die -fi - #================================================= # RELOAD NGINX #================================================= @@ -276,4 +270,3 @@ ynh_systemd_action --service_name=nginx --action=reload #================================================= ynh_script_progression --message="Upgrade of $app completed" --last -