-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path12-function.sh
More file actions
53 lines (43 loc) · 944 Bytes
/
12-function.sh
File metadata and controls
53 lines (43 loc) · 944 Bytes
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
#!/bin/bash
USERID=$(id -u)
if [ $USERID -ne 0 ]
then
echo "user is not root ,it is $USER, pls change acesss to root user of script $0"
exit 1
else
echo "user is root user of script : $0"
fi
VALIDATE(){
if [ $1 -eq 0 ]
then
echo "$2 successfull installed "
else
echo "$2 not successfull installed "
exit 1
fi
}
dnf list installed mysql
if [ $? -eq 0 ]
then
echo "MYSQL already installed "
else
dnf install mysql -y
VALIDATE $? "MYSQL"
fi
dnf list installed python
if [ $? -ne 0 ]
then
dnf install python -y
VALIDATE $? "python"
else
echo "python already installed"
fi
dnf list installed nginx
if [ $? -ne 0 ]
then
echo "nginx is not installed... going to install it"
dnf install nginx -y
VALIDATE $? "nginx"
else
echo "nginx is already installed...Nothing to do"
fi