From 9ed150fc61abcf5211486c5be982ec8442c33ee1 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 3 Feb 2016 19:12:38 +0000 Subject: [PATCH] Use default username for gnusocial admin --- src/freedombone | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/src/freedombone b/src/freedombone index 89426c47..a292a4fd 100755 --- a/src/freedombone +++ b/src/freedombone @@ -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