mirror of
https://github.com/ItsDrike/dotfiles.git
synced 2024-12-26 13:14:35 +00:00
Add installation commands
This commit is contained in:
parent
7872a839d8
commit
136af1a384
24
src/util/install.py
Normal file
24
src/util/install.py
Normal 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}")
|
Loading…
Reference in a new issue