From a1b7d1f800a2aeb24dd511fe22d4ac90ab5399b2 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Mon, 26 Sep 2022 02:34:37 +0200 Subject: [PATCH 1/3] Apply example_ynh --- .github/workflows/updater.sh | 24 ++++++++---------------- check_process | 1 + conf/app.src | 1 + doc/.DS_Store | Bin 6148 -> 0 bytes doc/DESCRIPTION.md | 1 + doc/DESCRIPTION_fr.md | 1 + doc/DISCLAIMER_fr.md | 3 +++ scripts/backup | 3 +-- scripts/change_url | 18 +++++++++--------- scripts/install | 22 ++++++++++++---------- scripts/remove | 4 +++- scripts/restore | 25 ++++++++++++++----------- scripts/upgrade | 9 +++++---- 13 files changed, 59 insertions(+), 53 deletions(-) delete mode 100644 doc/.DS_Store create mode 100644 doc/DESCRIPTION.md create mode 100644 doc/DESCRIPTION_fr.md create mode 100644 doc/DISCLAIMER_fr.md diff --git a/.github/workflows/updater.sh b/.github/workflows/updater.sh index 6a28689..84184dc 100755 --- a/.github/workflows/updater.sh +++ b/.github/workflows/updater.sh @@ -9,9 +9,6 @@ # Since each app is different, maintainers can adapt its contents so as to perform # automatic actions when a new upstream release is detected. -# Remove this exit command when you are ready to run this Action -#exit 1 - #================================================= # FETCHING LATEST RELEASE AND ITS ASSETS #================================================= @@ -21,36 +18,33 @@ current_version=$(cat manifest.json | jq -j '.version|split("~")[0]') repo=$(cat manifest.json | jq -j '.upstream.code|split("https://github.com/")[1]') # Some jq magic is needed, because the latest upstream release is not always the latest version (e.g. security patches for older versions) version=$(curl --silent "https://api.github.com/repos/$repo/releases" | jq -r '.[] | select( .prerelease != true ) | .tag_name' | sort -V | tail -1) -#assets=($(curl --silent "https://api.github.com/repos/$repo/releases" | jq -r '[ .[] | select(.tag_name=="'$version'").assets[].browser_download_url ] | join(" ") | @sh' | tr -d "'")) asset_url=$(curl --silent "https://api.github.com/repos/$repo/releases" | jq -r '.[] | select(.tag_name=="'$version'").tarball_url') # Later down the script, we assume the version has only digits and dots # Sometimes the release name starts with a "v", so let's filter it out. -# You may need more tweaks here if the upstream repository has different naming conventions. +# You may need more tweaks here if the upstream repository has different naming conventions. if [[ ${version:0:1} == "v" || ${version:0:1} == "V" ]]; then - version=${version:1} + version=${version:1} fi # Setting up the environment variables echo "Current version: $current_version" echo "Latest release from upstream: $version" echo "VERSION=$version" >> $GITHUB_ENV +echo "REPO=$repo" >> $GITHUB_ENV # For the time being, let's assume the script will fail echo "PROCEED=false" >> $GITHUB_ENV # Proceed only if the retrieved version is greater than the current one if ! dpkg --compare-versions "$current_version" "lt" "$version" ; then - echo "::warning ::No new version available" - exit 0 + echo "::warning ::No new version available" + exit 0 # Proceed only if a PR for this new version does not already exist elif git ls-remote -q --exit-code --heads https://github.com/$GITHUB_REPOSITORY.git ci-auto-update-v$version ; then - echo "::warning ::A branch already exists for this update" - exit 0 + echo "::warning ::A branch already exists for this update" + exit 0 fi -# Each release can hold multiple assets (e.g. binaries for different architectures, source code, etc.) -#echo "${#assets[@]} available asset(s)" - #================================================= # UPDATE SOURCE FILES #================================================= @@ -58,9 +52,6 @@ fi # Here we use the $assets variable to get the resources published in the upstream release. # Here is an example for Grav, it has to be adapted in accordance with how the upstream releases look like. -# Let's loop over the array of assets URLs -#for asset_url in ${assets[@]}; do - echo "Handling asset at $asset_url" src="app" @@ -84,6 +75,7 @@ SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true SOURCE_FILENAME= +SOURCE_EXTRACT=true EOT echo "... conf/$src.src updated" diff --git a/check_process b/check_process index f2f2a00..7f4141c 100644 --- a/check_process +++ b/check_process @@ -14,6 +14,7 @@ upgrade=1 from_commit=885714c04d928e26dd3555324b078fdafa24b7bb backup_restore=1 multi_instance=1 + port_already_use=0 change_url=1 ;;; Options Email= diff --git a/conf/app.src b/conf/app.src index 17a7a35..b92ca68 100644 --- a/conf/app.src +++ b/conf/app.src @@ -4,3 +4,4 @@ SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true SOURCE_FILENAME= +SOURCE_EXTRACT=true diff --git a/doc/.DS_Store b/doc/.DS_Store deleted file mode 100644 index c90376b56b73b627c519d1a34c5d8c9abb7004dc..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHKyG{c^3>-s>NNG}1?l15Mt0;UyegFv&DbPhqfch%Fi%(bFB<-Yt6!=#P*lfL7ulP#UTPH8)y|&RG>0a|qcjG!J4AG8> j(T=(Cc6=8_S=W5c^IkY62A%n!6ZJFTy2zx!wH5dQ#>Eyj diff --git a/doc/DESCRIPTION.md b/doc/DESCRIPTION.md new file mode 100644 index 0000000..117dac2 --- /dev/null +++ b/doc/DESCRIPTION.md @@ -0,0 +1 @@ +diagrams.net (formerly draw.io) lets you create a wide range of diagrams, from simple tree and flow diagrams, to highly technical network, rack and electrical diagrams. diff --git a/doc/DESCRIPTION_fr.md b/doc/DESCRIPTION_fr.md new file mode 100644 index 0000000..e3f1bef --- /dev/null +++ b/doc/DESCRIPTION_fr.md @@ -0,0 +1 @@ +Application en ligne qui permet de faire des schémas et du dessin vectoriel diff --git a/doc/DISCLAIMER_fr.md b/doc/DISCLAIMER_fr.md new file mode 100644 index 0000000..ca79a43 --- /dev/null +++ b/doc/DISCLAIMER_fr.md @@ -0,0 +1,3 @@ +## Caractéristiques spécifiques de YunoHost + +* L'intégration de sites web tiers (Dropbox, Google, Trello, etc.) est désactivée. diff --git a/scripts/backup b/scripts/backup index f441cc6..13af146 100644 --- a/scripts/backup +++ b/scripts/backup @@ -6,7 +6,7 @@ # IMPORT GENERIC HELPERS #================================================= -#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts +# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers @@ -15,7 +15,6 @@ source /usr/share/yunohost/helpers #================================================= 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 diff --git a/scripts/change_url b/scripts/change_url index e2f8ce1..3950b01 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -30,9 +30,9 @@ ynh_script_progression --message="Loading installation settings..." --weight=1 final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= -# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP +# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP #================================================= -ynh_script_progression --message="Backing up the app before changing its url (may take a while)..." --weight=1 +ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1 # Backup the current version of the app ynh_backup_before_upgrade @@ -40,7 +40,7 @@ ynh_clean_setup () { # 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" - # restore it if the upgrade fails + # Restore it if the upgrade fails ynh_restore_upgradebackup } # Exit if an error occurs during the execution of the script @@ -67,23 +67,23 @@ fi #================================================= # MODIFY URL IN NGINX CONF #================================================= -ynh_script_progression --message="Updating nginx web server configuration..." --weight=25 +ynh_script_progression --message="Updating NGINX web server configuration..." --weight=25 nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf -# Change the path in the nginx config file +# 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 + # Make a backup of the original NGINX config file if modified ynh_backup_if_checksum_is_different --file="$nginx_conf_path" - # Set global variables for nginx helper + # Set global variables for NGINX helper domain="$old_domain" path_url="$new_path" - # Create a dedicated nginx config + # Create a dedicated NGINX config ynh_add_nginx_config fi -# Change the domain for nginx +# Change the domain for NGINX if [ $change_domain -eq 1 ] then # Delete file checksum for the old conf file location diff --git a/scripts/install b/scripts/install index 4ce66da..80b28bb 100644 --- a/scripts/install +++ b/scripts/install @@ -14,7 +14,6 @@ source /usr/share/yunohost/helpers #================================================= 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 @@ -49,6 +48,8 @@ ynh_script_progression --message="Storing installation settings..." --weight=2 ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=path --value=$path_url +#================================================= +# STANDARD MODIFICATIONS #================================================= # CREATE DEDICATED USER #================================================= @@ -63,8 +64,14 @@ ynh_system_user_create --username=$app --home_dir="$final_path" ynh_script_progression --message="Setting up source files..." --weight=2 ynh_app_setting_set --app=$app --key=final_path --value=$final_path +# Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$final_path" +# Add "offline" parameter in index.html +# See https://desk.draw.io/support/solutions/articles/16000042546-what-url-parameters-are-supported- +sed_pattern="s/var params = window.location.search.slice(1).split('&');/&\n\t\t\tparams.push(\"offline=1\");/g" +sed -i "$sed_pattern" "$final_path/src/main/webapp/index.html" + chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" @@ -74,18 +81,11 @@ chown -R $app:www-data "$final_path" #================================================= ynh_script_progression --message="Configuring NGINX web server..." --weight=15 -# Create a dedicated nginx config +# Create a dedicated NGINX config ynh_add_nginx_config #================================================= -# REMOVE CALLS TO THIRD PARTY WEBSITES -#================================================= - -# Add "offline" parameter in index.html -# See https://desk.draw.io/support/solutions/articles/16000042546-what-url-parameters-are-supported- -sed_pattern="s/var params = window.location.search.slice(1).split('&');/&\n\t\t\tparams.push(\"offline=1\");/g" -sed -i "$sed_pattern" "$final_path/src/main/webapp/index.html" - +# GENERIC FINALIZATION #================================================= # SETUP SSOWAT #================================================= @@ -94,6 +94,8 @@ ynh_script_progression --message="Configuring permissions..." --weight=3 # Make app public if necessary if [ $is_public -eq 1 ] then + # Everyone can access the app. + # The "main" permission is automatically created before the install script. ynh_permission_update --permission="main" --add="visitors" fi diff --git a/scripts/remove b/scripts/remove index aaabbe3..214930d 100644 --- a/scripts/remove +++ b/scripts/remove @@ -18,6 +18,8 @@ app=$YNH_APP_INSTANCE_NAME final_path=$(ynh_app_setting_get --app=$app --key=final_path) +#================================================= +# STANDARD REMOVE #================================================= # REMOVE APP MAIN DIR #================================================= @@ -31,7 +33,7 @@ ynh_secure_remove --file="$final_path" #================================================= ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1 -# Remove the dedicated nginx config +# Remove the dedicated NGINX config ynh_remove_nginx_config #================================================= diff --git a/scripts/restore b/scripts/restore index 5c03f66..92148ef 100644 --- a/scripts/restore +++ b/scripts/restore @@ -6,7 +6,7 @@ # IMPORT GENERIC HELPERS #================================================= -#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts +# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers @@ -15,7 +15,6 @@ source /usr/share/yunohost/helpers #================================================= 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 @@ -24,7 +23,7 @@ ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading settings..." --weight=1 +ynh_script_progression --message="Loading installation settings..." --weight=1 app=$YNH_APP_INSTANCE_NAME @@ -37,16 +36,11 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= ynh_script_progression --message="Validating restoration parameters..." --weight=2 -test ! -d $final_path || ynh_die --message="There is already a directory: $final_path " +test ! -d $final_path \ + || ynh_die --message="There is already a directory: $final_path " #================================================= # STANDARD RESTORATION STEPS -#================================================= -# RESTORE THE NGINX CONFIGURATION -#================================================= - -ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" - #================================================= # RECREATE THE DEDICATED USER #================================================= @@ -66,12 +60,21 @@ chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" +#================================================= +# SPECIFIC RESTORATION +#================================================= +# RESTORE THE NGINX CONFIGURATION +#================================================= +ynh_script_progression --message="Restoring the NGINX web server configuration..." --weight=1 + +ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" + #================================================= # GENERIC FINALIZATION #================================================= # RELOAD NGINX AND PHP-FPM #================================================= -ynh_script_progression --message="Reloading NGINX web server .." --weight=2 +ynh_script_progression --message="Reloading NGINX web server..." --weight=2 ynh_systemd_action --service_name=nginx --action=reload diff --git a/scripts/upgrade b/scripts/upgrade index 6b35514..7d69dec 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -23,6 +23,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= # CHECK VERSION #================================================= +ynh_script_progression --message="Checking version..." --weight=1 upgrade_type=$(ynh_check_app_version_changed) @@ -34,12 +35,14 @@ ynh_script_progression --message="Backing up the app before upgrading (may take # Backup the current version of the app ynh_backup_before_upgrade ynh_clean_setup () { - # restore it if the upgrade fails + # Restore it if the upgrade fails ynh_restore_upgradebackup } # Exit if an error occurs during the execution of the script ynh_abort_if_errors +#================================================= +# STANDARD UPGRADE STEPS #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= @@ -60,8 +63,6 @@ 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" -#================================================= -# STANDARD UPGRADE STEPS #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -88,7 +89,7 @@ chown -R $app:www-data "$final_path" #================================================= ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=17 -# Create a dedicated nginx config +# Create a dedicated NGINX config ynh_add_nginx_config #================================================= From 6ec211faa2e7e0eba1068731ee1872b5b9696d63 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Mon, 26 Sep 2022 00:34:43 +0000 Subject: [PATCH 2/3] Auto-update README --- README.md | 3 ++- README_fr.md | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 42337a7..9170173 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,8 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in ## Overview -Online diagram software for making flowcharts, process diagrams, org charts, UML, ER and network diagrams +diagrams.net (formerly draw.io) lets you create a wide range of diagrams, from simple tree and flow diagrams, to highly technical network, rack and electrical diagrams. + **Shipped version:** 20.2.8~ynh1 diff --git a/README_fr.md b/README_fr.md index de2a580..30ae95e 100644 --- a/README_fr.md +++ b/README_fr.md @@ -17,6 +17,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour Application en ligne qui permet de faire des schémas et du dessin vectoriel + **Version incluse :** 20.2.8~ynh1 @@ -28,9 +29,9 @@ Application en ligne qui permet de faire des schémas et du dessin vectoriel ## Avertissements / informations importantes -## YunoHost specific features +## Caractéristiques spécifiques de YunoHost -* Integration of third-party websites (Dropbox, Google, Trello, etc.) is disabled. +* L'intégration de sites web tiers (Dropbox, Google, Trello, etc.) est désactivée. ## Documentations et ressources From e91b418561ffd4fa0e0568b019c31bdfc65fcde5 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Sat, 1 Oct 2022 10:16:29 +0000 Subject: [PATCH 3/3] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9170173..fd5845a 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in diagrams.net (formerly draw.io) lets you create a wide range of diagrams, from simple tree and flow diagrams, to highly technical network, rack and electrical diagrams. -**Shipped version:** 20.2.8~ynh1 +**Shipped version:** 20.2.8~ynh1 *(:warning: This is the `testing` branch. The [`master` branch](https://github.com/YunoHost-Apps/diagramsnet_ynh/tree/master) used in the catalog is currently on version 20.2.6\~ynh1.)* **Demo:** https://app.diagrams.net/ diff --git a/README_fr.md b/README_fr.md index 30ae95e..059d42d 100644 --- a/README_fr.md +++ b/README_fr.md @@ -18,7 +18,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour Application en ligne qui permet de faire des schémas et du dessin vectoriel -**Version incluse :** 20.2.8~ynh1 +**Version incluse :** 20.2.8~ynh1 *(:warning: Il s'agit de la branche `testing`. La [branche `master`](https://github.com/YunoHost-Apps/diagramsnet_ynh/tree/master) utilisée dans le catalogue est actuellement en 20.2.6\~ynh1.)* **Démo :** https://app.diagrams.net/