diff --git a/cleanup-linux.sh b/cleanup-linux.sh new file mode 100755 index 0000000..6edfb81 --- /dev/null +++ b/cleanup-linux.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +sudo mv /var/lib/mysql /var/lib/mysql_old +sudo mv /etc/mysql /etc/mysql_backup +mv ~/.librography ~/.librography_backup +sudo apt remove mariadb +sudo apt remove mariadb-server +sudo apt remove mariadb-client +sudo apt remove openjdk-8-jdk diff --git a/createmysql.sh b/createmysql.sh index be2e8b9..1f19cbf 100755 --- a/createmysql.sh +++ b/createmysql.sh @@ -1,89 +1,124 @@ #!/bin/bash - -# ask type of instalation: 1- server / 2- client +echo "Now we will need update your system and install dependencies, do you want to proceed? " +PS3='Choose a option ' +options=("proceed" "Quit") +select opt in "${options[@]}" +do + case $opt in + "proceed") + ########################## temporario #################### #sudo apt update #sudo apt upgrade -#sudo apt install openjdk-8-jdk # mariadb-server mariadb-client -mkdir ~/.librography +#sudo apt install openjdk-8-jdk -rm ~/.librography/DBUser -touch ~/.librography/DBUser -echo "Entre com o nome para o usuario do banco de dados: " -read dbuser -echo $dbuser >> ~/.librography/DBUser - -rm ~/.librography/DBPass -touch ~/.librography/DBPass -echo "Entre com a senha para o usuario do banco de dados: " -read dbpass -echo $dbpass >> ~/.librography/DBPass - -rm ~/.librography/ipserver -touch ~/.librography/ipserver - -touch ~/.Librography/DefaultPrinter - -PS3='What is the current configuration for this machine? ' -options=("server" "client" "Quit") -select opt in "${options[@]}" -do - case $opt in - "server") - echo "proceed to install server" - sudo apt install mariadb-server - echo "now we will proceed with the secure instalaltion and configuration of the database" - echo "you can answer in order: n - y - y - y - y." - read -p "Press enter to continue" - sudo mysql_secure_installation - echo localhost >> ~/.librography/ipserver + echo "What is the current configuration for this machine?" + PS3='Choose a option ' + options=("server" "client" "Quit") + select opt in "${options[@]}" + do + case $opt in + "server") + echo "proceed to install server" - sudo mysql <> ~/.librography/DBUSER + + rm ~/.librography/DBPASS + touch ~/.librography/DBPASS + echo "Entre com a senha para o usuario do banco de dados: " + read DBPASS + echo $DBPASS >> ~/.librography/DBPASS + + sudo mysql <> ~/.librography/IPSERVER - echo "MySQL user created." - echo "Username: $dbuser" - echo "Password: $dbpass" + echo "-------- Installation finished! ------------" + echo " DataBase Url/ip: $IPSERVER" + echo " DataBase Username : $DBUSER" + echo " DataBase Password : $DBPASS" + + break + ;; + "client") + echo "proceed to install a cliente" + sudo apt install mariadb-client + mkdir ~/.librography + rm ~/.librography/IPSERVER + touch ~/.librography/IPSERVER + touch ~/.librography/DefaultPrinter + echo "Enter the database server ip: " + read IPSERVER + echo $IPSERVER >> ~/.librography/IPSERVER - break - ;; - "client") - echo "proceed to install a cliente" - sudo apt install mariadb-client - - echo "Entre com o ip do servidor com o banco de dados: " - read ipserver - echo $ipserver >> ~/.librography/ipserver - - break - ;; - "Quit") - break - ;; - *) echo "invalid option $REPLY";; + rm ~/.librography/DBUSER + touch ~/.librography/DBUSER + DBUSER=gowl + echo $DBUSER >> ~/.librography/DBUSER + + rm ~/.librography/DBPASS + touch ~/.librography/DBPASS + echo "Entre com a senha do usuario do banco de dados: " + read DBPASS + echo $DBPASS >> ~/.librography/DBPASS + + echo "-------- Installation finished! ------------" + echo " DataBase Url/ip: $IPSERVER" + echo " DataBase Username : $DBUSER" + echo " DataBase Password : $DBPASS" + + break + ;; + "Quit") + break + ;; + *) echo "invalid option $REPLY";; + esac + done + + break + ;; + "Quit") + break + ;; + *) echo "invalid option $REPLY";; esac done - - -# is the mysql already configured? -# proceed with secure install: - -#echo "Enter the user name for database: " -#read password -#echo "The Current User Name is $first_name" -#echo -#echo "Enter other users'names: " -#read name1 name2 name3 -#$echo "$name1, $name2, $name3 are the other users." - -#PASS=`pwgen -s 40 1` -#PASS= dbpass - +# create shortcut on desktop diff --git a/scriptMySqlWorkB.sql b/script.sql similarity index 100% rename from scriptMySqlWorkB.sql rename to script.sql