forked from anddeeblack/apt-package-manager
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapt.sh
234 lines (200 loc) · 5.18 KB
/
apt.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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
#!/bin/bash
echo "
# ###### #######
# # # # #
# # # # #
# # ###### #
####### # #
# # # #
# # # #
"
sleep 1
animate(){
local spinner="/-\-|"
local i
for i in $(seq 1 10);do
printf "\r${spinner:i++%${#spinner}:1} Package Management Script"
sleep 0.1
done
printf "\r \n"
}
animate
sleep 0.1
clear
# Function to display the menu
show_menu() {
echo
echo "---------------------------------"
echo " APT Package Management Script"
echo "---------------------------------"
echo
echo "1. Add repo to sources.list"
echo "2. Edit sources.list"
echo "3. Download source archives"
echo
echo "4. Install flatpak & plugins"
echo "5. Add flatpak repo"
echo "6. Download gnome-software store"
echo
echo "7. Install a Package"
echo "8. Install a local .deb file"
echo "9. Download Package, without installing"
echo "10. View changelog"
echo "11. Verify no dependency issues"
echo
echo "12. Remove Packages"
echo "13. Remove Package cache"
echo "14. Purge Package & config files"
echo "15. Remove orphans"
echo
echo "16. Search for a Package"
echo "17. Display Information About a Package"
echo "18. View Package version"
echo "19. Show dependency Information"
echo "20. Find which Files belong to a Package"
echo
echo "21. Perform a safe-upgrade"
echo "22. Fully upgrade the system"
echo "23. Quit"
echo "---------------------------------"
}
# Function to add repo to sources.list
add_repo() {
read -p "Enter Repo info : " reponame
sudo apt add-repository "$reponame"
}
# Function to edit sources.list
edit_sources() {
sudo apt edit-sources
}
# Function to download source archives
down_source() {
read -p "Enter Package name : " pkgname
sudo apt source "$pkgname"
}
# Function to install flatpak and gnome-plugin
flat_pak() {
sudo apt install flatpak && sudo apt install gnome-software-plugin-flatpak
}
# Function to add the flatpak repo
flat_repo() {
flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
}
# Function to download the gnome-software GUI store
gnome_gui() {
flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
}
# Function to install software/applications
install_app() {
read -p "Enter Package name : " pkgname
sudo apt install "$pkgname"
}
# Function to install local .deb file
install_deb() {
read -p "Enter /path/to/package : (i.e > /home/user/random.deb" pathpkg
sudo apt deb "$pathpkg"
}
# Function to download package without installing
down_load() {
read -p "Enter Package name : " pkgname
sudo apt download "$pkgname"
}
# Function to view changelog
view_log() {
read -p "Enter Package name : " pkgname
sudo apt changelog "$pkgname"
}
# Function to verify if any dependency issues
view_dep() {
read -p "Enter Package name : " pkgname
sudo apt check "$pkgname"
}
# Function to remove a package
app_rm() {
read -p "Enter Package name : " pkgname
sudo apt remove "$pkgname"
}
# Function to remove package cache
auto_cln() {
sudo apt autoclean -y
}
# Function to purge package and config files
purge_app() {
read -p "Enter Package name : " pkgname
sudo apt purge "$pkgname"
}
# Function to remove orphans
auto_rm() {
sudo apt autoremove -y
}
# Function to search for a package
srch_app() {
read -p "Enter Package name : " pkgname
sudo apt search "$pkgname"
}
# Function to get info about a package
info_app() {
read -p "Enter Package name : " pkgname
sudo apt show "$pkgname"
}
# Function to package version
app_vrsn() {
read -p "Enter Package name : " pkgname
sudo apt version "$pkgname"
}
# Function to show dependency info
dep_info() {
read -p "Enter Package name : " pkgname
sudo apt depends "$pkgname"
}
# Function to find which files belong to which package
find_app() {
read -p "Enter Package name : " pkgname
sudo apt content "$pkgname"
}
# Function to find which files belong to which package
find_app() {
read -p "Enter Package name : " pkgname
sudo apt content "$pkgname"
}
# Function to preform a safe-upgrade
up_grade() {
sudo apt upgrade -y
}
# Function to preform a full-system-upgrade
full_upgrade() {
sudo apt dist-upgrade -y
}
# Main loop
while true; do
show_menu
read -p "Enter your choice [1-23]: " choice
case $choice in
1) add_repo ;;
2) edit_sources ;;
3) down_source ;;
4) flat_pak ;;
5) flat_repo ;;
6) gnome_gui ;;
7) install_app ;;
8) install_deb ;;
9) down_load ;;
10) view_log ;;
11) view_dep ;;
12) app_rm ;;
13) auto_cln ;;
14) purge_app ;;
15) auto_rm ;;
16) srch_app ;;
17) info_app ;;
18) app_vrsn ;;
19) dep_info ;;
20) find_app ;;
21) up_grade ;;
22) full_upgrade ;;
23) echo "Exiting..."; exit 0 ;;
*) echo "Invalid choice :( " ;;
esac
echo
read -p "Press Enter to continue..." dummy
done