-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.sh
103 lines (83 loc) · 2.75 KB
/
setup.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
#!/bin/bash
# ====================== List of Functions ====================== #
# Needed Package upon running the setup.sh
initPackages(){
installPackage figlet
installLolcat
}
# Print the header design
header () {
clear
figlet -f Standard " Ubuntu Setup " | lolcat
echo -e " Created a simple installer to automate downloading of\n my applications and customizations\n" | lolcat
echo " Created By : Jookie262" | lolcat
echo " Github : https://github.com/Jookie262/my-ubuntu-setup" | lolcat
}
# Checks if a certain package is installed
# Returns yes or no
checkPackage(){
if [ $(dpkg-query -W -f='${Status}' $1 2>/dev/null | grep -c "ok installed") -eq 0 ]; then
isInstalled="no"
else
isInstalled="yes"
fi
}
# Install the package if the checkPackage method returns no
installPackage(){
checkPackage $1
if [[ $isInstalled == "no" ]]; then
sudo apt-get install $1 -y
fi
}
# Install the packages needed for lolcat (for colorful text)
installLolcat(){
# Install the lolcat package first
installPackage lolcat
# Checks if the lolcat package is successfull
checkPackage lolcat
# If the lolcat package cannot be able to install then execute inside the if statement
if [[ $isInstalled == "no" ]]; then
installPackage gem
installPackage gcc
installPackage make
installPackage lolcat
fi
}
# Options for Applications
listApplication() {
echo ""
echo " =================== List of Applications ===================="
echo " [1] Google Chrome Yes"
echo " [2] Gnome-Tweak Yes"
echo " [3] Visual Studio Code Yes"
echo " [4] VLC Yes"
echo " [5] Free Download Manager Yes"
echo " [6] Filezilla Yes"
echo " [7] Vim Yes"
echo " [8] Anydesk Yes"
echo " ============================================================="
}
# Ask user to select repeatedly until the user enters letter N
selectOptions() {
echo ""
while true
do
read -p " Select: " ans
if [ $ans == "N" ]; then
return 1
fi
done
}
# ====================== End of Functions ====================== #
# ====================== Start of Main ====================== #
# Update Repositories
# sudo apt update -y
# Call method that installs the needed packages
initPackages
# Call header function
header
# List All Applications
listApplication
# Call the selectOptions function
selectOptions
# ====================== End of Main ====================== #