-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaurpac.py
43 lines (35 loc) · 1.03 KB
/
aurpac.py
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
## AURPAC: Simple AUR helper in Python
## vesrion 1.1
import os
import sys
#import modules
#change to home directory to ensure packages arent cloned in the binary's folder
user = os.getlogin()
os.chdir(f"/home/{user}")
#get the pkg from the args
try:
targetpkg = str(sys.argv[1]) #store command line arg
print(f"Package to install: {targetpkg}")
except:
print("You did not provide a package to install.")
sys.exit()
#clone the repo from the AUR using git
try:
os.system(f"git clone https://aur.archlinux.org/{targetpkg}.git")
except:
print("Something went wrong. You may not have git installed. The AUR may be down or the package may not exist. Your internet connection may be down. Try again.")
sys.exit()
# move to the pkg directory
try:
wdir = os.getcwd()
print(wdir)
os.chdir(f"{wdir}/{targetpkg}")
except:
print(f"fatal error: no directory was made for {targetpkg}.")
sys.exit()
# install it
try:
os.system("makepkg -si")
except:
print("Something went wrong. try again.")
sys.exit()