-
Notifications
You must be signed in to change notification settings - Fork 1
/
.wizard_utils.sh
58 lines (48 loc) · 942 Bytes
/
.wizard_utils.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
# author: ivanp7 (https://github.com/ivanp7/archlinux-autoconfig)
WIZARD_ROOT="$(realpath "$(dirname "$0")")"
WIZARD_DOT="$WIZARD_ROOT/dotfiles"
check_root ()
{
if [ "$(id -u)" != "0" ]; then
echo This script must be run under root. Terminating...
exit 1
fi
cd /
}
check_user ()
{
if [ "$(id -u)" = "0" ]; then
echo This script must be run under a non-priviledged user. Terminating...
exit 1
fi
}
install_official_packages ()
{
sudo pacman --needed --noconfirm -S "$@"
}
install_packages ()
{
yay --needed --noconfirm -S "$@"
}
uninstall_packages ()
{
sudo pacman --noconfirm -Rns "$@"
}
add_cronjob ()
{
crontab -l | { cat; echo "$@"; } | crontab -
}
print_header ()
{
echo
echo $(printf '%0.s-' $(seq 1 $(echo $* | wc -c)))
echo $*
echo $(printf '%0.s-' $(seq 1 $(echo $* | wc -c)))
echo
}
print_subheader ()
{
echo
echo $*
echo
}