Use default username for gnusocial admin

This commit is contained in:
Bob Mottram 2016-02-03 19:12:38 +00:00
parent 29e84c08f5
commit 9ed150fc61
1 changed files with 10 additions and 17 deletions

View File

@ -591,12 +591,16 @@ function git_pull {
function create_database {
app_name="$1"
app_admin_password="$2"
app_admin_username=$3
if [ ! -d $INSTALL_DIR ]; then
mkdir $INSTALL_DIR
fi
if [ ! $app_admin_username ]; then
app_admin_username=${app_name}admin
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';
CREATE USER '$app_admin_username@localhost' IDENTIFIED BY '${app_admin_password}';
GRANT ALL PRIVILEGES ON ${app_name}.* TO '$app_admin_username@localhost';
quit" > $INSTALL_DIR/batch.sql
chmod 600 $INSTALL_DIR/batch.sql
mysql -u root --password="$MARIADB_PASSWORD" < $INSTALL_DIR/batch.sql
@ -8310,17 +8314,9 @@ function install_gnu_social {
else
MICROBLOG_ADMIN_PASSWORD="$(openssl rand -base64 32)"
fi
echo '' >> /home/$MY_USERNAME/README
echo '' >> /home/$MY_USERNAME/README
echo $'GNU Social' >> /home/$MY_USERNAME/README
echo '==========' >> /home/$MY_USERNAME/README
echo $"Your MariaDB gnusocial admin password is: $MICROBLOG_ADMIN_PASSWORD" >> /home/$MY_USERNAME/README
echo '' >> /home/$MY_USERNAME/README
chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/README
chmod 600 /home/$MY_USERNAME/README
fi
create_database gnusocial "$MICROBLOG_ADMIN_PASSWORD"
create_database gnusocial "$MICROBLOG_ADMIN_PASSWORD" $MY_USERNAME
if [ ! -f "/etc/aliases" ]; then
touch /etc/aliases
@ -8535,7 +8531,7 @@ function install_gnu_social {
--dbtype=mysql --username="root" -v \
--password="$MARIADB_PASSWORD" \
--sitename="My Social Network" --fancy='yes' \
--admin-nick="gnusocialadmin" \
--admin-nick="$MY_USERNAME" \
--admin-pass="$MICROBLOG_ADMIN_PASSWORD" \
--site-profile="community" \
--ssl=${gnu_social_ssl}
@ -8559,17 +8555,14 @@ function install_gnu_social {
echo "GNU Social onion domain:${MICROBLOG_ONION_HOSTNAME}" >> $COMPLETION_FILE
# some post-install instructions for the user
if ! grep -q $"To set up your microblog go to" /home/$MY_USERNAME/README; then
if ! grep -q $"Microblog administrator" /home/$MY_USERNAME/README; then
echo '' >> /home/$MY_USERNAME/README
echo '' >> /home/$MY_USERNAME/README
echo $'Microblog' >> /home/$MY_USERNAME/README
echo '=========' >> /home/$MY_USERNAME/README
echo $"Microblog administrator nickname: gnusocialadmin" >> /home/$MY_USERNAME/README
echo $"Microblog administrator nickname: $MY_USERNAME" >> /home/$MY_USERNAME/README
echo $"Microblog administrator password: $MICROBLOG_ADMIN_PASSWORD" >> /home/$MY_USERNAME/README
echo '' >> /home/$MY_USERNAME/README
echo $'Under the *Access* settings:' >> /home/$MY_USERNAME/README
echo ' /Invite only/ ticked' >> /home/$MY_USERNAME/README
echo '' >> /home/$MY_USERNAME/README
chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/README
chmod 600 /home/$MY_USERNAME/README
fi