From: zak Date: Sun, 25 Sep 2005 11:59:24 +0000 (+0000) Subject: Updates to mir-setup scripts X-Git-Tag: BEFORE_MERGE_1_1~16 X-Git-Url: http://erislabs.net/gitweb/?a=commitdiff_plain;h=b4e059d1c7ae8124456a04c12f1e07f856c9a284;hp=1fb8d39a6fcab65e63e42770e2878cc39c915c0c;p=mir.git Updates to mir-setup scripts --- diff --git a/scripts/mir-setup/conf/config-examplesite b/scripts/mir-setup/conf/config-examplesite index 5e023dd1..a69aa108 100755 --- a/scripts/mir-setup/conf/config-examplesite +++ b/scripts/mir-setup/conf/config-examplesite @@ -1,10 +1,18 @@ -# $Id: config-examplesite,v 1.1 2005/06/13 22:23:43 zak Exp $ +# $Id: config-examplesite,v 1.2 2005/09/25 11:59:24 zak Exp $ # Example site configuration file for mir-setup script # Short site name SITE=examplesite +# Database dump (.tar.gz format) to import rather than using default one +# DBDUMP=/path/to/dump.tar.gz + +# Share database from this config file. Note that this is probably a bad +# idea, since articles won't get regenerated properly on all installs. +# However it is how the UK dev server used to work. +# SHAREDB=/path/to/other/install/config.properties + # Full canonical domain name of production site FQDN="publish.$SITE.indymedia.org" diff --git a/scripts/mir-setup/mir-setup b/scripts/mir-setup/mir-setup index 55ad3f3c..69451a15 100755 --- a/scripts/mir-setup/mir-setup +++ b/scripts/mir-setup/mir-setup @@ -1,5 +1,5 @@ #!/bin/bash -# $Id: mir-setup,v 1.1 2005/06/13 22:23:43 zak Exp $ +# $Id: mir-setup,v 1.2 2005/09/25 11:59:24 zak Exp $ # Script to install a new Mir site @@ -96,9 +96,19 @@ fi if [ -n "$MIRVERSION" ]; then MIRVERSIONOPT="-r$MIRVERSION"; fi if [ -n "$SITEVERSION" ]; then SITEVERSIONOPT="-r$SITEVERSION"; fi -if [ -z "$DBNAME" ]; then DBNAME="$SITE"; fi -if [ -z "$DBUSER" ]; then DBUSER="$SITE"; fi -if [ -z "$DBPASS" ]; then DBPASS="`pwgen -s 8 1`"; fi +if [ -n "$SHAREDB" ]; then + if [ -n "$DBNAME" ]; then optdie "$PROG: SHAREDB and DBNAME set"; fi + if [ -n "$DBUSER" ]; then optdie "$PROG: SHAREDB and DBUSER set"; fi + if [ -n "$DBPASS" ]; then optdie "$PROG: SHAREDB and DBPASS set"; fi + + DBNAME="`perl -ne 'if (/\s*Database\.Name\s*=\s*(\S+)/) { print "$1\n" }' /mir/uk/setup_uk/etc/config.properties`" + DBUSER="`perl -ne 'if (/\s*Database\.Username\s*=\s*(\S+)/) { print "$1\n" }' /mir/uk/setup_uk/etc/config.properties`" + DBPASS="`perl -ne 'if (/\s*Database\.Password\s*=\s*(\S+)/) { print "$1\n" }' /mir/uk/setup_uk/etc/config.properties`" +else + if [ -z "$DBNAME" ]; then DBNAME="$SITE"; fi + if [ -z "$DBUSER" ]; then DBUSER="$SITE"; fi + if [ -z "$DBPASS" ]; then DBPASS="`pwgen -s 8 1`"; fi +fi if [ -z "$CONFIGPROPERTIES" ]; then CONFIGPROPERTIES="$CONFDIR/config.properties"; fi if [ ! -e "$CONFIGPROPERTIES" ]; then @@ -210,39 +220,45 @@ if [ -n "$RUNNING" ]; then ln -snf "../$SITEOVERLAYDIR/etc" fi -checkpoint "Create database" -if [ -n "$RUNNING" ]; then - sudo -u postgres createdb --encoding=unicode "$DBNAME" - sudo -u postgres psql "$DBNAME" <&2 "Don't worry about errors from some of the GRANTs here" - sudo -u postgres psql -qto "|psql \"$DBNAME\"" "$DBNAME" <&2 "Don't worry about errors from some of the GRANTs here" + sudo -u postgres psql -qto "|psql \"$DBNAME\"" "$DBNAME" <