[ckan-changes] commit/ckanext-std: jame... at okfn.org: Committing the correct postinst this time

Bitbucket commits-noreply at bitbucket.org
Mon Jun 27 10:59:54 UTC 2011


1 new changeset in ckanext-std:

http://bitbucket.org/okfn/ckanext-std/changeset/b5fcfab3c555/
changeset:   b5fcfab3c555
user:        jame... at okfn.org
date:        2011-06-27 12:59:44
summary:     Committing the correct postinst this time
affected #:  2 files (3.9 KB)

--- a/package/DEBIAN/postinst	Mon Jun 27 11:48:50 2011 +0100
+++ b/package/DEBIAN/postinst	Mon Jun 27 11:59:44 2011 +0100
@@ -1,113 +1,4 @@
 #!/bin/bash
-. /usr/lib/ckan/common.sh
+# . /usr/bin/ckan-std-install
+# Uncomment the line above to have ckan-std installed automatically
 
-# The above command means import the bash functions from there so we can 
-# use them here
-
-# Things that could be done in a future version of this script
-# * Have a separate config for PostgreSQL password and Apache names
-
-# Exit immediately if there is ever a command that returns a non-zero value
-# and don't process any more commands, most likley leaving CKAN in maintenance
-# mode
-
-# Check we are root, something has gone very wrong if we are not!
-if [[ $EUID -ne 0 ]]; then
-   echo "This script must be run as root"
-   exit 1
-fi
-
-INSTANCE="std"
-
-echo "Ensuring users and groups are set up correctly ..."
-ckan_ensure_users_and_groups ${INSTANCE}
-
-# Disable any existing crontabs during the upgrade, we don't want
-# scripts running when things are still changing
-echo "Disabling the crontab for the ckan${INSTANCE} user ..."
-PACKAGED_CRONJOB="/tmp/${INSTANCE}-cronjob"
-cat <<EOF > ${PACKAGED_CRONJOB}
-# m  h dom mon dow  command
-EOF
-crontab -u ckan${INSTANCE} ${PACKAGED_CRONJOB}
-
-# Try to put CKAN into maintenance mode, if it is installed
-if [ -f /etc/apache2/sites-available/${INSTANCE}.maint ] ; then
-    # We have a maintence mode available
-    echo "Putting CKAN into maintenance mode ..."
-    ckan_maintenance_on ${INSTANCE}
-fi
-
-echo "Ensuring directories exist for ${INSTANCE} CKAN INSTANCE ..."
-ckan_make_ckan_directories ${INSTANCE}
-
-echo "Setting log file permissions so that both Apache and cron jobs can log to the same place ..."
-ckan_set_log_file_permissions ${INSTANCE}
-
-echo "Ensuring who.ini file exists for data.gov.uk CKAN INSTANCE ..."
-ckan_create_who_ini ${INSTANCE}
-
-echo "Ensuring ${INSTANCE}.py file exists for data.gov.uk CKAN INSTANCE ..."
-ckan_create_wsgi_handler ${INSTANCE}
-
-echo "Ensuring ${INSTANCE}.ini file exists for data.gov.uk CKAN INSTANCE ..."
-if ! [ -f /etc/ckan/${INSTANCE}/${INSTANCE}.ini ] ; then
-    # Create a password
-    password=`< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c10`
-    # Replace any existing user with a new one with this password
-    echo "Setting the password of the ${INSTANCE} user in PostgreSQL"
-    ckan_add_or_replace_database_user ${INSTANCE} ${password}
-    # Create the config file
-    echo "Creating a data.gov.uk config for CKAN with the same password as the DGU user"
-    # We use the actual password in PostgreSQL in case any non-sense has gone on
-    ckan_create_config_file ${INSTANCE} ${password}
-    # Now that the file exists, make some customisations
-    sed \
-        -e "s,^\(ckan.dump_dir\)[ =].*,\1 = /var/lib/ckan/${INSTANCE}/static/dump," \
-        -i /etc/ckan/${INSTANCE}/${INSTANCE}.ini
-fi
-
-echo "Ensuring the latest plugins are configured ..."
-sed -e "s,^\(ckan.plugins\)[ =].*,\1 = ${INSTANCE}," \
-    -i /etc/ckan/${INSTANCE}/${INSTANCE}.ini
-
-echo "Ensuring the ${INSTANCE} database exists ..."
-ckan_ensure_db_exists ${INSTANCE}
-
-# Overwrite the existing Apache config
-if [ -f /etc/apache2/sites-enabled/default ] ; then
-    echo "Disabling the default Apache site ..."
-    a2dissite default
-fi
-
-echo "Overwriting the existing Apache config ..."
-ckan_overwrite_apache_config ${INSTANCE} ckan${INSTANCE}.localhost ckan${INSTANCE}.yourdomain.org
-
-# Make sure mod_rewrite is enabled
-if ! [ -f /etc/apache2/mods-enabled/rewrite.load ] ; then
-    echo "Enabling Apache mod_rewite ..."
-    a2enmod rewrite
-fi
-
-# Standard paster db upgrade
-echo "Performing any database upgrades ..."
-paster --plugin=ckan db upgrade --config=/etc/ckan/${INSTANCE}/${INSTANCE}.ini
-
-# Make sure our INSTANCE is enabled
-echo "Bringing the ${INSTANCE} INSTANCE out of maintenance mode ..."
-ckan_maintenance_off ${INSTANCE}
-
-# Restart Apache so it is aware of any changes
-echo "Restarting apache ..."
-/etc/init.d/apache2 restart 
-
-# Install the new crontab
-echo "Enabling crontab for the ckan${INSTANCE} user ..."
-PACKAGED_CRONJOB="/tmp/${INSTANCE}-cronjob"
-cat <<EOF > ${PACKAGED_CRONJOB}
-# WARNING:  Do not edit these cron tabs, they will be overwritten any time 
-#           the ckan INSTANCE package is upgraded
-# QUESTION: Should email reports be sent to root?
-EOF
-crontab -u ckan${INSTANCE} ${PACKAGED_CRONJOB}
-


--- a/package/debian/postinst	Mon Jun 27 11:48:50 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,4 +0,0 @@
-#!/bin/bash
-# . /usr/bin/ckan-std-install
-# Uncomment the line above to have ckan-std installed automatically
-

Repository URL: https://bitbucket.org/okfn/ckanext-std/

--

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