Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- import subprocess
- PROGRAMS = [
- "chromium",
- "conky",
- "feh",
- "emacs",
- "gvim",
- "git",
- "i3",
- "mpv",
- "zsh",
- "zathura",
- ]
- def is_tool(name):
- """Check whether `name` is on PATH and marked as executable."""
- # from whichcraft import which
- from shutil import which
- return which(name) is not None#
- # Make sure system is updated first"
- print("\nsudo pacman -Syu")
- try:
- subprocess.call("sudo pacman -Syu", shell=True)
- except:
- quit()
- AURS = ["aurman", "yay", "trizen", "yaourt"]
- for i, name in enumerate(AURS):
- print((i), name)
- num, aur_len = -1, len(AURS)
- while num < 0 or num > aur_len-1:
- string = input('\nEnter a valid AUR helper: ')
- try:
- num = int(string)
- except ValueError:
- print("Input must be an integer [0:",aur_len,"]")
- AUR = AURS[num]
- if is_tool(AUR):
- print("{} is already installed".format(AUR))
- else:
- subprocess.call("pacman -S {}".format(AUR), shell=True)
- for PROGRAM in PROGRAMS:
- print("\n",PROGRAM)
- if is_tool(PROGRAM):
- print("{} is already installed".format(PROGRAM))
- else:
- subprocess.call("{} -S {}".format(AUR, PROGRAM), shell=True)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement