summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian <Julianteule@gmail.com>2017-01-17 08:15:06 +0100
committerJulian <Julianteule@gmail.com>2017-01-17 08:15:06 +0100
commit050a57bce6a4b87684eed365cb5516d91b555174 (patch)
tree3f42c2f726bcd72a2bae01faca4e2552beefb937
parent672e2a143098fa302c7de356d1da2183bbe0ba40 (diff)
parentd6a34dc03e54f6d940d9c4812da6f0ff7b9bb116 (diff)
Merged stuff
-rw-r--r--Scripts/JUUPPA.py52
1 files changed, 52 insertions, 0 deletions
diff --git a/Scripts/JUUPPA.py b/Scripts/JUUPPA.py
new file mode 100644
index 0000000..cc70ff5
--- /dev/null
+++ b/Scripts/JUUPPA.py
@@ -0,0 +1,52 @@
+import requests, bs4, re, os, sys
+
+def getPPA(link):
+ m = re.search('\/.(.*)\/\+archive\/\w*\/(.*)', link)
+ if m != None:
+ return m.group(1) + "/" + m.group(2)
+ else:
+ return "Sorry could not find PPA"
+
+res = requests.get("https://launchpad.net/ubuntu/+ppas?name_filter=" + sys.argv[1])
+
+
+soup = bs4.BeautifulSoup(res.text, "html.parser")
+
+element = soup.find("table", {"class" : "listing"})
+if element != None:
+ elements = element.find("tbody").find_all("tr")
+
+ count = len(elements)
+ results = []
+
+ print("Found", len(elements),"results:\n")
+ for item in reversed(elements):
+ count -= 1
+ name = item.find("td").find("a").string
+ PPA = getPPA(item.find("td").find("a")["href"])
+ sources = item.find_all("td")[-2].string
+ binaries = item.find_all("td")[-1].string
+
+ results.append((name, PPA, sources, binaries))
+
+ print("Option number", count)
+ print("Name :", name)
+ print("PPA :", PPA)
+ print("Sources :", sources)
+ print("Binaries :", binaries)
+ print("")
+
+
+ print("Please select PPA", 0, "to", len(results))
+ index = int(input("Number: "))
+
+ print("Adding PPA", results[index-1][1], "with command 'sudo add-apt-repository ppa:" + results[index-1][1] + "'" + str(index-1))
+ os.system("sudo add-apt-repository ppa:" + results[index-1][1])
+
+ print("Updating packages")
+ os.system("sudo apt update")
+
+ print("Installing", "grub-customizer")
+ os.system("sudo apt install " + "grub-customizer")
+else:
+ print("No results where found for", sys.argv[1]) \ No newline at end of file