forked from Mr-Whiskerss/Linux_Scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate.sh
More file actions
102 lines (82 loc) · 2.45 KB
/
update.sh
File metadata and controls
102 lines (82 loc) · 2.45 KB
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
#!/bin/bash
#Checking if script is running at root.
if [ "$EUID" -ne 0 ]
then echo "[!] Please run as root"
exit
fi
banner(){
echo "CiAgIF9fICBfXyAgICAgICAgICBfXyAgICAgIF9fICAgICAgICAgIF9fX19fICAgICAgICAgICBfICAgICAgIF9fIAogIC8gLyAvIC9fX18gIF9fX18vIC9fX18gXy8gL19fX18gICAgIC8gX19fL19fX19fX19fX18oXylfX18gIC8gL18KIC8gLyAvIC8gX18gXC8gX18gIC8gX18gYC8gX18vIF8gXCAgICBcX18gXC8gX19fLyBfX18vIC8gX18gXC8gX18vCi8gL18vIC8gL18vIC8gL18vIC8gL18vIC8gL18vICBfXy8gICBfX18vIC8gL19fLyAvICAvIC8gL18vIC8gL18gIApcX19fXy8gLl9fXy9cX18sXy9cX18sXy9cX18vXF9fXy8gICAvX19fXy9cX19fL18vICAvXy8gLl9fXy9cX18vICAKICAgIC9fLyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC9fLyAgICAgICAgICAgCg==" | base64 -d
}
update-repo(){
echo "[+] Updating Repos"
apt update > /dev/null 2>&1
}
update-package(){
echo "[+] Updating Packages"
apt -y upgrade > /dev/null 2>&1
}
update-distro(){
echo "[+] Updating Distribution"
apt -y dist-upgrade > /dev/null 2>&1
}
remove-packages(){
echo "[+] Removing Old Packages"
apt-get -y autoremove > /dev/null 2>&1
}
repo-sources(){
#cating source list to ensure kali sources are within the correct repo
echo "[!] Repo Sources"
cat /etc/apt/sources.list
}
# Display Banner
banner
# Set case-insensitivity
shopt -s nocasematch
#Display Repo Sources
#repo-sources
# Checking For Unattended Mode
case "$1" in
-u)
echo "[!] Unattended Mode"
update-repo
update-package
update-distro
remove-packages
;;
*)
echo "[!] Attended Mode - use the '-u' argument for unattended mode"
#Checking if you want to update repos
echo "[?] Do you want to update repos continue?(Y/N)"
read input
if [[ "{$input}" == *"n"* ]]; then
continue
elif [[ "{$input}" == *"y"* ]]; then
update-repo
fi
#Checking if you want to upgrade packages
echo "[?] Do you want to update repos continue?(Y/N)"
read input
if [[ "{$input}" == *"n"* ]]; then
continue
elif [[ "{$input}" == *"y"* ]]; then
update-package
fi
#Checking if you want to upgrade distro
echo "[?] Do you want to update repos continue?(Y/N)"
read input
if [[ "{$input}" == *"n"* ]]; then
continue
elif [[ "{$input}" == *"y"* ]]; then
update-distro
fi
#checking if you want to remove packages
echo "[?] Do you want to remove old packages?(Y/N)"
read input
if [[ "{$input}" == *"n"* ]]; then
continue
elif [[ "{$input}" == *"y"* ]]; then
remove-packages
fi
;;
esac
echo "[!] Update Finished!"