From cc61df0bbd792f310c41ceffe6cf7c3f5fe8b406 Mon Sep 17 00:00:00 2001 From: AndreyEremin02 Date: Thu, 14 Apr 2022 13:06:06 +0300 Subject: [PATCH 1/5] Added scripts for quick installation of basic programs --- Makefile | 42 ++++++++++++++++++++ README.md | 1 - main.sh | 83 +++++++++++++++++++++++++++++++++++++++ scripts/docker-compose.sh | 17 ++++++++ scripts/docker.sh | 31 +++++++++++++++ scripts/mysql-5.7.sh | 62 +++++++++++++++++++++++++++++ scripts/mysql-8.0.sh | 32 +++++++++++++++ scripts/nvm.sh | 25 ++++++++++++ scripts/postgresql-12.sh | 37 +++++++++++++++++ scripts/postgresql-14.sh | 36 +++++++++++++++++ scripts/rbenv.sh | 29 ++++++++++++++ scripts/rvm.sh | 26 ++++++++++++ 12 files changed, 420 insertions(+), 1 deletion(-) create mode 100644 Makefile delete mode 100644 README.md create mode 100644 main.sh create mode 100644 scripts/docker-compose.sh create mode 100644 scripts/docker.sh create mode 100644 scripts/mysql-5.7.sh create mode 100644 scripts/mysql-8.0.sh create mode 100644 scripts/nvm.sh create mode 100644 scripts/postgresql-12.sh create mode 100644 scripts/postgresql-14.sh create mode 100644 scripts/rbenv.sh create mode 100644 scripts/rvm.sh diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..843a733 --- /dev/null +++ b/Makefile @@ -0,0 +1,42 @@ +.PHONY: docker docker-compose rvm rbenv nvm postgresql-12 postgresql-14 mysql-5.7 mysql-8.0 +.DEFAULT_GOAL := no-choice + +docker: + @echo 'Installing Docker' + sudo bash ./scripts/docker.sh + +docker-compose: + @echo 'Installing Docker-compose' + sudo bash ./scripts/docker-compose.sh + +rvm: + @echo 'Installing RVM' + sudo bash ./scripts/rvm.sh + +rbenv: + @echo 'Installing RBENV' + sudo bash ./scripts/rbenv.sh + +nvm: + @echo 'Installing NVM' + sudo bash ./scripts/nvm.sh + +postgresql-12: + @echo 'Installing Postgresql 12' + sudo bash ./scripts/postgresql-12.sh + +postgresql-14: + @echo 'Installing Postgresql 14' + sudo bash ./scripts/postgresql-14.sh + +mysql-5.7: + @echo 'Installing Mysql 5.7' + sudo bash ./scripts/mysql-5.7.sh + +mysql-8.0: + @echo 'Installing Mysql 8.0' + sudo bash ./scripts/mysql-8.0.sh + +no-choice: + @echo 'Необходимо указать хотя бы один из предложенных параметров:' + @echo 'docker docker-compose rvm rbenv nvm postgresql-12 postgresql-14 mysql-5.7 mysql-8.0' \ No newline at end of file diff --git a/README.md b/README.md deleted file mode 100644 index 8199e55..0000000 --- a/README.md +++ /dev/null @@ -1 +0,0 @@ -# scripts \ No newline at end of file diff --git a/main.sh b/main.sh new file mode 100644 index 0000000..23e4c55 --- /dev/null +++ b/main.sh @@ -0,0 +1,83 @@ +#!/bin/bash + +if [ "${EUID}" -ne 0 ] +then + echo "Вы должны запустить этот скрипт через sudo или от имени root." + exit 1 +fi + +clear +PS3='Выберите необходимую программу: ' + +select Programm in "Docker" "Docker-compose" "RVM" "RBENV" "NVM" "Postgresql" "Mysql" +do + break +done + +case $Programm in + "Docker") + echo "Installing $Programm" + sudo bash ./scripts/docker.sh + ;; + "Docker-compose") + echo "Installing $Programm" + sudo bash ./scripts/docker-compose.sh + ;; + "RVM") + echo "Installing $Programm" + sudo bash ./scripts/rvm.sh + ;; + "RBENV") + echo "Installing $Programm" + sudo bash ./scripts/rbenv.sh + ;; + "NVM") + echo "Installing $Programm" + sudo bash ./scripts/nvm.sh + ;; + "Postgresql") + clear + PS3='Выберите необходимую версию Postgresql: ' + select Version in "12" "14" + do + break + done + case $Version in + "12") + echo "Installing $Programm $Version" + sudo bash ./scripts/postgresql-12.sh + ;; + "14") + echo "Installing $Programm $Version" + sudo bash ./scripts/postgresql-14.sh + ;; + *) + echo "Вы указали неверное значение." + ;; + esac + ;; + "Mysql") + clear + PS3='Выберите необходимую версию Mysql: ' + select Version in "5.7" "8.0" + do + break + done + case $Version in + "5.7") + echo "Installing $Programm $Version" + sudo bash ./scripts/mysql-5.7.sh + ;; + "8.0") + echo "Installing $Programm $Version" + sudo bash ./scripts/mysql-8.0.sh + ;; + *) + echo "Вы указали неверное значение." + ;; + esac + ;; + *) + echo "Вы указали неверное значение." + ;; +esac \ No newline at end of file diff --git a/scripts/docker-compose.sh b/scripts/docker-compose.sh new file mode 100644 index 0000000..37c1ee7 --- /dev/null +++ b/scripts/docker-compose.sh @@ -0,0 +1,17 @@ +#!/bin/bash +declare -a arr=("ubuntu" "cpe:/o:centos:centos:7" "cpe:/o:centos:centos:8") + +for i in ${arr[@]}; +do +if grep -q "$i" cat /etc/*release > /dev/null 2>&1 +then + os=$i +break +fi +done + +if [ "$os" == "ubuntu" ] || [ "$os" == "cpe:/o:centos:centos:7" ] || [ "$os" == "cpe:/o:centos:centos:8" ]; +then + sudo curl -L "https://github.com/docker/compose/releases/download/v2.4.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose + sudo chmod +x /usr/local/bin/docker-compose +fi \ No newline at end of file diff --git a/scripts/docker.sh b/scripts/docker.sh new file mode 100644 index 0000000..624eacc --- /dev/null +++ b/scripts/docker.sh @@ -0,0 +1,31 @@ +#!/bin/bash +declare -a arr=("ubuntu" "cpe:/o:centos:centos:7" "cpe:/o:centos:centos:8") + +for i in ${arr[@]}; +do +if grep -q "$i" cat /etc/*release > /dev/null 2>&1 +then + os=$i +break +fi +done + +if [ "$os" == "ubuntu" ]; +then + sudo apt update && sudo apt install -y apt-transport-https ca-certificates curl gnupg-agent + curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - + sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" + sudo apt update && sudo apt install -y docker-ce docker-ce-cli containerd.io + sudo usermod -aG docker ${USER} + sudo chmod 666 /var/run/docker.sock + sudo systemctl start docker && sudo systemctl enable docker +fi + +if [ "$os" == "cpe:/o:centos:centos:7" ] || [ "$os" == "cpe:/o:centos:centos:8" ]; +then + sudo yum install -y curl + curl -fsSL https://get.docker.com/ | sh + sudo usermod -aG docker $(whoami) + sudo systemctl start docker && sudo systemctl enable docker + sudo chmod 666 /var/run/docker.sock +fi \ No newline at end of file diff --git a/scripts/mysql-5.7.sh b/scripts/mysql-5.7.sh new file mode 100644 index 0000000..0b946b2 --- /dev/null +++ b/scripts/mysql-5.7.sh @@ -0,0 +1,62 @@ +#!/bin/bash + +declare -a arr=("cpe:/o:centos:centos:7" "ubuntu" "cpe:/o:centos:centos:8") + +for i in ${arr[@]}; +do +if grep -q "$i" /etc/*release > /dev/null 2>&1 +then + os=$i +break +fi +done +if [ "$os" == "ubuntu" ]; +then + sudo apt update && sudo apt install -y software-properties-common ca-certificates + sudo sh -c 'echo "deb http://repo.mysql.com/apt/ubuntu/ bionic mysql-apt-config + deb http://repo.mysql.com/apt/ubuntu/ bionic mysql-5.7 + deb http://repo.mysql.com/apt/ubuntu/ bionic mysql-tools + #deb http://repo.mysql.com/apt/ubuntu/ bionic mysql-tools-preview + deb-src http://repo.mysql.com/apt/ubuntu/ bionic mysql-5.7" > /etc/apt/sources.list.d/mysql.list' + sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 467B942D3A79BD29 + sudo apt update + sudo apt install -y -f mysql-client=5.7* mysql-community-server=5.7* mysql-server=5.7* +fi + +if [ "$os" == "cpe:/o:centos:centos:7" ]; +then + sudo yum install -y curl + curl -sSLO https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm + sudo rpm -ivh mysql57-community-release-el7-11.noarch.rpm + sudo rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022 + sudo yum install -y mysql-server + sudo systemctl start mysqld && sudo systemctl enable mysqld + sudo grep 'temporary password' /var/log/mysqld.log +fi + +if [ "$os" == "cpe:/o:centos:centos:8" ]; +then + sudo touch /etc/yum.repos.d/mysql-community.repo + sudo sh -c 'echo "[mysql-connectors-community] + name=MySQL Connectors Community + baseurl=http://repo.mysql.com/yum/mysql-connectors-community/el/7/\$basearch/ + enabled=1 + gpgcheck=0 + + [mysql-tools-community] + name=MySQL Tools Community + baseurl=http://repo.mysql.com/yum/mysql-tools-community/el/7/\$basearch/ + enabled=1 + gpgcheck=0 + + [mysql57-community] + name=MySQL 5.7 Community Server + baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/7/\$basearch/ + enabled=1 + gpgcheck=0" > /etc/yum.repos.d/mysql-community.repo' + sudo dnf module disable -y mysql + sudo dnf config-manager --enable mysql57-community + sudo yum install -y mysql-server + sudo systemctl start mysqld && sudo systemctl enable mysqld + sudo grep 'temporary password' /var/log/mysqld.log +fi diff --git a/scripts/mysql-8.0.sh b/scripts/mysql-8.0.sh new file mode 100644 index 0000000..404a9bb --- /dev/null +++ b/scripts/mysql-8.0.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +declare -a arr=("cpe:/o:centos:centos:7" "ubuntu" "cpe:/o:centos:centos:8") + +for i in ${arr[@]}; +do +if grep -q "$i" /etc/*release > /dev/null 2>&1 +then + os=$i +break +fi +done +if [ "$os" == "ubuntu" ]; +then + sudo apt update -y && sudo apt install mysql-server mysql-client +fi + +if [ "$os" == "cpe:/o:centos:centos:7" ]; +then + sudo yum install -y curl + curl -sSLO https://dev.mysql.com/get/mysql80-community-release-el7-5.noarch.rpm + sudo rpm -ivh mysql80-community-release-el7-5.noarch.rpm + sudo yum install -y mysql-server + sudo systemctl start mysqld && sudo systemctl enable mysqld + sudo grep 'temporary password' /var/log/mysqld.log +fi + +if [ "$os" == "cpe:/o:centos:centos:8" ]; +then + sudo dnf install -y mysql-server + sudo systemctl start mysqld && sudo systemctl enable mysqld +fi diff --git a/scripts/nvm.sh b/scripts/nvm.sh new file mode 100644 index 0000000..d7a8fc6 --- /dev/null +++ b/scripts/nvm.sh @@ -0,0 +1,25 @@ +#!/bin/bash +declare -a arr=("ubuntu" "cpe:/o:centos:centos:7" "cpe:/o:centos:centos:8") + +for i in ${arr[@]}; +do +if grep -q "$i" cat /etc/*release > /dev/null 2>&1 +then + os=$i +break +fi +done + +if [ "$os" == "ubuntu" ]; +then + sudo apt update -y && sudo apt install -y apt-transport-https ca-certificates curl gnupg-agent software-properties-common + curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash + exec bash +fi + +if [ "$os" == "cpe:/o:centos:centos:7" ] || [ "$os" == "cpe:/o:centos:centos:8" ]; +then + sudo yum install -y curl + curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash + exec bash +fi \ No newline at end of file diff --git a/scripts/postgresql-12.sh b/scripts/postgresql-12.sh new file mode 100644 index 0000000..65f93eb --- /dev/null +++ b/scripts/postgresql-12.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +declare -a arr=("cpe:/o:centos:centos:7" "ubuntu" "cpe:/o:centos:centos:8") + +for i in ${arr[@]}; +do +if grep -q "$i" /etc/*release > /dev/null 2>&1 +then + os=$i +break +fi +done +if [ "$os" == "ubuntu" ]; +then + sudo apt update -y && sudo apt install -y apt-transport-https ca-certificates wget gnupg-agent software-properties-common + sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' + wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - + sudo apt update -y + sudo apt install -y postgresql-12 +fi + +if [ "$os" == "cpe:/o:centos:centos:7" ]; +then + sudo yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm + sudo yum install -y postgresql12-server + sudo /usr/pgsql-12/bin/postgresql-12-setup initdb + sudo systemctl start postgresql-12 && sudo systemctl enable postgresql-12 +fi + +if [ "$os" == "cpe:/o:centos:centos:8" ]; +then + sudo dnf install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm + sudo dnf -qy module disable postgresql + sudo dnf install -y postgresql12-server + sudo /usr/pgsql-12/bin/postgresql-12-setup initdb + sudo systemctl enable postgresql-12 && sudo systemctl start postgresql-12 +fi diff --git a/scripts/postgresql-14.sh b/scripts/postgresql-14.sh new file mode 100644 index 0000000..cbbd0ac --- /dev/null +++ b/scripts/postgresql-14.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +declare -a arr=("cpe:/o:centos:centos:7" "ubuntu" "cpe:/o:centos:centos:8") + +for i in ${arr[@]}; +do +if grep -q "$i" /etc/*release > /dev/null 2>&1 +then + os=$i +break +fi +done +if [ "$os" == "ubuntu" ]; +then + sudo apt update -y && sudo apt install -y apt-transport-https ca-certificates wget gnupg-agent software-properties-common + sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' + wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - + sudo apt update -y +fi + +if [ "$os" == "cpe:/o:centos:centos:7" ]; +then + sudo yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm + sudo yum install -y postgresql14-server + sudo /usr/pgsql-14/bin/postgresql-14-setup initdb + sudo systemctl start postgresql-14 && sudo systemctl enable postgresql-14 +fi + +if [ "$os" == "cpe:/o:centos:centos:8" ]; +then + sudo dnf install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm + sudo dnf -qy module disable postgresql + sudo dnf install -y postgresql14-server + sudo /usr/pgsql-14/bin/postgresql-14-setup initdb + sudo systemctl enable postgresql-14 && sudo systemctl start postgresql-14 +fi diff --git a/scripts/rbenv.sh b/scripts/rbenv.sh new file mode 100644 index 0000000..5cd3c80 --- /dev/null +++ b/scripts/rbenv.sh @@ -0,0 +1,29 @@ +#!/bin/bash +declare -a arr=("ubuntu" "cpe:/o:centos:centos:7" "cpe:/o:centos:centos:8") + +for i in ${arr[@]}; +do +if grep -q "$i" cat /etc/*release > /dev/null 2>&1 +then + os=$i +break +fi +done + +if [ "$os" == "ubuntu" ]; +then + sudo apt update -y && sudo apt install -y apt-transport-https ca-certificates git curl gnupg-agent software-properties-common libssl-dev libreadline-dev zlib1g-dev autoconf bison build-essential libyaml-dev libreadline-dev libncurses5-dev libffi-dev libgdbm-dev + curl -fsSL https://github.com/rbenv/rbenv-installer/raw/HEAD/bin/rbenv-installer | bash + echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc + echo 'eval "$(rbenv init -)"' >> ~/.bashrc + exec bash +fi + +if [ "$os" == "cpe:/o:centos:centos:7" ] || [ "$os" == "cpe:/o:centos:centos:8" ]; +then + sudo yum install -y git-core curl + curl -fsSL https://github.com/rbenv/rbenv-installer/raw/HEAD/bin/rbenv-installer | bash + echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc + echo 'eval "$(rbenv init -)"' >> ~/.bashrc + exec bash +fi \ No newline at end of file diff --git a/scripts/rvm.sh b/scripts/rvm.sh new file mode 100644 index 0000000..233e383 --- /dev/null +++ b/scripts/rvm.sh @@ -0,0 +1,26 @@ +#!/bin/bash +declare -a arr=("ubuntu" "cpe:/o:centos:centos:7" "cpe:/o:centos:centos:8") + +for i in ${arr[@]}; +do +if grep -q "$i" cat /etc/*release > /dev/null 2>&1 +then + os=$i +break +fi +done + +if [ "$os" == "ubuntu" ]; +then + sudo apt update -y && sudo apt install -y apt-transport-https ca-certificates curl gnupg-agent software-properties-common + gpg --keyserver hkp://keyserver.ubuntu.com --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB + curl -sSL https://get.rvm.io | bash -s + exec bash +fi + +if [ "$os" == "cpe:/o:centos:centos:7" ] || [ "$os" == "cpe:/o:centos:centos:8" ]; +then + sudo yum install -y curl tar + curl -L get.rvm.io | bash -s + exec bash +fi \ No newline at end of file From b09062d101714885d974568c3cfa84e214d1ecb4 Mon Sep 17 00:00:00 2001 From: AndreyEremin02 Date: Wed, 20 Apr 2022 11:48:20 +0300 Subject: [PATCH 2/5] Returned the lost string --- scripts/postgresql-14.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/postgresql-14.sh b/scripts/postgresql-14.sh index cbbd0ac..cffeee3 100644 --- a/scripts/postgresql-14.sh +++ b/scripts/postgresql-14.sh @@ -16,6 +16,7 @@ then sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - sudo apt update -y + sudo apt install -y postgresql-14 fi if [ "$os" == "cpe:/o:centos:centos:7" ]; From 8ab6b35be60d9803ef11d3f002f6cc42585c63ad Mon Sep 17 00:00:00 2001 From: AndreyEremin02 Date: Thu, 21 Apr 2022 12:34:13 +0300 Subject: [PATCH 3/5] Small fixes --- Makefile | 6 +++--- main.sh | 12 +++--------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index 843a733..015dd48 100644 --- a/Makefile +++ b/Makefile @@ -11,15 +11,15 @@ docker-compose: rvm: @echo 'Installing RVM' - sudo bash ./scripts/rvm.sh + bash ./scripts/rvm.sh rbenv: @echo 'Installing RBENV' - sudo bash ./scripts/rbenv.sh + bash ./scripts/rbenv.sh nvm: @echo 'Installing NVM' - sudo bash ./scripts/nvm.sh + bash ./scripts/nvm.sh postgresql-12: @echo 'Installing Postgresql 12' diff --git a/main.sh b/main.sh index 23e4c55..b784419 100644 --- a/main.sh +++ b/main.sh @@ -1,11 +1,5 @@ #!/bin/bash -if [ "${EUID}" -ne 0 ] -then - echo "Вы должны запустить этот скрипт через sudo или от имени root." - exit 1 -fi - clear PS3='Выберите необходимую программу: ' @@ -25,15 +19,15 @@ case $Programm in ;; "RVM") echo "Installing $Programm" - sudo bash ./scripts/rvm.sh + bash ./scripts/rvm.sh ;; "RBENV") echo "Installing $Programm" - sudo bash ./scripts/rbenv.sh + bash ./scripts/rbenv.sh ;; "NVM") echo "Installing $Programm" - sudo bash ./scripts/nvm.sh + bash ./scripts/nvm.sh ;; "Postgresql") clear From 3bb07633abebdd4bfc857914ae1fae1eeec5b4d8 Mon Sep 17 00:00:00 2001 From: AndreyEremin02 Date: Fri, 22 Apr 2022 16:37:53 +0300 Subject: [PATCH 4/5] Separated docker-install for centos7 and centos8 --- scripts/docker.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/scripts/docker.sh b/scripts/docker.sh index 624eacc..7a8ef1f 100644 --- a/scripts/docker.sh +++ b/scripts/docker.sh @@ -21,11 +21,21 @@ then sudo systemctl start docker && sudo systemctl enable docker fi -if [ "$os" == "cpe:/o:centos:centos:7" ] || [ "$os" == "cpe:/o:centos:centos:8" ]; +if [ "$os" == "cpe:/o:centos:centos:7" ]; then sudo yum install -y curl curl -fsSL https://get.docker.com/ | sh sudo usermod -aG docker $(whoami) sudo systemctl start docker && sudo systemctl enable docker sudo chmod 666 /var/run/docker.sock +fi + +if [ "$os" == "cpe:/o:centos:centos:8" ]; +then + yum -y install yum-utils gcc gcc-c++ + yum-config-manager \ + --add-repo \ + https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo + yum -y install docker-ce docker-ce-cli containerd.io --allowerasing + sudo systemctl start docker && sudo systemctl enable docker fi \ No newline at end of file From b7c9121012d3cc5bc3fb0f6b01ac729a761fa4f4 Mon Sep 17 00:00:00 2001 From: AndreyEremin02 Date: Wed, 11 May 2022 14:15:20 +0300 Subject: [PATCH 5/5] Added select multiple programs --- Makefile | 2 +- main.sh | 117 ++++++++++++++++++++++++++++++++++++++++++++++- scripts/nvm.sh | 2 - scripts/rbenv.sh | 2 - scripts/rvm.sh | 2 - 5 files changed, 117 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 015dd48..4218d07 100644 --- a/Makefile +++ b/Makefile @@ -39,4 +39,4 @@ mysql-8.0: no-choice: @echo 'Необходимо указать хотя бы один из предложенных параметров:' - @echo 'docker docker-compose rvm rbenv nvm postgresql-12 postgresql-14 mysql-5.7 mysql-8.0' \ No newline at end of file + @echo 'docker docker-compose rvm rbenv nvm postgresql-12 postgresql-14 mysql-5.7 mysql-8.0' diff --git a/main.sh b/main.sh index b784419..592851b 100644 --- a/main.sh +++ b/main.sh @@ -3,7 +3,7 @@ clear PS3='Выберите необходимую программу: ' -select Programm in "Docker" "Docker-compose" "RVM" "RBENV" "NVM" "Postgresql" "Mysql" +select Programm in "Docker" "Docker-compose" "RVM" "RBENV" "NVM" "Postgresql" "Mysql" "Выбрать несколько" do break done @@ -20,14 +20,17 @@ case $Programm in "RVM") echo "Installing $Programm" bash ./scripts/rvm.sh + exec bash ;; "RBENV") echo "Installing $Programm" bash ./scripts/rbenv.sh + exec bash ;; "NVM") echo "Installing $Programm" bash ./scripts/nvm.sh + exec bash ;; "Postgresql") clear @@ -71,6 +74,118 @@ case $Programm in ;; esac ;; + "Выбрать несколько") + ans6_1="false" + ans6_2="false" + ans7_1="false" + ans7_2="false" + clear + echo "Установить Docker? [y/n] " + read ans1 + echo "Установить Docker-compose? [y/n] " + read ans2 + echo "Установить RVM? [y/n] " + read ans3 + echo "Установить RBENV? [y/n] " + read ans4 + echo "Установить NVM? [y/n] " + read ans5 + echo "Установить Postgresql? [y/n] " + read ans6 + + if [ "$ans6" = "y" ] + then + PS3='Выберите необходимую версию Postgresql: ' + select Version in "12" "14" + do + break + done + case $Version in + "12") + ans6_1="true" + ;; + "14") + ans6_2="true" + ;; + *) + echo "Вы указали неверное значение." + ;; + esac + fi + echo "Установить Mysql? [y/n] " + read ans7 + + if [ "$ans7" = "y" ] + then + PS3='Выберите необходимую версию Mysql: ' + select Version in "5.7" "8.0" + do + break + done + case $Version in + "5.7") + ans7_1="true" + ;; + "8.0") + ans7_2="true" + ;; + *) + echo "Вы указали неверное значение." + ;; + esac + fi + + if [ "$ans1" = "y" ] + then + echo "Installing Docker" + sudo bash ./scripts/docker.sh + fi + if [ "$ans2" = "y" ] + then + echo "Installing Docker-compose" + sudo bash ./scripts/docker-compose.sh + fi + if [ "$ans3" = "y" ] + then + echo "Installing RVM" + bash ./scripts/rvm.sh + fi + if [ "$ans4" = "y" ] + then + echo "Installing RBENV" + bash ./scripts/rbenv.sh + fi + if [ "$ans5" = "y" ] + then + echo "Installing NVM" + bash ./scripts/nvm.sh + fi + if [ "$ans6" = "y" ] + then + if [ $ans6_1 = "true" ] + then + echo "Installing Postgresql 12" + sudo bash ./scripts/postgresql-12.sh + elif [ $ans6_2 = "true" ] + then + echo "Installing Postgresql 14" + sudo bash ./scripts/postgresql-14.sh + fi + fi + if [ "$ans7" = "y" ] + then + if [ $ans7_1 = "true" ] + then + echo "Installing Mysql 5.7" + sudo bash ./scripts/mysql-5.7.sh + elif [ $ans7_2 = "true" ] + then + echo "Installing Mysql 8.0" + sudo bash ./scripts/mysql-8.0.sh + fi + fi + exec bash + ;; *) echo "Вы указали неверное значение." ;; diff --git a/scripts/nvm.sh b/scripts/nvm.sh index d7a8fc6..f80fe03 100644 --- a/scripts/nvm.sh +++ b/scripts/nvm.sh @@ -14,12 +14,10 @@ if [ "$os" == "ubuntu" ]; then sudo apt update -y && sudo apt install -y apt-transport-https ca-certificates curl gnupg-agent software-properties-common curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash - exec bash fi if [ "$os" == "cpe:/o:centos:centos:7" ] || [ "$os" == "cpe:/o:centos:centos:8" ]; then sudo yum install -y curl curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash - exec bash fi \ No newline at end of file diff --git a/scripts/rbenv.sh b/scripts/rbenv.sh index 5cd3c80..ed3cfee 100644 --- a/scripts/rbenv.sh +++ b/scripts/rbenv.sh @@ -16,7 +16,6 @@ then curl -fsSL https://github.com/rbenv/rbenv-installer/raw/HEAD/bin/rbenv-installer | bash echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc echo 'eval "$(rbenv init -)"' >> ~/.bashrc - exec bash fi if [ "$os" == "cpe:/o:centos:centos:7" ] || [ "$os" == "cpe:/o:centos:centos:8" ]; @@ -25,5 +24,4 @@ then curl -fsSL https://github.com/rbenv/rbenv-installer/raw/HEAD/bin/rbenv-installer | bash echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc echo 'eval "$(rbenv init -)"' >> ~/.bashrc - exec bash fi \ No newline at end of file diff --git a/scripts/rvm.sh b/scripts/rvm.sh index 233e383..428a159 100644 --- a/scripts/rvm.sh +++ b/scripts/rvm.sh @@ -15,12 +15,10 @@ then sudo apt update -y && sudo apt install -y apt-transport-https ca-certificates curl gnupg-agent software-properties-common gpg --keyserver hkp://keyserver.ubuntu.com --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB curl -sSL https://get.rvm.io | bash -s - exec bash fi if [ "$os" == "cpe:/o:centos:centos:7" ] || [ "$os" == "cpe:/o:centos:centos:8" ]; then sudo yum install -y curl tar curl -L get.rvm.io | bash -s - exec bash fi \ No newline at end of file