NNBnh / superb-bootstrap

🅱️ OS dotfiles-manager framework that SuperB
GNU General Public License v3.0
112 stars 7 forks source link

[Suggestion] Clone and install paru only if it's not already installed #4

Closed xfzv closed 3 years ago

xfzv commented 3 years ago

As I was testing the packages install feature, I noticed that this function was run although I already had paruAUR installed:

https://github.com/NNBnh/superb-bootstrap/blob/1e478bc2a4d2cfc17f12fdd63aa1ca29957d5d0b/setup#L88-L94


https://github.com/NNBnh/superb-bootstrap/blob/1e478bc2a4d2cfc17f12fdd63aa1ca29957d5d0b/setup#L46

What about using something like this instead, so that paruAUR is cloned and installed only if it's not already installed?

if [[ "$packagemanager_main"  = 'Pacman' ]]; then
    if ! command -v "paru" >/dev/null; then
        packagemanager_list="$packagemanager_list AUR"
    fi
        packagemanager_list="$packagemanager_list Flatpak"
fi
NNBnh commented 3 years ago

packagemanager_list isn't just to setup/install the package managers themself, it's also to install packages from that package manager. So we will change superbbootstrap_AUR() directly:

superbbootstrap_AUR() {
    if ! command -v 'paru' >/dev/null; then
        $PERMISSION_COMMAND pacman --sync --noconfirm --needed git base-devel
        git clone 'https://aur.archlinux.org/paru.git' "$TEMPORARY/paru"
        cd "$TEMPORARY/paru" || exit 1
        makepkg -si
        cd "$WD" || exit 1
    else
        printf '%s\n' "Paru has been installed"
    fi
}

This will be add to SBB 1.5.4

NNBnh commented 3 years ago

This has been add to SBB 1.5.4