31 lines
822 B
Python
31 lines
822 B
Python
import subprocess
|
|
|
|
from commands.util import pacman
|
|
from commands.util.input_mgr import confirm
|
|
|
|
|
|
def setup():
|
|
print("==> Installing required packages")
|
|
if not pacman.install_package_list(["git"]):
|
|
print("Git installation failed")
|
|
return
|
|
|
|
subprocess.run(
|
|
["git", "clone", "https://aur.archlinux.org/yay.git"],
|
|
cwd="/tmp",
|
|
capture_output=True,
|
|
)
|
|
yay_install = subprocess.run(
|
|
["makepkg", "-si"], cwd="/tmp/yay", capture_output=True
|
|
)
|
|
|
|
if yay_install.returncode != 0:
|
|
print("==> Installation of yay failed")
|
|
if confirm(True, "Do you wish to view the logs?"):
|
|
print(yay_install.stdout, "\n", yay_install.stderr)
|
|
return
|
|
|
|
print("==> Installation completed")
|
|
|
|
# TODO: Check if yay is available before installing
|