[DRE-commits] [redmine] 10/15: debian/postinst: create secret key and fix rake calls

Antonio Terceiro terceiro at moszumanska.debian.org
Sun Feb 14 14:32:03 UTC 2016


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

terceiro pushed a commit to branch master
in repository redmine.

commit f641b6a940cf3457af3590dad59bce8cfe0435b5
Author: Antonio Terceiro <terceiro at debian.org>
Date:   Sun Feb 14 11:33:09 2016 -0200

    debian/postinst: create secret key and fix rake calls
    
    since the `bundle exec` part already requires the correct environment,
    we need to pass the variables through the environment itself and not
    through rake arguments
---
 debian/postinst | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/debian/postinst b/debian/postinst
index 4a609f9..204a36f 100644
--- a/debian/postinst
+++ b/debian/postinst
@@ -53,11 +53,18 @@ manage_instance() {
 
   dbc_go redmine/instances/$instance "$@"
 
+  local secret_key=/etc/redmine/$instance/secret_key.txt
+  if [ ! -f $secret_key ]; then
+    openssl rand -hex 16 > $secret_key
+  fi
+  chown root:www-data $secret_key
+  chmod 0640  $secret_key
+
   cd /usr/share/redmine
-  su www-data -s /bin/sh -c "bundle exec rake db:migrate REDMINE_INSTANCE=$instance SCHEMA=/dev/null"
+  su www-data -s /bin/sh -c "REDMINE_INSTANCE=$instance SCHEMA=/dev/null bundle exec rake db:migrate"
 
   # FIXME don't harcode language
-  su www-data -s /bin/sh -c "bundle exec rake redmine:load_default_data REDMINE_INSTANCE=$instance REDMINE_LANG=en"
+  su www-data -s /bin/sh -c "REDMINE_INSTANCE=$instance REDMINE_LANG=en bundle exec rake redmine:load_default_data"
 }
 
 remove_instance() {

-- 
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