diff options
author | Evan Prodromou <evan@controlyourself.ca> | 2009-06-15 15:13:24 -0700 |
---|---|---|
committer | Evan Prodromou <evan@controlyourself.ca> | 2009-06-15 15:13:24 -0700 |
commit | 01c03223c2c559deec0191dd7a100e152981e1e2 (patch) | |
tree | 9897cd77199b291f06dd28bf690e6e030de7d2f2 | |
parent | 6532f0dff63576c94debe521d1ff8d9f594fe422 (diff) |
Script to set up new status networks
-rw-r--r-- | scripts/setup.cfg.sample | 11 | ||||
-rw-r--r-- | scripts/setup_status_network.sh | 30 |
2 files changed, 41 insertions, 0 deletions
diff --git a/scripts/setup.cfg.sample b/scripts/setup.cfg.sample new file mode 100644 index 000000000..4194bc146 --- /dev/null +++ b/scripts/setup.cfg.sample @@ -0,0 +1,11 @@ +# CONFIGURATION FILE for setup_status_network.sh + +# Base database name; full name will include nickname + +export DBBASE=_example_net +export USERBASE=_example_net +export ADMIN=root +export ADMINPASS=yourpassword +export SITEDB=example_net_site +export AVATARBASE=/var/www/avatar.example.net + diff --git a/scripts/setup_status_network.sh b/scripts/setup_status_network.sh new file mode 100644 index 000000000..d80612b94 --- /dev/null +++ b/scripts/setup_status_network.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +source ./setup.cfg + +export nickname=$1 +export sitename=$2 + +export password=`pwgen 20` +export database=$nickname$DBBASE +export username=$nickname$USERBASE + +# Create the db + +mysqladmin -u $ADMIN --password=$ADMINPASS create $database + +for f in laconica.sql sms_carrier.sql foreign_services.sql notice_source.sql; do + mysql -u $ADMIN --password=$ADMINPASS $database < ../db/$f; +done + +mysql -u $ADMIN --password=$ADMINPASS $SITEDB << ENDOFCOMMANDS + +GRANT INSERT,SELECT,UPDATE,DELETE ON $database.* TO '$username'@'localhost' IDENTIFIED BY '$password'; +GRANT INSERT,SELECT,UPDATE,DELETE ON $database.* TO '$username'@'%' IDENTIFIED BY '$password'; +INSERT INTO status_network (nickname, dbhost, dbuser, dbpass, dbname, sitename, created) +VALUES ('$nickname', '$DBHOST', '$username', '$password', '$database', '$sitename', now()); + +ENDOFCOMMANDS + +mkdir $AVATARBASE/$nickname +chmod a+w $AVATARBASE/$nickname |