Create database function
This commit is contained in:
parent
b30bf6b03d
commit
f6f611a093
|
@ -525,6 +525,21 @@ function show_help {
|
|||
exit 0
|
||||
}
|
||||
|
||||
function create_database {
|
||||
app_name="$1"
|
||||
app_admin_password="$2"
|
||||
if [ ! -d $INSTALL_DIR ]; then
|
||||
mkdir $INSTALL_DIR
|
||||
fi
|
||||
echo "create database ${app_name};
|
||||
CREATE USER '${app_name}admin'@'localhost' IDENTIFIED BY '${app_admin_password}';
|
||||
GRANT ALL PRIVILEGES ON ${app_name}.* TO '${app_name}admin'@'localhost';
|
||||
quit" > $INSTALL_DIR/batch.sql
|
||||
chmod 600 $INSTALL_DIR/batch.sql
|
||||
mysql -u root --password="$MARIADB_PASSWORD" < $INSTALL_DIR/batch.sql
|
||||
shred -zu $INSTALL_DIR/batch.sql
|
||||
}
|
||||
|
||||
function locale_setup {
|
||||
if grep -Fxq "locale_setup" $COMPLETION_FILE; then
|
||||
return
|
||||
|
@ -6197,13 +6212,7 @@ function install_owncloud {
|
|||
chmod 600 /home/$MY_USERNAME/README
|
||||
fi
|
||||
|
||||
echo "create database owncloud;
|
||||
CREATE USER 'owncloudadmin'@'localhost' IDENTIFIED BY '$OWNCLOUD_ADMIN_PASSWORD';
|
||||
GRANT ALL PRIVILEGES ON owncloud.* TO 'owncloudadmin'@'localhost';
|
||||
quit" > $INSTALL_DIR/batch.sql
|
||||
chmod 600 $INSTALL_DIR/batch.sql
|
||||
mysql -u root --password="$MARIADB_PASSWORD" < $INSTALL_DIR/batch.sql
|
||||
shred -zu $INSTALL_DIR/batch.sql
|
||||
create_database owncloud "$OWNCLOUD_ADMIN_PASSWORD"
|
||||
|
||||
if [ ! -d /var/www/$OWNCLOUD_DOMAIN_NAME ]; then
|
||||
mkdir /var/www/$OWNCLOUD_DOMAIN_NAME
|
||||
|
@ -6604,13 +6613,7 @@ function install_gogs {
|
|||
chmod 600 /home/$MY_USERNAME/README
|
||||
fi
|
||||
|
||||
echo "create database gogs;
|
||||
CREATE USER 'gogsadmin'@'localhost' IDENTIFIED BY '$GOGS_ADMIN_PASSWORD';
|
||||
GRANT ALL PRIVILEGES ON gogs.* TO 'gogsadmin'@'localhost';
|
||||
quit" > $INSTALL_DIR/batch.sql
|
||||
chmod 600 $INSTALL_DIR/batch.sql
|
||||
mysql -u root --password="$MARIADB_PASSWORD" < $INSTALL_DIR/batch.sql
|
||||
shred -zu $INSTALL_DIR/batch.sql
|
||||
create_database gogs "$GOGS_ADMIN_PASSWORD"
|
||||
|
||||
chmod 600 /home/git/go/src/github.com/gogits/gogs/custom/conf/app.ini
|
||||
|
||||
|
@ -8187,13 +8190,7 @@ function install_gnu_social {
|
|||
chmod 600 /home/$MY_USERNAME/README
|
||||
fi
|
||||
|
||||
echo "create database gnusocial;
|
||||
CREATE USER 'gnusocialadmin'@'localhost' IDENTIFIED BY '$MICROBLOG_ADMIN_PASSWORD';
|
||||
GRANT ALL PRIVILEGES ON gnusocial.* TO 'gnusocialadmin'@'localhost';
|
||||
quit" > $INSTALL_DIR/batch.sql
|
||||
chmod 600 $INSTALL_DIR/batch.sql
|
||||
mysql -u root --password="$MARIADB_PASSWORD" < $INSTALL_DIR/batch.sql
|
||||
shred -zu $INSTALL_DIR/batch.sql
|
||||
create_database gnusocial "$MICROBLOG_ADMIN_PASSWORD"
|
||||
|
||||
if [ ! -f "/etc/aliases" ]; then
|
||||
touch /etc/aliases
|
||||
|
@ -8585,13 +8582,7 @@ function install_hubzilla {
|
|||
chmod 600 /home/$MY_USERNAME/README
|
||||
fi
|
||||
|
||||
echo "create database hubzilla;
|
||||
CREATE USER 'hubzillaadmin'@'localhost' IDENTIFIED BY '$HUBZILLA_ADMIN_PASSWORD';
|
||||
GRANT ALL PRIVILEGES ON hubzilla.* TO 'hubzillaadmin'@'localhost';
|
||||
quit" > $INSTALL_DIR/batch.sql
|
||||
chmod 600 $INSTALL_DIR/batch.sql
|
||||
mysql -u root --password="$MARIADB_PASSWORD" < $INSTALL_DIR/batch.sql
|
||||
shred -zu $INSTALL_DIR/batch.sql
|
||||
create_database hubzilla "$HUBZILLA_ADMIN_PASSWORD"
|
||||
|
||||
if ! grep -q "/var/www/$HUBZILLA_DOMAIN_NAME/htdocs" /etc/crontab; then
|
||||
echo "12,22,32,42,52 * * * * root cd /var/www/$HUBZILLA_DOMAIN_NAME/htdocs; /usr/bin/timeout 500 /usr/bin/php include/poller.php" >> /etc/crontab
|
||||
|
|
Loading…
Reference in New Issue