From 4d9f1d6b844fe0942dbcae9f8bd6987391a416a4 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Mon, 28 Jan 2019 23:57:45 +0100 Subject: [PATCH 1/9] Service was added during install, but not remove during remove... --- scripts/remove | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/remove b/scripts/remove index a09e254..721d5ee 100644 --- a/scripts/remove +++ b/scripts/remove @@ -64,6 +64,12 @@ ynh_remove_fpm_config ynh_remove_systemd_config +#================================================= +# REMOVE SERVICE INTEGRATION +#================================================= + +yunohost service remove $app + #================================================= # GENERIC FINALIZATION #================================================= From b898447fde543e80bc951a323a2c424d43d04005 Mon Sep 17 00:00:00 2001 From: Maniack Crudelis Date: Tue, 29 Jan 2019 12:56:36 +0100 Subject: [PATCH 2/9] Update according to example_ynh --- scripts/remove | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/remove b/scripts/remove index 721d5ee..225440d 100644 --- a/scripts/remove +++ b/scripts/remove @@ -65,10 +65,15 @@ ynh_remove_fpm_config ynh_remove_systemd_config #================================================= -# REMOVE SERVICE INTEGRATION +# REMOVE SERVICE FROM ADMIN PANEL #================================================= -yunohost service remove $app +# Remove a service from the admin panel, added by `yunohost service add` +if yunohost service status | grep -q $app +then + echo "Remove $app service" + yunohost service remove $app +fi #================================================= # GENERIC FINALIZATION From 82ef633c604f0a5e3e74bd7843d80241e2b567ba Mon Sep 17 00:00:00 2001 From: Josue-T Date: Fri, 1 Feb 2019 10:59:18 +0100 Subject: [PATCH 3/9] Fix remote login user When the authenticated user change, TTRSS keep the old user by the cookies Force TTRSS to reload the the "REMOTE_USER" if it change --- sources/patches/app-login_remote_user.patch | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 sources/patches/app-login_remote_user.patch diff --git a/sources/patches/app-login_remote_user.patch b/sources/patches/app-login_remote_user.patch new file mode 100644 index 0000000..0ae748b --- /dev/null +++ b/sources/patches/app-login_remote_user.patch @@ -0,0 +1,21 @@ +--- /include/functions.php ++++ /include/functions.php +@@ -825,6 +825,18 @@ + } + + } else { ++ /* We need to check that the "REMOTE_USER" and "uid" are same. ++ * If it has changed it's probably that the user logged out and ++ * was authenticated with a other username. ++ * In this case we need to reauthenticate the user ++ */ ++ if (AUTH_AUTO_LOGIN && $_SERVER["REMOTE_USER"] != $_SESSION["uid"]) { ++ if (authenticate_user(null, null)) { ++ $_SESSION["ref_schema_version"] = get_schema_version(true); ++ } else { ++ authenticate_user(null, null, true); ++ } ++ } + /* bump login timestamp */ + $sth = $pdo->prepare("UPDATE ttrss_users SET last_login = NOW() WHERE id = ?"); + $sth->execute([$_SESSION['uid']]); From 0dc6a1d0bc9ca574c1df82d4cd8d821be8685186 Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Mon, 4 Mar 2019 11:15:52 +0100 Subject: [PATCH 4/9] Upgrade to upstream version 19.2 --- conf/app.src | 4 ++-- manifest.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/conf/app.src b/conf/app.src index 310a01e..9d5c41e 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://git.tt-rss.org/git/tt-rss/archive/153cb6d30510f9804fe596ac6777bc2f35111ae2.tar.gz -SOURCE_SUM=1413d5d2ce6e4dfd63f4c69bb79f6e18287313756329eaf61928ce25085ebc13 +SOURCE_URL=https://git.tt-rss.org/git/tt-rss/archive/925065b1fed03710cef9018c2078b95b0fa425ad.tar.gz +SOURCE_SUM=e6fd03953a8aff10515777becc453baec1b83c5ecb929728ddf1fe6cf75c6380 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true diff --git a/manifest.json b/manifest.json index 0d4dc66..5120f1c 100644 --- a/manifest.json +++ b/manifest.json @@ -8,7 +8,7 @@ }, "url": "http://tt-rss.org", "license": "GPL-3.0-only", - "version": "153cb6d30510f9804fe596ac6777bc2f35111ae2", + "version": "19.2~ynh1", "maintainer": { "name": "titoko", "email": "titoko@titoko.fr" From de75a9073709cfd54921322e08bb97438e214be9 Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Mon, 4 Mar 2019 13:37:21 +0100 Subject: [PATCH 5/9] Point to formal 19.2 release --- conf/app.src | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/conf/app.src b/conf/app.src index 9d5c41e..5f77699 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://git.tt-rss.org/git/tt-rss/archive/925065b1fed03710cef9018c2078b95b0fa425ad.tar.gz -SOURCE_SUM=e6fd03953a8aff10515777becc453baec1b83c5ecb929728ddf1fe6cf75c6380 +SOURCE_URL=https://git.tt-rss.org/git/tt-rss/archive/19.2.tar.gz +SOURCE_SUM=6a4bfa9d0706bdcdd342f1a4e89e160b7bccb9396dcdfa52da2dd6bb6b5e5ec9 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true From 291fc4715a6a8ecaa1a7cea3dd650e8e7006aa3b Mon Sep 17 00:00:00 2001 From: Maniack Crudelis Date: Sun, 10 Mar 2019 12:01:48 +0100 Subject: [PATCH 6/9] YNH requirement at 3.2.0 --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 5120f1c..fda86fe 100644 --- a/manifest.json +++ b/manifest.json @@ -14,7 +14,7 @@ "email": "titoko@titoko.fr" }, "requirements": { - "yunohost": ">= 2.7.12" + "yunohost": ">= 3.2.0" }, "multi_instance": true, "services": [ From 3c2240a9cd4aa0a56c7cb9c70557d144c3518c3b Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Sun, 17 Mar 2019 12:34:20 +0100 Subject: [PATCH 7/9] Fix upgrade (don't keep deleted files from older upstream versions) --- scripts/_common.sh | 26 ++++++++++++++++++++++++++ scripts/upgrade | 16 ++++++++++++++-- 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index d92d1ad..31bfc5a 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -14,3 +14,29 @@ ynh_delete_file_checksum () { local checksum_setting_name=checksum_${1//[\/ ]/_} # Replace all '/' and ' ' by '_' ynh_app_setting_delete $app $checksum_setting_name } + +ynh_smart_mktemp () { + local min_size="${1:-300}" + # Transform the minimum size from megabytes to kilobytes + min_size=$(( $min_size * 1024 )) + + # Check if there's enough free space in a directory + is_there_enough_space () { + local free_space=$(df --output=avail "$1" | sed 1d) + test $free_space -ge $min_size + } + + if is_there_enough_space /tmp; then + local tmpdir=/tmp + elif is_there_enough_space /var; then + local tmpdir=/var + elif is_there_enough_space /; then + local tmpdir=/ + elif is_there_enough_space /home; then + local tmpdir=/home + else + ynh_die "Insufficient free space to continue..." + fi + + echo "$(sudo mktemp --directory --tmpdir="$tmpdir")" +} diff --git a/scripts/upgrade b/scripts/upgrade index fa8304a..8418c00 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -6,7 +6,7 @@ # IMPORT GENERIC HELPERS #================================================= -# source _common.sh +source _common.sh source /usr/share/yunohost/helpers #================================================= @@ -64,8 +64,11 @@ path_url=$(ynh_normalize_url_path $path_url) # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= +# Create a temporary directory +tmpdir="$(ynh_smart_mktemp 10)" + # Download, check integrity, uncompress and patch the source from app.src -ynh_setup_source "$final_path" +ynh_setup_source "$tmpdir" #================================================= # NGINX CONFIGURATION @@ -99,6 +102,14 @@ ynh_add_fpm_config # CONFIGURE TTRSS #================================================= +# Backup the config file in the temp dir +cp -a "$final_path/config.php" "$tmpdir/config.php" + +# Replace the old ttrss by the new one +ynh_secure_remove "$final_path" +mv "$tmpdir" "$final_path" +ynh_secure_remove "$tmpdir" + # Verify the checksum and backup the file if it's different ynh_backup_if_checksum_is_different "$final_path/config.php" @@ -126,6 +137,7 @@ sudo -u $app php ${final_path}/update.php --update-schema # Set permissions to app files chown -R root: $final_path +chmod 0755 $final_path chown -R $app $final_path/{cache,feed-icons,lock} #================================================= From 122ad91d7c727564a1bfb3e46ca18e2c6e13713f Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Sun, 24 Mar 2019 09:38:33 +0100 Subject: [PATCH 8/9] Delete temporary folder in case of upgrade failure --- scripts/upgrade | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/upgrade b/scripts/upgrade index 8418c00..ad523b7 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -40,6 +40,10 @@ fi ynh_backup_before_upgrade # Backup the current version of the app ynh_clean_setup () { + # Delete any created temporary folder + if [ -v tmpdir ] && [ -d $tmpdir ]; then + ynh_secure_remove $tmpdir + fi ynh_restore_upgradebackup # restore it if the upgrade fails } ynh_abort_if_errors # Active trap pour arrêter le script si une erreur est détectée. From 89f0121cda446fe755c004ed290cb1cd4f3366b1 Mon Sep 17 00:00:00 2001 From: Maniack Crudelis Date: Sun, 24 Mar 2019 16:48:21 +0100 Subject: [PATCH 9/9] Update pull_request_template.md --- pull_request_template.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pull_request_template.md b/pull_request_template.md index 6c8f664..676c89a 100644 --- a/pull_request_template.md +++ b/pull_request_template.md @@ -19,7 +19,6 @@ - [ ] **Approval (LGTM)** : - [ ] **Approval (LGTM)** : - **CI succeeded** : -[![Build Status](https://ci-apps-dev.yunohost.org/jenkins/job/ttrss_ynh%20-BRANCH-%20(Official)/badge/icon)](https://ci-apps-dev.yunohost.org/jenkins/job/ttrss_ynh%20-BRANCH-%20(Official)/) *Please replace '-BRANCH-' in this link for a PR from a local branch.* -or -[![Build Status](https://ci-apps-dev.yunohost.org/jenkins/job/ttrss_ynh%20PR-NUM-%20(Official_fork)/badge/icon)](https://ci-apps-dev.yunohost.org/jenkins/job/ttrss_ynh%20PR-NUM-%20(Official_fork)/) *Replace '-NUM-' by the PR number in this link for a PR from a forked repository.* +[![Build Status](https://ci-apps-dev.yunohost.org/jenkins/job/ttrss_ynh%20PR-NUM-/badge/icon)](https://ci-apps-dev.yunohost.org/jenkins/job/ttrss_ynh%20PR-NUM-/) +*Please replace '-NUM-' in this link by the PR number.* When the PR is marked as ready to merge, you have to wait for 3 days before really merging it.