-
Notifications
You must be signed in to change notification settings - Fork 2
/
upgrade
executable file
·83 lines (56 loc) · 1.63 KB
/
upgrade
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
#!/bin/sh
#
# Provides: upgrade
# Short-Description: Upgrade & clean packages
# Description: Upgrade & clean packages
color='\e[1;96m'; cclear='\e[0;0m'
file_release="/etc/os-release"
[ ${USER} != root ] && pre="sudo"
######################## MANJARO
if grep -qi manjaro "${file_release}"; then
cmd="${pre} pacman"
echo -e "${color}pacman update${cclear}"
${cmd} -Syu --noconfirm
echo -e "${color}pacman clean orphans${cclear}"
${cmd} -R $(pacman -Qdtq)
echo -e "${color}pacman clear cache${cclear}"
${cmd} -Sc --noconfirm
echo -e "${color}yay update${cclear}"
yay -Syu
echo -e "${color}yay clean orphans${cclear}"
yay -R $(yay -Qdt)
echo -e "${color}pacman clear cache${cclear}"
yay -Sc --noconfirm
rm -fR ~/.cache/yay
######################## UBUNTU / DEBIAN
elif grep -qiE 'debian|ubuntu' "${file_release}"; then
cmd="${pre} apt"
echo "${color}update${cclear}"
${cmd} update
echo "${color}upgrade${cclear}"
${cmd} -y upgrade
echo "${color}autoremove${cclear}"
${cmd} -y autoremove
echo "${color}clean${cclear}"
${cmd} -y clean
echo "${color}autoclean${cclear}"
${cmd} -y autoclean
######################## ALPINE
elif grep -qiE 'alpine' "${file_release}"; then
cmd="apk"
echo -e "${color}update${cclear}"
${cmd} update
echo -e "${color}upgrade${cclear}"
${cmd} upgrade
#echo -e "${color}clean${cclear}"
#${cmd} cache clean
######################## CENTOS
elif grep -qiE 'centos' "${file_release}"; then
cmd+="yum"
echo -e "${color}update${cclear}"
${cmd} -y update
echo -e "${color}upgrade${cclear}"
${cmd} -y upgrade
echo -e "${color}clean${cclear}"
${cmd} -y clean all
fi