-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
apt.sh
executable file
·45 lines (39 loc) · 1.56 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
#!/bin/bash
##############################################################################
# Filename: .../dotfiles/apt.sh #
# Purpose: File that manage the package manager apt #
# Authors: Giulio Coa <[email protected]> #
# License: This file is licensed under the LGPLv3. #
# Pre-requisites: #
# * apt #
# * sudo #
##############################################################################
if ! command -v sudo > /dev/null 2> /dev/null; then
echo -e "[$(date +'%Y-%m-%dT%H:%M:%S%z')]: ${bold_red:-}sudo isn't installed${reset:-}" > /dev/stderr
exit 1
elif ! command -v apt > /dev/null 2> /dev/null; then
echo -e "[$(date +'%Y-%m-%dT%H:%M:%S%z')]: ${bold_red:-}apt isn't installed${reset:-}" > /dev/stderr
exit 1
fi
# Clear un-needed dipendecies
apt-clear() {
sudo apt autoremove
sudo apt clean all
}
# Remove packages, their dependencies not required and configurations
apt-remove() {
# the parameter $@ is the list of package that you want remove
sudo apt purge "$@" && apt-clear
}
# Upgrade all packages
apt-upgrade() {
# PackageKit support
if command -v pkcon > /dev/null 2> /dev/null; then
sudo pkcon refresh && sudo pkcon update
fi
{
sudo apt update
sudo apt dist-upgrade
sudo apt full-upgrade
} && apt-clear
}