Skip to content

Commit

Permalink
stupid fi
Browse files Browse the repository at this point in the history
  • Loading branch information
cryptopool-builders committed Mar 14, 2019
1 parent f69ea49 commit cce5c92
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions db.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,12 @@ apt_install mariadb-server mariadb-client
echo Creating DB users for YiiMP...

if [[ ("$wireguard" == "false") ]]; then

Q1="CREATE DATABASE IF NOT EXISTS yiimpfrontend;"
Q2="GRANT ALL ON yiimpfrontend.* TO 'panel'@'localhost' IDENTIFIED BY '$PanelUserDBPassword';"
Q3="GRANT ALL ON yiimpfrontend.* TO 'stratum'@'localhost' IDENTIFIED BY '$StratumUserDBPassword';"
Q4="FLUSH PRIVILEGES;"
SQL="${Q1}${Q2}${Q3}${Q4}"
sudo mysql -u root -p"${DBRootPassword}" -e "$SQL"

else
Q1="CREATE DATABASE IF NOT EXISTS yiimpfrontend;"
Q2="GRANT ALL ON yiimpfrontend.* TO 'panel'@'${DBInternalIP}' IDENTIFIED BY '$PanelUserDBPassword';"
Expand All @@ -38,7 +36,6 @@ fi
echo Creating my.cnf...

if [[ ("$wireguard" == "false") ]]; then

echo '[clienthost1]
user=panel
password='"${PanelUserDBPassword}"'
Expand All @@ -53,10 +50,8 @@ host=localhost
user=root
password='"${DBRootPassword}"'
' | sudo -E tee $STORAGE_ROOT/yiimp/.my.cnf >/dev/null 2>&1

else

echo '[clienthost1]
echo '[clienthost1]
user=panel
password='"${PanelUserDBPassword}"'
database=yiimpfrontend
Expand All @@ -70,6 +65,7 @@ else
user=root
password='"${DBRootPassword}"'
' | sudo -E tee $STORAGE_ROOT/yiimp/.my.cnf >/dev/null 2>&1
fi

sudo chmod 0600 $STORAGE_ROOT/yiimp/.my.cnf
echo Passwords can be found in $STORAGE_ROOT/yiimp/.my.cnf
Expand Down

0 comments on commit cce5c92

Please sign in to comment.