2009-06-16 07:13:24 +09:00
|
|
|
#!/bin/bash
|
|
|
|
|
2009-06-24 03:14:51 +09:00
|
|
|
source /etc/laconica/setup.cfg
|
2009-06-16 07:13:24 +09:00
|
|
|
|
|
|
|
export nickname=$1
|
|
|
|
export sitename=$2
|
|
|
|
|
2009-06-24 01:18:10 +09:00
|
|
|
export password=`$PWDGEN`
|
2009-06-16 07:13:24 +09:00
|
|
|
export database=$nickname$DBBASE
|
|
|
|
export username=$nickname$USERBASE
|
|
|
|
|
|
|
|
# Create the db
|
|
|
|
|
2009-06-18 08:30:16 +09:00
|
|
|
mysqladmin -h $DBHOST -u $ADMIN --password=$ADMINPASS create $database
|
2009-06-16 07:13:24 +09:00
|
|
|
|
2009-06-24 01:20:20 +09:00
|
|
|
for f in laconica.sql innodb.sql sms_carrier.sql foreign_services.sql notice_source.sql; do
|
2009-06-18 08:30:16 +09:00
|
|
|
mysql -h $DBHOST -u $ADMIN --password=$ADMINPASS $database < ../db/$f;
|
2009-06-16 07:13:24 +09:00
|
|
|
done
|
|
|
|
|
2009-06-18 08:30:16 +09:00
|
|
|
mysql -h $DBHOST -u $ADMIN --password=$ADMINPASS $SITEDB << ENDOFCOMMANDS
|
2009-06-16 07:13:24 +09:00
|
|
|
|
|
|
|
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)
|
2009-06-24 03:22:54 +09:00
|
|
|
VALUES ('$nickname', '$DBHOSTNAME', '$username', '$password', '$database', '$sitename', now());
|
2009-06-16 07:13:24 +09:00
|
|
|
|
|
|
|
ENDOFCOMMANDS
|
|
|
|
|
2009-06-24 02:43:50 +09:00
|
|
|
for top in $AVATARBASE $FILEBASE $BACKGROUNDBASE; do
|
|
|
|
mkdir $top/$nickname
|
|
|
|
chmod a+w $top/$nickname
|
|
|
|
done
|