-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
aur.sh
executable file
·61 lines (52 loc) · 2.36 KB
/
aur.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
#!/bin/bash
###############################################################################################
# Filename: .../dotfiles/aur.sh #
# Purpose: File that manage the package manager AUR #
# Authors: Giulio Coa <[email protected]>, Christian Mondo #
# License: This file is licensed under the LGPLv3. #
# Pre-requisites: #
# * pacman #
# * sudo #
# * yay (https://github.com/Jguer/yay) #
###############################################################################################
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 pacman > /dev/null 2> /dev/null; then
echo -e "[$(date +'%Y-%m-%dT%H:%M:%S%z')]: ${bold_red:-}pacman isn't installed${reset:-}" > /dev/stderr
exit 1
elif ! command -v yay > /dev/null 2> /dev/null; then
echo -e "[$(date +'%Y-%m-%dT%H:%M:%S%z')]: ${bold_red:-}yay isn't installed${reset:-}" > /dev/stderr
exit 1
fi
# Clear unneeded dipendecies
aur-clear() {
yay --yay --clean
}
# Install from AUR or repository
aur-install() {
# the parameter $@ is the list of package that you want install
yay --sync --answerclean A --answerdiff N --removemake "$@"
}
# List explicitly installed AUR packages
aur-list-installed() {
sudo pacman --query --explicit --foreign
}
# List installed AUR packages
aur-list-installed-all() {
sudo pacman --query --foreign
}
# Remove packages, their dependencies not required and configurations
aur-remove() {
# the parameter $@ is the list of package that you want remove
sudo pacman --remove --nosave --recursive "$@" && aur-clear
}
# Upgrade all AUR packages
aur-upgrade() {
# PackageKit support
if command -v pkcon > /dev/null 2> /dev/null; then
sudo pkcon refresh && sudo pkcon update
fi
yay --sync --refresh --sysupgrade --aur --answerclean A --answerdiff N --removemake \
&& aur-clear
}