[DRE-commits] [redmine] 08/15: debian/postinst: fix check for existing session.yml file

Antonio Terceiro terceiro at moszumanska.debian.org
Sat May 2 21:00:06 UTC 2015


This is an automated email from the git hooks/post-receive script.

terceiro pushed a commit to branch master
in repository redmine.

commit 1aaeade2b6bfb9f596a67df7ca7e8fac867ecebb
Author: Antonio Terceiro <terceiro at debian.org>
Date:   Thu Apr 9 15:31:57 2015 +0200

    debian/postinst: fix check for existing session.yml file
---
 debian/changelog | 1 +
 debian/postinst  | 7 +++----
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 299e33f..ea4f7dd 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -25,6 +25,7 @@ redmine (3.0~20140825-6) UNRELEASED; urgency=medium
   * debian/install:
     - install bin/ directory so rails detects redmine as a proper Rails app
     - don't install deprecated script/ directory
+  * debian/postinst: fix check for existing session.yml file
 
  -- Antonio Terceiro <terceiro at debian.org>  Wed, 08 Apr 2015 12:06:32 +0200
 
diff --git a/debian/postinst b/debian/postinst
index e5dd750..c2a3462 100644
--- a/debian/postinst
+++ b/debian/postinst
@@ -263,8 +263,8 @@ for lInstance in $gInstances; do
 			fi
 			#fi
 			# add secret key, set permissions, manage file with ucf
-			# trigger when session file doesn't exist or we are upgrading from previous version
-			if [ ! -f "${fRailsEtc}/session.yml" ] || [ "$1" != triggered ] && dpkg --compare-versions "$2" lt "2.1.4+dfsg2-2~"; then
+			# trigger when session file doesn't exist
+			if [ ! -f "${fRailsEtc}/session.yml" ]; then
 				bundle exec rake -s generate_secret_token YML_SESSION_FILENAME="session.yml.new" RAILS_ENV=$fRailsEnv X_DEBIAN_SITEID="${lInstance}" || true
 				chown -f root:www-data ${fRailsEtc}/session.yml.new
 				chmod 640 ${fRailsEtc}/session.yml.new
@@ -273,8 +273,7 @@ for lInstance in $gInstances; do
 				# move old session_store.rb
 				echo "A new secret session key has been generated in ${fRailsEtc}/session.yml"
 			else
-				fHasOldSessionName=$(fgrep -c session_key "${fRailsEtc}/session.yml" || true)
-				if [ "$fHasOldSessionName" -gt 0 ]; then
+				if ! grep -q session_key "${fRailsEtc}/session.yml"; then
 					# in-place, because ucf might be configured to keep the old version without asking
 					sed -i -r -e 's/session_key/key/g' ${fRailsEtc}/session.yml		
 				fi

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/redmine.git



More information about the Pkg-ruby-extras-commits mailing list