-
Notifications
You must be signed in to change notification settings - Fork 2
/
setupscrept.sh
executable file
·174 lines (167 loc) · 7 KB
/
setupscrept.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
#!/bin/bash
RED=`tput setaf 1`
GREEN=`tput setaf 2`
YELLOW=`tput setaf 3`
BLUE=`tput setaf 6`
RESET=`tput sgr0`
echo -e
echo -e
echo -e
echo -e
echo "██████╗ █████╗ ██████╗ ██╗ ███╗ ███╗███████╗██╗ ██╗██████╗ ██╗███████╗███████╗"
echo "██╔══██╗██╔══██╗██╔══██╗██║ ████╗ ████║██╔════╝██║ ██║██╔══██╗██║╚════██║╚════██║"
echo "██████╔╝███████║██████╔╝██║ ██╔████╔██║█████╗ ███████║██║ ██║██║ ██╔╝ ██╔╝"
echo "██╔══██╗██╔══██║██╔══██╗██║ ██║╚██╔╝██║██╔══╝ ██╔══██║██║ ██║██║ ██╔╝ ██╔╝"
echo "██████╔╝██║ ██║██║ ██║██║ ██║ ╚═╝ ██║███████╗██║ ██║██████╔╝██║ ██║ ██║"
echo "╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝╚═════╝ ╚═╝ ╚═╝ ╚═╝"
echo "${BLUE}══════════════════════════║Welcome to My script installer║═══════════════════════════${RESET}"
echo -e
echo -e
echo -e
echo -e
read -p "${GREEN}Do you want to ${RED}Update Your System?${GREEN}:${YELLOW} [y/N]${RESET}" update
read -p "${GREEN}Do you want to ${RED}Install git?${GREEN}:${YELLOW} [y/N]${RESET}" git
read -p "${GREEN}Do you want to ${RED}Install zsh?${GREEN}:${YELLOW} [y/N]${RESET}" zsh
read -p "${GREEN}Do you want to ${RED}Install vim?${GREEN}:${YELLOW} [y/N]${RESET}" vim
read -p "${GREEN}Do you want to ${RED}Install FileZilla?${GREEN}:${YELLOW} [y/N]${RESET}" file
read -p "${GREEN}Do you want to ${RED}Install openssh?${GREEN}:${YELLOW} [y/N]${RESET}" os
read -p "${GREEN}Do you want to ${RED}Install curl?${GREEN}:${YELLOW} [y/N]${RESET}" curl
read -p "${GREEN}Do you want to ${RED}Install lsb-release?${GREEN}:${YELLOW} [y/N]${RESET}" lsb
read -p "${GREEN}Do you want to ${RED}Install Docker?${GREEN}:${YELLOW} [y/N]${RESET}" docker
read -p "${GREEN}Do you want to Make docker run Without ${RED}sudo${GREEN}:${YELLOW} [y/N]${RESET}" dsudo
read -p "${GREEN}Do you want to ${RED}Install Docker Compose?${GREEN}:${YELLOW} [y/N]${RESET}" dc
echo -e
echo -e
echo -e
echo -e
echo "${RED}════════════║Thank You, Please wait....║════════════${RESET}"
echo -e
echo -e
echo -e
echo -e
sleep 2
if [ "$update" == "y" ]
then
echo "${RED}Updating The System${RESET}"
sudo apt-get update -y
fi
if [ "$os" = 'y' ]
then
# if ! [ -x "$(command -v ssh)" ]
if ! [ -x "$(systemctl status ssh)" ]
then
echo "${GREEN}Installing ${BLUE}openssh${RESET}"
sudo apt install openssh-server -y
else
echo "${BLUE}openssh${RED} already Installed${RESET}"
fi
fi
if [ "$zsh" = 'y' ]
then
if ! [ -x "$(command -v zsh)" ]
then
echo "${GREEN}Installing ${BLUE}zsh${RESET}"
sudo apt install zsh -y
sudo apt install git-core curl fonts-powerline -y
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
else
echo "${BLUE}zsh${RED} already Installed${RESET}"
fi
fi
if [ "$git" = 'y' ]
then
if ! [ -x "$(command -v git)" ]
then
echo "${GREEN}Installing ${BLUE}git${RESET}"
sudo apt install git -y
else
echo "${BLUE}git${RED} already Installed${RESET}"
fi
fi
if [ "$vim" = 'y' ]
then
if ! [ -x "$(command -v vim)" ]
then
echo "${GREEN}Installing ${BLUE}vim${RESET}"
sudo apt install vim -y
else
echo "${BLUE}vim${RED} already Installed${RESET}"
fi
fi
if [ "$file" = 'y' ]
then
if ! [ -x "$(command -v filezilla)" ]
then
echo "${GREEN}Installing ${BLUE}FileZilla${RESET}"
sudo apt install filezilla -y
else
echo "${BLUE}FileZilla${RED} already Installed${RESET}"
fi
fi
if [ "$curl" = 'y' ]
then
if ! [ -x "$(command -v curl)" ]
then
echo "${GREEN}Installing ${BLUE}curl${RED}, ${BLUE}ca-certificates${RED} and ${BLUE}gnupg${RESET}"
sudo apt-get install ca-certificates curl gnupg lsb-release -y
else
echo "${BLUE}curl${RED} already Installed${RESET}"
fi
fi
if [ "$curl" = 'y' ]
then
if ! [ -x "$(command -v lsb_release)" ]
then
echo "${GREEN}Installing ${BLUE}lsb-release${RESET}"
sudo apt-get install lsb-release -y
else
echo "${BLUE}lsb_release${RED} already Installed${RESET}"
fi
fi
if [ "$docker" = 'y' ]
then
if ! [ -x "$(command -v docker)" ]
then
echo "${GREEN}Adding ${BLUE}Docker${GREEN}’s official ${BLUE}GPG key${RESET}"
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo "${GREEN}setting up the stable repository${RESET}"
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
echo "${GREEN}Re-update The System${RESET}"
sudo apt-get update -y
echo "${GREEN}Installing ${BLUE}docker${RESET}"
sudo apt-get install docker-ce docker-ce-cli containerd.io -y
else
echo "${BLUE}docker${RED} already Installed${RESET}"
fi
fi
if [ "$dsudo" = 'y' ]
then
echo "${GREEN}Make docker run as${BLUE} root${RESET}"
if grep -q docker /etc/group
then
echo "${GREEN}The Group${BLUE} docker${GREEN} Exists${RESET}"
else
sudo groupadd docker
fi
sudo usermod -aG docker $USER
sudo service docker restart
fi
if [ "$dc" = 'y' ]
then
if ! [ -x "$(command -v docker-compose)" ]
then
echo "${GREEN}Downloading the current stable release of Docker Compose${RESET}"
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
echo "${GREEN}Apply executable permissions to the binary${RESET}"
sudo chmod +x /usr/local/bin/docker-compose
else
echo "${BLUE}docker-compose${RED} already Installed${RESET}"
fi
fi
if [ "$dsudo" == 'y' ]
then
echo -e "${RED}╔════════════════════════════║NOTE:║════════════════════════╗${RESET}"
echo -e "${RED}║ ${BLUE} Please Restart Your machine To apply Those changes!${RED} ║${RESET}"
echo -e "${RED}╚═══════════════════════════════════════════════════════════╝${RESET}"
fi