diff --git a/conf/app.src b/conf/app.src index 3712b4d..362d432 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/broncowdd/BoZoN/archive/06f2a665f45e3e8f4c4bf71bf4146e8accb27776.zip -SOURCE_SUM=d82dddd968a8cb31e21d1fb3e0518f4b88d92ec95948d652c0c378fce4dc8e65 +SOURCE_URL=https://github.com/broncowdd/BoZoN/archive/670d3fa88f2e3c0f5cee1de14e7a1d5c113b106d.zip +SOURCE_SUM=93030a6e4ac9910e849228ddefb81bba1b78520c1e7407b78a331ccc5aa01f5c SOURCE_FORMAT=zip #sha256sum obtain with shasum -a 256 $SOURCE_URL diff --git a/conf/upstream_version b/conf/upstream_version deleted file mode 100644 index 17e774d..0000000 --- a/conf/upstream_version +++ /dev/null @@ -1 +0,0 @@ -670d3fa88f2e3c0f5cee1de14e7a1d5c113b106d diff --git a/manifest.json b/manifest.json index 6594363..5719e2a 100644 --- a/manifest.json +++ b/manifest.json @@ -14,7 +14,7 @@ "email": "ewilly@neuf.fr" }, "requirements": { - "yunohost": ">= 2.6.3" + "yunohost": ">= 2.7.2" }, "multi_instance": false, "services": [ diff --git a/scripts/_common.sh b/scripts/_common.sh index 83aa435..82cfe10 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -30,6 +30,12 @@ myynh_check_disk_space () { fi } +# Clean & copy files needed to final folder +myynh_clean_source () { + find "$TMPDIR" -type f -name ".htaccess" | xargs rm + [ -e "$TMPDIR/.gitignore" ] && rm -r "$TMPDIR/.gitignore" +} + # Create a dedicated nginx config myynh_add_nginx_config () { ynh_backup_if_checksum_is_different "$nginx_conf" 1 @@ -52,12 +58,6 @@ myynh_add_nginx_config () { sudo systemctl reload nginx } -# Remove the dedicated nginx config -myynh_remove_nginx_config () { - ynh_secure_remove "$nginx_conf" - sudo systemctl reload nginx -} - # Create a dedicated php-fpm config myynh_add_fpm_config () { ynh_backup_if_checksum_is_different "$phpfpm_conf" 1 @@ -82,65 +82,3 @@ myynh_set_permissions () { sudo chown -R "$app": "$data_path" sudo chown root: "$data_path" } - -# Remove the dedicated php-fpm config -myynh_remove_fpm_config () { - ynh_secure_remove "$phpfpm_conf" - sudo systemctl restart php5-fpm -} - -# Update the according fo filesize -myynh_update_bozon_auto_dropzone () { - case ${filesize: -1} in - g|G) - max_length=$((${filesize%?}*1024)) - ;; - *) - max_length=${filesize%?} - ;; - esac - if [ -e "$bozon_auto_dropzone_php" ];then - ynh_replace_string "'max_length'=>2048" "'max_length'=>$max_length" "$bozon_auto_dropzone_php" - fi -} - -#================================================= -# FUTURE YUNOHOST HELPERS - TO BE REMOVED LATER -#================================================= -# Restore a previous backup if the upgrade process failed -ynh_backup_after_failed_upgrade () { - echo "Upgrade failed." >&2 - app_bck=${app//_/-} # Replace all '_' by '-' - # Check if a existing backup can be found before remove and restore the application. - if sudo yunohost backup list | grep -q $app_bck-upg$backup_number; then - # Remove the application then restore it - sudo yunohost app remove $app - # Restore the backup if the upgrade failed - sudo yunohost backup restore --ignore-system $app_bck-upg$backup_number --apps $app --force - ynh_die "The app was restored to the way it was before the failed upgrade." - fi -} - -# Make a backup in case of failed upgrade -ynh_backup_before_upgrade () { - backup_number=1 - old_backup_number=2 - app_bck=${app//_/-} # Replace all '_' by '-' - # Check if a backup already exist with the prefix 1. - if sudo yunohost backup list | grep -q $app_bck-upg1; then - # Prefix become 2 to preserve the previous backup - backup_number=2 - old_backup_number=1 - fi - # Create another backup - sudo yunohost backup create --ignore-system --apps $app --name $app_bck-upg$backup_number - if [ "$?" -eq 0 ]; then - # If the backup succedded, remove the previous backup - if sudo yunohost backup list | grep -q $app_bck-upg$old_backup_number; then - # Remove the previous backup only if it exists - sudo yunohost backup delete $app_bck-upg$old_backup_number > /dev/null - fi - else - ynh_die "Backup failed, the upgrade process was aborted." - fi -} diff --git a/scripts/install b/scripts/install index fe75546..e3bc4bf 100644 --- a/scripts/install +++ b/scripts/install @@ -55,14 +55,8 @@ TMPDIR=$(mktemp -d) ynh_setup_source "$TMPDIR" # clean & copy files needed to final folder -sudo find "$TMPDIR" -type f -name ".htaccess" | xargs sudo rm -if [ -e "$TMPDIR/.gitignore" ]; then - for f in $(sudo cat "$TMPDIR/.gitignore") ; do - [ -e "$TMPDIR$f" ] && sudo rm -R "$TMPDIR$f" - done - sudo rm "$TMPDIR/.gitignore" -fi -sudo mv "$TMPDIR" "$final_path" +myynh_clean_source +mv "$TMPDIR" "$final_path" # configure config file # language @@ -85,8 +79,8 @@ ynh_store_file_checksum "$bozon_conf" myynh_create_dir "$final_path/private" myynh_create_dir "$data_path/uploads" myynh_create_dir "$data_path/thumbs" -sudo ln -s "$data_path/uploads" "$final_path/uploads" -sudo ln -s "$data_path/thumbs" "$final_path/thumbs" +ln -s "$data_path/uploads" "$final_path/uploads" +ln -s "$data_path/thumbs" "$final_path/thumbs" # set permissions myynh_set_permissions @@ -99,7 +93,7 @@ myynh_add_fpm_config # set temporary public access for curl call ynh_app_setting_set "$app" unprotected_uris "/" -sudo yunohost app ssowatconf +yunohost app ssowatconf # fill the superadmin creation form (helper ynh_local_curl doesn't work due to --data vs --data-urlencode ?) curl --silent --show-error -kL -H "Host: $domain" --resolve $domain:443:127.0.0.1 https://localhost"$path_url"/ > /dev/null 2>&1 @@ -119,5 +113,5 @@ then pathluaregex=$([ "$path_url" == "/" ] || echo "$path_url" | sed -e 's/[]().%+*?[^$[]/\%&/g' | sed -e 's/\-/\%&/g') regexList="${domainluaregex}${pathluaregex}/index%.php$","${domainluaregex}${pathluaregex}/index%.php%?p=.*$" ynh_app_setting_set "$app" protected_regex "$regexList" - sudo yunohost app ssowatconf + yunohost app ssowatconf fi diff --git a/scripts/remove b/scripts/remove index dde330e..97d0de9 100644 --- a/scripts/remove +++ b/scripts/remove @@ -39,10 +39,10 @@ ynh_remove_app_dependencies ynh_secure_remove "$final_path" # remove the dedicated nginx config -myynh_remove_nginx_config +ynh_remove_nginx_config # remove the dedicated php-fpm config -myynh_remove_fpm_config +ynh_remove_fpm_config # remove a directory securely ynh_secure_remove "$data_path" diff --git a/scripts/upgrade b/scripts/upgrade index 636c5ed..ab93ebb 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -33,26 +33,6 @@ if [ -f "/etc/yunohost/apps/$app/scripts/backup" ] ; then } fi -# retrieve & save real/right value if argument was not saved as a app setting in a previous realease -if [ -z "$filesize" ]; then # in old script filesize was not saved as a setting - filesize=$(cat "$nginx_conf" | grep -Po "client_max_body_size \K.*?(?=;)") - ynh_app_setting_set "$app" filesize "$filesize" -fi -if [ -z "$language" ]; then # in old script language was not saved as a setting - language=$(cat "$bozon_conf" | grep -Po "default_language='\K.*?(?=')") - ynh_app_setting_set "$app" language "$language" -fi -if [ "$is_public" = "Yes" ]; then # in old script is_public was not a boolean - ynh_app_setting_set "$app" is_public 1 - is_public=1 -elif [ "$is_public" = "No" ]; then - ynh_app_setting_set "$app" is_public 0 - is_public=0 -fi -if [ -z "$backup_core_only" ]; then # in old script backup_core_only was not a setting - ynh_app_setting_set "$app" backup_core_only 1 -fi - # add required packages ynh_install_app_dependencies "$PKG_DEPENDENCIES" @@ -64,16 +44,10 @@ TMPDIR=$(mktemp -d) ynh_setup_source "$TMPDIR" # clean & copy files needed to final folder -sudo find "$TMPDIR" -type f -name ".htaccess" | xargs sudo rm -if [ -e "$TMPDIR/.gitignore" ]; then - for f in $(sudo cat "$TMPDIR/.gitignore") ; do - [ -e "$TMPDIR$f" ] && sudo rm -R "$TMPDIR$f" - done - sudo rm "$TMPDIR/.gitignore" -fi -[ -e "$TMPDIR/config.php" ] && sudo rm "$TMPDIR/config.php" -sudo cp -a "$TMPDIR/." "$final_path" -sudo rm -R "$TMPDIR" +myynh_clean_source +[ -e "$TMPDIR/config.php" ] && rm "$TMPDIR/config.php" +cp -a "$TMPDIR/." "$final_path" +rm -R "$TMPDIR" # update config.php with 'max_length' line case ${filesize: -1} in @@ -107,7 +81,7 @@ then else ynh_app_setting_set "$app" unprotected_uris "/" fi -sudo yunohost app ssowatconf +yunohost app ssowatconf # Purge php sessions stored in /var/lib/php5/sessions [ -x /usr/lib/php5/sessionclean ] && /usr/lib/php5/sessionclean