Add installation commands

This commit is contained in:
ItsDrike 2020-10-22 18:03:12 +02:00
parent 7872a839d8
commit 136af1a384
No known key found for this signature in database
GPG key ID: F4E8FF4F6AC7F3B4

24
src/util/install.py Normal file
View file

@ -0,0 +1,24 @@
from src.util import command
class Install:
def is_installed(package: str) -> bool:
"""Check if the package is already installed in the system"""
return_code = command.get_return_code(f"pacman -Qi {package}")
return return_code != 1
def upgrade_pacman() -> None:
"""Run full sync, refresh the package database and upgrade."""
command.execute("pacman -Syu")
def pacman_install(package: str) -> None:
"""Install given `package`"""
command.execute(f"pacman -S {package}")
def yay_install(package: str) -> None:
"""Install give package via `yay` (from AUR)"""
command.execute(f"yay -S {package}")
def git_install(url: str) -> None:
"""Clone a git repository with given `url`"""
command.execute(f"git clone {url}")