[ckan-changes] commit/ckan-debs-public: jame... at okfn.org: Improvements to support ckan-std

Bitbucket commits-noreply at bitbucket.org
Mon Jun 27 10:49:58 UTC 2011


1 new changeset in ckan-debs-public:

http://bitbucket.org/okfn/ckan-debs-public/changeset/181101d9fbd6/
changeset:   181101d9fbd6
user:        jame... at okfn.org
date:        2011-06-27 12:49:47
summary:     Improvements to support ckan-std
affected #:  1 file (20 bytes)

--- a/ckan-common/usr/lib/ckan/common.sh	Wed Jun 22 20:04:04 2011 +0100
+++ b/ckan-common/usr/lib/ckan/common.sh	Mon Jun 27 11:49:47 2011 +0100
@@ -91,7 +91,7 @@
 ckan_create_config_file () {
     local INSTANCE password
     if [ "X$1" = "X" ] || [ "X$2" = "X" ] ; then
-        echo "ERROR: call the function create_who_ini function with an INSTANCE name, and a password for postgresql e.g." 
+        echo "ERROR: call the function create_config_file function with an INSTANCE name, and a password for postgresql e.g." 
         echo "       dgu 1U923hjkh8"
         echo "       You can generate a password like this: "
         echo "           < /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c10"
@@ -99,24 +99,23 @@
     else
         INSTANCE=$1
         password=$2
-        if ! [ -f /etc/ckan/${INSTANCE}/${INSTANCE}.ini ] ; then
-            paster make-config ckan /etc/ckan/${INSTANCE}/${INSTANCE}.ini
-            sed -e "s,^\(email_to\)[ =].*,\1 = root," \
-                -e "s,^\(error_email_from\)[ =].*,\1 = ckan-${INSTANCE}@`hostname`," \
-                -e "s,^\(cache_dir\)[ =].*,\1 = /var/lib/ckan/${INSTANCE}/data," \
-                -e "s,^\(who.config_file\)[ =].*,\1 = /etc/ckan/${INSTANCE}/who.ini," \
-                -e "s,%(here)s/ckan.log,/var/log/ckan/${INSTANCE}/${INSTANCE}.log," \
-                -e "s,^\(sqlalchemy.url\)[ =].*,\1 = postgresql://${INSTANCE}:${password}@localhost/${INSTANCE}," \
-                -e "s,ckan.log,/var/log/ckan/${INSTANCE}/${INSTANCE}.log," \
-                -i /etc/ckan/${INSTANCE}/${INSTANCE}.ini
-        fi
+        mv /etc/ckan/${INSTANCE}/${INSTANCE}.ini "/etc/ckan/${INSTANCE}/${INSTANCE}.ini.`date +%F_%T`.bak"
+        paster make-config ckan /etc/ckan/${INSTANCE}/${INSTANCE}.ini
+        sed -e "s,^\(email_to\)[ =].*,\1 = root," \
+            -e "s,^\(error_email_from\)[ =].*,\1 = ckan-${INSTANCE}@`hostname`," \
+            -e "s,^\(cache_dir\)[ =].*,\1 = /var/lib/ckan/${INSTANCE}/data," \
+            -e "s,^\(who.config_file\)[ =].*,\1 = /etc/ckan/${INSTANCE}/who.ini," \
+            -e "s,%(here)s/ckan.log,/var/log/ckan/${INSTANCE}/${INSTANCE}.log," \
+            -e "s,^\(sqlalchemy.url\)[ =].*,\1 = postgresql://${INSTANCE}:${password}@localhost/${INSTANCE}," \
+            -e "s,ckan.log,/var/log/ckan/${INSTANCE}/${INSTANCE}.log," \
+            -i /etc/ckan/${INSTANCE}/${INSTANCE}.ini
     fi
 }
 
 ckan_add_or_replace_database_user () {
     local INSTANCE password
     if [ "X$1" = "X" ] || [ "X$2" = "X" ] ; then
-        echo "ERROR: call the function create_who_ini function with an INSTANCE name, and a password for postgresql e.g." 
+        echo "ERROR: call the function ckan_add_or_replace_database_user function with an INSTANCE name, and a password for postgresql e.g." 
         echo "       dgu 1U923hjkh8"
         echo "       You can generate a password like this: "
         echo "           < /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c10"
@@ -138,7 +137,7 @@
 ckan_ensure_db_exists () {
     local INSTANCE
     if [ "X$1" = "X" ] ; then
-        echo "ERROR: call the function create_who_ini function with an INSTANCE name, e.g." 
+        echo "ERROR: call the function ensure_db_exists function with an INSTANCE name, e.g." 
         echo "       dgu"
         exit 1
     else
@@ -146,7 +145,7 @@
         COMMAND_OUTPUT=`sudo -u postgres psql -l`
         if ! [[ "$COMMAND_OUTPUT" =~ ${INSTANCE} ]] ; then
             echo "Creating the database ..."
-            su postgres -c "createdb -O ${INSTANCE} ${INSTANCE}"
+            sudo -u postgres createdb -O ${INSTANCE} ${INSTANCE}
         fi
     fi
 }

Repository URL: https://bitbucket.org/okfn/ckan-debs-public/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.




More information about the ckan-changes mailing list