From bb384b72308db306a9cb137f3d912419db3c4859 Mon Sep 17 00:00:00 2001 From: Maniack Crudelis Date: Mon, 4 Mar 2019 17:17:05 +0100 Subject: [PATCH 1/3] Normalization from example_ynh --- README.md | 69 +++++++++++++++++++++++++++-------- check_process | 16 ++++----- conf/nginx.conf | 12 +++++-- scripts/_common.sh | 90 ++++++++++++++++++++++++++++++++++++++++++++++ scripts/_future.sh | 45 ----------------------- scripts/backup | 5 ++- scripts/change_url | 41 ++++++++++----------- scripts/install | 38 +++++++++++++++----- scripts/remove | 1 + scripts/restore | 18 ++++++---- scripts/upgrade | 77 ++++++++++++++++++++++++--------------- 11 files changed, 275 insertions(+), 137 deletions(-) create mode 100644 scripts/_common.sh delete mode 100644 scripts/_future.sh diff --git a/README.md b/README.md index 5d6727a..84fce7a 100644 --- a/README.md +++ b/README.md @@ -1,26 +1,67 @@ -strut_ynh -=============== +# Strut for YunoHost -Strut package for YunoHost +[![Integration level](https://dash.yunohost.org/integration/strut.svg)](https://dash.yunohost.org/appci/app/strut) +[![Install Strut with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=strut) -## IMPORTANT NOTE ABOUT THIS PACKAGE -This package doesn't contained the exact sources of the upstream https://github.com/tantaman/Strut. +> *This package allow you to install Strut quickly and simply on a YunoHost server. +If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to know how to install and enjoy it.* + +## Overview +Quick description of this app. + +**Shipped version:** 20171224-1 + +## Screenshots + +![](https://f.cloud.github.com/assets/1009003/515405/f1003c6a-be74-11e2-84b9-14776c652afb.png) + +## Demo + +* [Official demo](http://strut.io/editor/index.html) + +## Configuration + +## Documentation + + * YunoHost documentation: If specific documentation is needed, feel free to contribute. + +## YunoHost specific features + +#### Multi-users support + +#### Supported architectures + +* x86-64b - [![Build Status](https://ci-apps.yunohost.org/ci/logs/strut%20%28Official%29.svg)](https://ci-apps.yunohost.org/ci/apps/strut/) +* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/strut%20%28Official%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/strut/) +* Jessie x86-64b - [![Build Status](https://ci-stretch.nohost.me/ci/logs/strut%20%28Official%29.svg)](https://ci-stretch.nohost.me/ci/apps/strut/) + +## Limitations + +## Additional information + +* This package doesn't contained the exact sources of the upstream https://github.com/tantaman/Strut. Initial Strut software includes Google Analytics and is bind to Imgur to upload images. This kind of trackers or external services are not accepted by the package team of YunoHost. So this trackers are removed from sources, a pull request has been done and merged but has finally be removed from the strut upstream with no explanation. In more, Strut developers don't deliver builded versions. To build a version it needs grunt, that can't be removed easily. To avoid to take time to build this html/js app, this package setups a builded version of Strut with the patch that remove Google Analytics and Imgur dependencies. It is a build of this version https://github.com/tantaman/Strut/commits/6761b141ee7aa622916e2d23cced84ee95618cce . So it's not the more recent version. +## Links -## Official Website: http://strut.io + * Report a bug: https://github.com/YunoHost-Apps/strut_ynh/issues + * Strut website: http://strut.io + * YunoHost website: https://yunohost.org/ -## About Strut +--- -[![Facelift](https://f.cloud.github.com/assets/1009003/515405/f1003c6a-be74-11e2-84b9-14776c652afb.png)](http://strut.io) +Developers info +---------------- -#### A GUI / Authoring Tool for ImpressJS and Bespoke.js #### - -Don't know what ImpressJS is? Check out the ImpressJS demo presentation: http://bartaz.github.com/impress.js/#/bored - -### Start using Strut! http://strut.io/editor/ -(works in Firefox, Chrome and Safari with basic support for IE10) +**Only if you want to use a testing branch for coding, instead of merging directly into master.** +Please do your pull request to the [testing branch](https://github.com/YunoHost-Apps/strut_ynh/tree/testing). +To try the testing branch, please proceed like that. +``` +sudo yunohost app install https://github.com/YunoHost-Apps/strut_ynh/tree/testing --debug +or +sudo yunohost app upgrade strut -u https://github.com/YunoHost-Apps/strut_ynh/tree/testing --debug +``` diff --git a/check_process b/check_process index e67c026..59838f1 100644 --- a/check_process +++ b/check_process @@ -1,5 +1,3 @@ -# See here for more informations -# https://github.com/YunoHost/package_check#syntax-check_process-file ;; Test complet ; Manifest domain="domain.tld" (DOMAIN) @@ -13,7 +11,7 @@ setup_private=1 setup_public=1 upgrade=1 -# upgrade=1 from_commit=03c3ea18cf117127749a860afe538bc6070a8e0b + upgrade=1 from_commit=f6565f66d82fa077d752226f8b8267018f7b91d8 backup_restore=1 multi_instance=1 incorrect_path=1 @@ -29,13 +27,13 @@ Level 5=auto Level 6=auto Level 7=auto -# Level 8=1 -# Level 9=1 + Level 8=0 + Level 9=0 Level 10=0 ;;; Options Email=ljf+ynh-strut@grimaud.me Notification=down -#;;; Upgrade options -# ; commit=03c3ea18cf117127749a860afe538bc6070a8e0b -# name=Update package to level 7 -# manifest_arg=domain=DOMAIN&path=PATH&is_public=Yes& +;;; Upgrade options + ; commit=f6565f66d82fa077d752226f8b8267018f7b91d8 + name=May 27, 2018 + manifest_arg=domain=DOMAIN&path=PATH&is_public=Yes& diff --git a/conf/nginx.conf b/conf/nginx.conf index 076d2f1..5b29d2d 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,10 +1,18 @@ -location __PATH__ { - alias __FINALPATH__/; +#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; +location __PATH__/ { + + # Path to source + alias __FINALPATH__/ ; + + # Force usage of https if ($scheme = http) { rewrite ^ https://$server_name$request_uri? permanent; } + index index.html; try_files $uri $uri/ /index.html; + + # Include SSOWAT user panel. include conf.d/yunohost_panel.conf.inc; } diff --git a/scripts/_common.sh b/scripts/_common.sh new file mode 100644 index 0000000..b0f99a4 --- /dev/null +++ b/scripts/_common.sh @@ -0,0 +1,90 @@ +#!/bin/bash + +#================================================= +# FUTURE OFFICIAL HELPERS +#================================================= + +# Read the value of a key in a ynh manifest file +# +# usage: ynh_read_manifest manifest key +# | arg: -m, --manifest= - Path of the manifest to read +# | arg: -k, --key= - Name of the key to find +ynh_read_manifest () { + # Declare an array to define the options of this helper. + declare -Ar args_array=( [m]=manifest= [k]=manifest_key= ) + local manifest + local manifest_key + # Manage arguments with getopts + ynh_handle_getopts_args "$@" + + if [ ! -e "$manifest" ]; then + # If the manifest isn't found, try the common place for backup and restore script. + manifest="../settings/manifest.json" + fi + + jq ".$manifest_key" "$manifest" --raw-output +} + +# Read the upstream version from the manifest +# The version number in the manifest is defined by ~ynh +# For example : 4.3-2~ynh3 +# This include the number before ~ynh +# In the last example it return 4.3-2 +# +# usage: ynh_app_upstream_version [-m manifest] +# | arg: -m, --manifest= - Path of the manifest to read +ynh_app_upstream_version () { + declare -Ar args_array=( [m]=manifest= ) + local manifest + # Manage arguments with getopts + ynh_handle_getopts_args "$@" + + manifest="${manifest:-../manifest.json}" + version_key=$(ynh_read_manifest --manifest="$manifest" --manifest_key="version") + echo "${version_key/~ynh*/}" +} + +# Checks the app version to upgrade with the existing app version and returns: +# - UPGRADE_APP if the upstream app version has changed +# - UPGRADE_PACKAGE if only the YunoHost package has changed +# +## It stops the current script without error if the package is up-to-date +# +# This helper should be used to avoid an upgrade of an app, or the upstream part +# of it, when it's not needed +# +# To force an upgrade, even if the package is up to date, +# you have to set the variable YNH_FORCE_UPGRADE before. +# example: sudo YNH_FORCE_UPGRADE=1 yunohost app upgrade MyApp +# +# usage: ynh_check_app_version_changed +ynh_check_app_version_changed () { + local force_upgrade=${YNH_FORCE_UPGRADE:-0} + local package_check=${PACKAGE_CHECK_EXEC:-0} + + # By default, upstream app version has changed + local return_value="UPGRADE_APP" + + local current_version=$(ynh_read_manifest --manifest="/etc/yunohost/apps/$YNH_APP_INSTANCE_NAME/manifest.json" --manifest_key="version" || echo 1.0) + local current_upstream_version="$(ynh_app_upstream_version --manifest="/etc/yunohost/apps/$YNH_APP_INSTANCE_NAME/manifest.json")" + local update_version=$(ynh_read_manifest --manifest="../manifest.json" --manifest_key="version" || echo 1.0) + local update_upstream_version="$(ynh_app_upstream_version)" + + if [ "$current_version" == "$update_version" ] ; then + # Complete versions are the same + if [ "$force_upgrade" != "0" ] + then + echo "Upgrade forced by YNH_FORCE_UPGRADE." >&2 + unset YNH_FORCE_UPGRADE + elif [ "$package_check" != "0" ] + then + echo "Upgrade forced for package check." >&2 + else + ynh_die "Up-to-date, nothing to do" 0 + fi + elif [ "$current_upstream_version" == "$update_upstream_version" ] ; then + # Upstream versions are the same, only YunoHost package versions differ + return_value="UPGRADE_PACKAGE" + fi + echo $return_value +} diff --git a/scripts/_future.sh b/scripts/_future.sh deleted file mode 100644 index 2fa9421..0000000 --- a/scripts/_future.sh +++ /dev/null @@ -1,45 +0,0 @@ - -log() { - echo "${1}" -} - -info() { - log "[INFO] ${1}" -} - -warn() { - log "[WARN] ${1}" -} - -err() { - log "[ERR] ${1}" -} -to_logs() { - - # When yunohost --verbose or bash -x - if $_ISVERBOSE; then - cat - else - cat > /dev/null - fi -} - -read_json () { - sudo python3 -c "import sys, json;print(json.load(open('$1'))['$2'])" -} - -read_manifest () { - if [ -f '../manifest.json' ] ; then - read_json '../manifest.json' "$1" - else - read_json '../settings/manifest.json' "$1" - fi -} -abort_if_up_to_date () { - version=$(read_json "/etc/yunohost/apps/$YNH_APP_INSTANCE_NAME/manifest.json" 'version' 2> /dev/null || echo '20160501-7') - last_version=$(read_manifest 'version') - if [ "${version}" = "${last_version}" ]; then - info "Up-to-date, nothing to do" - ynh_die "" 0 - fi -} diff --git a/scripts/backup b/scripts/backup index 49c218f..0335e62 100644 --- a/scripts/backup +++ b/scripts/backup @@ -5,12 +5,15 @@ #================================================= # IMPORT GENERIC HELPERS #================================================= + +# source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers #================================================= # MANAGE SCRIPT FAILURE #================================================= +# Exit if an error occurs during the execution of the script ynh_abort_if_errors #================================================= @@ -19,8 +22,8 @@ ynh_abort_if_errors app=$YNH_APP_INSTANCE_NAME -final_path=$(ynh_app_setting_get $app final_path) domain=$(ynh_app_setting_get $app domain) +final_path=$(ynh_app_setting_get $app final_path) #================================================= # STANDARD BACKUP STEPS diff --git a/scripts/change_url b/scripts/change_url index 84ce565..8724455 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -6,7 +6,7 @@ # IMPORT GENERIC HELPERS #================================================= -source _future.sh +# source _common.sh source /usr/share/yunohost/helpers #================================================= @@ -21,6 +21,13 @@ 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) + #================================================= # CHECK THE SYNTAX OF THE PATHS #================================================= @@ -46,16 +53,6 @@ then change_path=1 fi -#================================================= -# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP -#================================================= - -#ynh_backup_before_upgrade # Backup the current version of the app -#ynh_clean_setup () { -# ynh_restore_upgradebackup # restore it if the upgrade fails -#} -#ynh_abort_if_errors # Exit if an error occurs during the execution of the script - #================================================= # STANDARD MODIFICATIONS #================================================= @@ -67,25 +64,25 @@ 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 - # 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) - sed --in-place "s@location\( \(=\|~\|~\*\|\^~\)\)\? $old_path@location\1 $new_path@" "$nginx_conf_path" - # Replace path in "return" directives - sed --in-place "s@return \([[:digit:]]\{3\}\) $old_path@return \1 $new_path@" "$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" 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" fi -#================================================= -# SPECIFIC MODIFICATIONS -#================================================= -# ... -#================================================= - #================================================= # GENERIC FINALISATION #================================================= diff --git a/scripts/install b/scripts/install index 363394b..f58ac03 100644 --- a/scripts/install +++ b/scripts/install @@ -1,21 +1,25 @@ #!/bin/bash + #================================================= # GENERIC START #================================================= # IMPORT GENERIC HELPERS #================================================= -#source _common.sh + +# source _common.sh source /usr/share/yunohost/helpers #================================================= # MANAGE SCRIPT FAILURE #================================================= + # Exit if an error occurs during the execution of the script ynh_abort_if_errors #================================================= # RETRIEVE ARGUMENTS FROM THE MANIFEST #================================================= + domain=$YNH_APP_ARG_DOMAIN path_url=$YNH_APP_ARG_PATH is_public=$YNH_APP_ARG_IS_PUBLIC @@ -25,6 +29,7 @@ app=$YNH_APP_INSTANCE_NAME #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= + final_path=/var/www/$app test ! -e "$final_path" || ynh_die "This path already contains a folder" @@ -34,36 +39,50 @@ ynh_webpath_register $app $domain $path_url #================================================= # STORE SETTINGS FROM MANIFEST #================================================= + +ynh_app_setting_set $app domain $domain +ynh_app_setting_set $app path $path_url ynh_app_setting_set $app is_public $is_public +#================================================= +# STANDARD MODIFICATIONS #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= + ynh_app_setting_set $app final_path $final_path # Download, check integrity, uncompress and patch the source from app.src # For this app sources are in app subdirectory tmp_dir=$(mktemp -d) -ynh_clean_setup () { - ynh_secure_remove "$tmp_dir" -} + ynh_setup_source "$tmp_dir" mv "$tmp_dir/dist" "$final_path" -# Imgur is deactivated on the specific upstream selected, but this text is still here -# Don't use a patch because it's minified js -ynh_replace_string "are currently uploaded to imgur.*re working on changing this" "size is limited" "$final_path/scripts/amd-app.js" ynh_secure_remove "$tmp_dir" + #================================================= # NGINX CONFIGURATION #================================================= + # Create a dedicated nginx config ynh_add_nginx_config +#================================================= +# SPECIFIC SETUP +#================================================= +# PATCH SOURCE +#================================================= + +# Imgur is deactivated on the specific upstream selected, but this text is still here +# Don't use a patch because it's minified js +ynh_replace_string "are currently uploaded to imgur.*re working on changing this" "size is limited" "$final_path/scripts/amd-app.js" + #================================================= # GENERIC FINALIZATION #================================================= # SECURE FILES AND DIRECTORIES #================================================= -# Set strong right permissions to app files + +# Set permissions to app files chown -R root:www-data "$final_path" chmod -R 640 "$final_path" find "$final_path" -type d -print0 | xargs -0 chmod 750 @@ -72,7 +91,7 @@ find "$final_path" -type d -print0 | xargs -0 chmod 750 # SETUP SSOWAT #================================================= -# Make app public if necessary or protect it +# Make app public if necessary if [ $is_public -eq 1 ] then ynh_app_setting_set $app skipped_uris "/" @@ -81,4 +100,5 @@ fi #================================================= # RELOAD NGINX #================================================= + systemctl reload nginx diff --git a/scripts/remove b/scripts/remove index d57b7a1..189e322 100644 --- a/scripts/remove +++ b/scripts/remove @@ -6,6 +6,7 @@ # IMPORT GENERIC HELPERS #================================================= +# source _common.sh source /usr/share/yunohost/helpers #================================================= diff --git a/scripts/restore b/scripts/restore index 53cac08..3e8ea37 100644 --- a/scripts/restore +++ b/scripts/restore @@ -6,13 +6,14 @@ # IMPORT GENERIC HELPERS #================================================= -#source ../settings/scripts/_common.sh +# source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers #================================================= # MANAGE SCRIPT FAILURE #================================================= -# Exit on command errors and treat access to unset variables as an error + +# Exit if an error occurs during the execution of the script ynh_abort_if_errors #================================================= @@ -33,17 +34,20 @@ ynh_webpath_available $domain $path_url \ || ynh_die "Path not available: ${domain}${path_url}" test ! -d $final_path \ || ynh_die "There is already a directory: $final_path " -conf="/etc/nginx/conf.d/$domain.d/$app.conf" -test ! -f $conf \ - || ynh_die "There is already a nginx conf file at this path: $conf " #================================================= # STANDARD RESTORATION STEPS #================================================= -# RESTORE BACKUP FILES +# RESTORE THE NGINX CONFIGURATION #================================================= -ynh_restore +ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf" + +#================================================= +# RESTORE THE APP MAIN DIR +#================================================= + +ynh_restore_file "$final_path" #================================================= # RESTORE USER RIGHTS diff --git a/scripts/upgrade b/scripts/upgrade index c91b8ab..0f45516 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -6,7 +6,7 @@ # IMPORT GENERIC HELPERS #================================================= -source _future.sh +source _common.sh source /usr/share/yunohost/helpers #================================================= @@ -21,19 +21,10 @@ is_public=$(ynh_app_setting_get $app is_public) final_path=$(ynh_app_setting_get $app final_path) #================================================= -# Check version -#================================================= -abort_if_up_to_date - -#================================================= -# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP +# CHECK VERSION #================================================= -ynh_backup_before_upgrade # Backup the current version of the app -ynh_clean_setup () { - ynh_restore_upgradebackup # restore it if the upgrade fails -} -ynh_abort_if_errors # Exit if an error occurs during the execution of the script +upgrade_type=$(ynh_check_app_version_changed) #================================================= # ENSURE DOWNWARD COMPATIBILITY @@ -50,14 +41,27 @@ if [ "${version}" = "20160501-7" ]; then is_public=0 fi ynh_app_setting_delete $app public_site - + # If final_path doesn't exist, create it - if [ -z $final_path ]; then + if [ -z "$final_path" ]; then final_path=/var/www/$app ynh_app_setting_set $app final_path $final_path fi fi +#================================================= +# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP +#================================================= + +# Backup the current version of the app +ynh_backup_before_upgrade +ynh_clean_setup () { + # restore it if the upgrade fails + ynh_restore_upgradebackup +} +# Exit if an error occurs during the execution of the script +ynh_abort_if_errors + #================================================= # CHECK THE PATH #================================================= @@ -71,16 +75,21 @@ path_url=$(ynh_normalize_url_path $path_url) # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -# Download, check integrity, uncompress and patch the source from app.src -# For this app sources are in app subdirectory -tmp_dir=$(mktemp -d) -ynh_setup_source "$tmp_dir" -# Dist is the compiled version. Other directories are source code and tools to build the program -cp -R "$tmp_dir/dist/." "$final_path/" -# Imgur is deactivated on the specific upstream selected, but this text is still here -# Don't use a patch because it's minified js -ynh_replace_string "are currently uploaded to imgur.*re working on changing this" "size is limited" "$final_path/scripts/amd-app.js" -ynh_secure_remove "$tmp_dir" +if [ "$upgrade_type" == "UPGRADE_APP" ] +then + # Download, check integrity, uncompress and patch the source from app.src + # For this app sources are in app subdirectory + tmp_dir=$(mktemp -d) + + ynh_setup_source "$tmp_dir" + # Dist is the compiled version. Other directories are source code and tools to build the program + cp -a "$tmp_dir/dist/." "$final_path/" + ynh_secure_remove "$tmp_dir" + + # Imgur is deactivated on the specific upstream selected, but this text is still here + # Don't use a patch because it's minified js + ynh_replace_string "are currently uploaded to imgur.*re working on changing this" "size is limited" "$final_path/scripts/amd-app.js" +fi #================================================= # NGINX CONFIGURATION @@ -89,13 +98,26 @@ ynh_secure_remove "$tmp_dir" # Create a dedicated nginx config ynh_add_nginx_config +#================================================= +# SPECIFIC UPGRADE +#================================================= +# PATCH SOURCE +#================================================= + +if [ "$upgrade_type" == "UPGRADE_APP" ] +then + # Imgur is deactivated on the specific upstream selected, but this text is still here + # Don't use a patch because it's minified js + ynh_replace_string "are currently uploaded to imgur.*re working on changing this" "size is limited" "$final_path/scripts/amd-app.js" +fi + #================================================= # GENERIC FINALIZATION #================================================= # SECURE FILES AND DIRECTORIES #================================================= -# Set strong right permissions +# Set permissions on app files chown -R root:www-data "$final_path" chmod -R 640 "$final_path" find "$final_path" -type d -print0 | xargs -0 chmod 750 @@ -104,15 +126,14 @@ find "$final_path" -type d -print0 | xargs -0 chmod 750 # SETUP SSOWAT #================================================= -# Make app public if necessary or protect it +# Make app public if necessary if [ $is_public -eq 1 ] then ynh_app_setting_set $app skipped_uris "/" -else - ynh_app_setting_set $app protected_uris "/" fi #================================================= # RELOAD NGINX #================================================= + systemctl reload nginx From 3ae3d1a19ce0f988e6e54c29a9dd82bef72dcc59 Mon Sep 17 00:00:00 2001 From: Maniack Crudelis Date: Mon, 4 Mar 2019 17:17:31 +0100 Subject: [PATCH 2/3] Add progression with ynh_print_info --- manifest.json | 2 +- scripts/backup | 9 +++++++++ scripts/change_url | 9 +++++++++ scripts/install | 12 ++++++++++++ scripts/remove | 9 +++++++++ scripts/restore | 10 ++++++++++ scripts/upgrade | 14 ++++++++++++++ 7 files changed, 64 insertions(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index dab9586..a57ed94 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "url": "http://strut.io", "license": "AGPL-3.0", "requirements": { - "yunohost": ">= 2.7.2" + "yunohost": ">= 3.2.0" }, "description": { "en": "Strut is a slide editor creating impress.js presentations.", diff --git a/scripts/backup b/scripts/backup index 0335e62..effa06b 100644 --- a/scripts/backup +++ b/scripts/backup @@ -19,6 +19,7 @@ ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= +ynh_print_info "Loading installation settings..." app=$YNH_APP_INSTANCE_NAME @@ -30,11 +31,19 @@ final_path=$(ynh_app_setting_get $app final_path) #================================================= # BACKUP THE APP MAIN DIR #================================================= +ynh_print_info "Backing up the main app directory..." ynh_backup "$final_path" #================================================= # BACKUP THE NGINX CONFIGURATION #================================================= +ynh_print_info "Backing up nginx web server configuration..." ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" + +#================================================= +# END OF SCRIPT +#================================================= + +ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." diff --git a/scripts/change_url b/scripts/change_url index 8724455..6ef2a0f 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -24,6 +24,7 @@ app=$YNH_APP_INSTANCE_NAME #================================================= # LOAD SETTINGS #================================================= +ynh_print_info "Loading installation settings..." # Needed for helper "ynh_add_nginx_config" final_path=$(ynh_app_setting_get $app final_path) @@ -58,6 +59,7 @@ fi #================================================= # MODIFY URL IN NGINX CONF #================================================= +ynh_print_info "Updating nginx web server configuration..." nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf @@ -88,5 +90,12 @@ fi #================================================= # RELOAD NGINX #================================================= +ynh_print_info "Reloading nginx web server..." systemctl reload nginx + +#================================================= +# END OF SCRIPT +#================================================= + +ynh_print_info "Change of URL completed for $app" diff --git a/scripts/install b/scripts/install index f58ac03..231fecf 100644 --- a/scripts/install +++ b/scripts/install @@ -29,6 +29,7 @@ app=$YNH_APP_INSTANCE_NAME #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= +ynh_print_info "Validating installation parameters..." final_path=/var/www/$app test ! -e "$final_path" || ynh_die "This path already contains a folder" @@ -39,6 +40,7 @@ ynh_webpath_register $app $domain $path_url #================================================= # STORE SETTINGS FROM MANIFEST #================================================= +ynh_print_info "Storing installation settings..." ynh_app_setting_set $app domain $domain ynh_app_setting_set $app path $path_url @@ -49,6 +51,7 @@ ynh_app_setting_set $app is_public $is_public #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= +ynh_print_info "Setting up source files..." ynh_app_setting_set $app final_path $final_path # Download, check integrity, uncompress and patch the source from app.src @@ -62,6 +65,7 @@ ynh_secure_remove "$tmp_dir" #================================================= # NGINX CONFIGURATION #================================================= +ynh_print_info "Configuring nginx web server..." # Create a dedicated nginx config ynh_add_nginx_config @@ -90,6 +94,7 @@ find "$final_path" -type d -print0 | xargs -0 chmod 750 #================================================= # SETUP SSOWAT #================================================= +ynh_print_info "Configuring SSOwat..." # Make app public if necessary if [ $is_public -eq 1 ] @@ -100,5 +105,12 @@ fi #================================================= # RELOAD NGINX #================================================= +ynh_print_info "Reloading nginx web server..." systemctl reload nginx + +#================================================= +# END OF SCRIPT +#================================================= + +ynh_print_info "Installation of $app completed" diff --git a/scripts/remove b/scripts/remove index 189e322..216a0f6 100644 --- a/scripts/remove +++ b/scripts/remove @@ -12,6 +12,7 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= +ynh_print_info "Loading installation settings..." app=$YNH_APP_INSTANCE_NAME @@ -23,6 +24,7 @@ final_path=$(ynh_app_setting_get $app final_path) #================================================= # REMOVE APP MAIN DIR #================================================= +ynh_print_info "Removing app main directory" # Remove the app directory securely ynh_secure_remove "$final_path" @@ -30,6 +32,13 @@ ynh_secure_remove "$final_path" #================================================= # REMOVE NGINX CONFIGURATION #================================================= +ynh_print_info "Removing nginx web server configuration" # Remove the dedicated nginx config ynh_remove_nginx_config + +#================================================= +# END OF SCRIPT +#================================================= + +ynh_print_info "Removal of $app completed" diff --git a/scripts/restore b/scripts/restore index 3e8ea37..9186e5e 100644 --- a/scripts/restore +++ b/scripts/restore @@ -19,6 +19,7 @@ ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= +ynh_print_info "Loading settings..." app=$YNH_APP_INSTANCE_NAME @@ -29,6 +30,7 @@ final_path=$(ynh_app_setting_get $app final_path) #================================================= # CHECK IF THE APP CAN BE RESTORED #================================================= +ynh_print_info "Validating restoration parameters..." ynh_webpath_available $domain $path_url \ || ynh_die "Path not available: ${domain}${path_url}" @@ -46,6 +48,7 @@ ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # RESTORE THE APP MAIN DIR #================================================= +ynh_print_info "Restoring the app main directory..." ynh_restore_file "$final_path" @@ -63,5 +66,12 @@ find "$final_path" -type d -print0 | xargs -0 chmod 750 #================================================= # RELOAD NGINX #================================================= +ynh_print_info "Reloading nginx web server and php-fpm..." systemctl reload nginx + +#================================================= +# END OF SCRIPT +#================================================= + +ynh_print_info "Restoration completed for $app" diff --git a/scripts/upgrade b/scripts/upgrade index 0f45516..55e3508 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -12,6 +12,7 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= +ynh_print_info "Loading installation settings..." app=$YNH_APP_INSTANCE_NAME @@ -29,6 +30,7 @@ upgrade_type=$(ynh_check_app_version_changed) #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= +ynh_print_info "Ensuring downward compatibility..." if [ "${version}" = "20160501-7" ]; then public_site=$(ynh_app_setting_get $app public_site) @@ -52,6 +54,7 @@ fi #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= +ynh_print_info "Backing up the app before upgrading (may take a while)..." # Backup the current version of the app ynh_backup_before_upgrade @@ -77,6 +80,8 @@ path_url=$(ynh_normalize_url_path $path_url) if [ "$upgrade_type" == "UPGRADE_APP" ] then + ynh_print_info "Upgrading source files..." + # Download, check integrity, uncompress and patch the source from app.src # For this app sources are in app subdirectory tmp_dir=$(mktemp -d) @@ -94,6 +99,7 @@ fi #================================================= # NGINX CONFIGURATION #================================================= +ynh_print_info "Upgrading nginx web server configuration..." # Create a dedicated nginx config ynh_add_nginx_config @@ -125,6 +131,7 @@ find "$final_path" -type d -print0 | xargs -0 chmod 750 #================================================= # SETUP SSOWAT #================================================= +ynh_print_info "Upgrading SSOwat configuration..." # Make app public if necessary if [ $is_public -eq 1 ] @@ -135,5 +142,12 @@ fi #================================================= # RELOAD NGINX #================================================= +ynh_print_info "Reloading nginx web server..." systemctl reload nginx + +#================================================= +# END OF SCRIPT +#================================================= + +ynh_print_info "Upgrade of $app completed" From da73b6d3abd8434e87881997b97ab8022d9c6831 Mon Sep 17 00:00:00 2001 From: Kayou Date: Tue, 5 Mar 2019 11:54:44 +0100 Subject: [PATCH 3/3] Bump version number --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index a57ed94..0412c24 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "url": "http://strut.io", "license": "AGPL-3.0", "requirements": { - "yunohost": ">= 3.2.0" + "yunohost": ">= 3.2.2" }, "description": { "en": "Strut is a slide editor creating impress.js presentations.",