aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/%HOME%/.bash_utils/arch.sh
blob: 53cab87881ab0afb737b355a53508f294ab37104 (plain) (blame)
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
# Copyright (c) 2026 Egor Tensin <egor@tensin.name>
# This file is part of the "linux-home" project.
# For details, see https://github.com/egor-tensin/linux-home
# Distributed under the MIT License.

pacman_upgrade() (
    _bash_func_prelude
    sudo pacman -Syu --noconfirm
)

pacman_cleanup() (
    _bash_func_prelude

    local output
    output="$( pacman -Qqdt )" || true
    if [ -n "$output" ]; then
        echo "$output" | sudo pacman -Rcsn --noconfirm -
    fi
)

yay_opts='--noconfirm --needed --cleanafter --removemake'

yay_upgrade() (
    _bash_func_prelude
    yay -Syua $yay_opts
)

yay_install() (
    _bash_func_prelude
    yay -Sya $yay_opts "$@"
)

yay_cleanup() (
    _bash_func_prelude
    yay -Sca --noconfirm
)

arch_upgrade() (
    _bash_func_prelude

    echo =========================================================== pacman ===
    pacman_upgrade
    echo ============================================================== yay ===
    yay_upgrade
    echo ======================================================================

    local reboot_timeout=10
    echo "Rebooting in $reboot_timeout seconds..."
    sleep "$reboot_timeout"
    reboot
)

arch_cleanup() (
    _bash_func_prelude

    echo =========================================================== pacman ===
    pacman_cleanup
    echo ============================================================== yay ===
    yay_cleanup
    echo ======================================================================
)