gnu-social/scripts/setup_status_network.sh

33 lines
981 B
Bash
Raw Normal View History

2009-06-15 23:13:24 +01:00
#!/bin/bash
source /etc/statusnet/setup.cfg
2009-06-15 23:13:24 +01:00
export nickname=$1
export sitename=$2
2009-06-23 17:18:10 +01:00
export password=`$PWDGEN`
2009-06-15 23:13:24 +01:00
export database=$nickname$DBBASE
export username=$nickname$USERBASE
# Create the db
mysqladmin -h $DBHOST -u $ADMIN --password=$ADMINPASS create $database
2009-06-15 23:13:24 +01:00
for f in statusnet.sql innodb.sql sms_carrier.sql foreign_services.sql notice_source.sql; do
mysql -h $DBHOST -u $ADMIN --password=$ADMINPASS $database < ../db/$f;
2009-06-15 23:13:24 +01:00
done
mysql -h $DBHOST -u $ADMIN --password=$ADMINPASS $SITEDB << ENDOFCOMMANDS
2009-06-15 23:13:24 +01:00
GRANT ALL ON $database.* TO '$username'@'localhost' IDENTIFIED BY '$password';
GRANT ALL ON $database.* TO '$username'@'%' IDENTIFIED BY '$password';
2009-06-15 23:13:24 +01:00
INSERT INTO status_network (nickname, dbhost, dbuser, dbpass, dbname, sitename, created)
VALUES ('$nickname', '$DBHOSTNAME', '$username', '$password', '$database', '$sitename', now());
2009-06-15 23:13:24 +01:00
ENDOFCOMMANDS
2009-06-23 18:43:50 +01:00
for top in $AVATARBASE $FILEBASE $BACKGROUNDBASE; do
mkdir $top/$nickname
chmod a+w $top/$nickname
done