Cleanup python code
This commit is contained in:
parent
7890028325
commit
5adaa2edf8
2 changed files with 9 additions and 13 deletions
|
@ -14,9 +14,7 @@ def get_functions():
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
if os.geteuid() != 0:
|
if os.geteuid() != 0:
|
||||||
print("Not running as root. Elevating...")
|
print("Please run as root!")
|
||||||
args = ['sudo', sys.executable] + sys.argv + [os.environ]
|
|
||||||
os.execlpe('sudo', *args)
|
|
||||||
elif input("Are you sure you want to install (allthethings)? [Y/N]: ").lower() == 'y':
|
elif input("Are you sure you want to install (allthethings)? [Y/N]: ").lower() == 'y':
|
||||||
os.system('./install-waf.sh')
|
os.system('./install-waf.sh')
|
||||||
waf_scripts = []
|
waf_scripts = []
|
||||||
|
|
18
wscript
18
wscript
|
@ -3,6 +3,9 @@ import json, os, shutil
|
||||||
|
|
||||||
DIR = os.getcwd()
|
DIR = os.getcwd()
|
||||||
|
|
||||||
|
def get_json(path):
|
||||||
|
return json.load(open(DIR + path))
|
||||||
|
|
||||||
def update_and_upgrade(ctx):
|
def update_and_upgrade(ctx):
|
||||||
os.system('apt-get update -y')
|
os.system('apt-get update -y')
|
||||||
os.system('apt-get upgrade -y')
|
os.system('apt-get upgrade -y')
|
||||||
|
@ -10,14 +13,12 @@ def update_and_upgrade(ctx):
|
||||||
|
|
||||||
|
|
||||||
def apt_install_core(ctx):
|
def apt_install_core(ctx):
|
||||||
packages = json.load(open(DIR + '/apt/apt-installs-core.json'))
|
for package in get_json('/apt/apt-installs-core.json'):
|
||||||
for package in packages:
|
|
||||||
os.system("apt-get install {} -y".format(package))
|
os.system("apt-get install {} -y".format(package))
|
||||||
|
|
||||||
|
|
||||||
def add_apt_keys(ctx):
|
def add_apt_keys(ctx):
|
||||||
keys = json.load(open(DIR + '/apt/apt-keys.json'))
|
for key in get_json('/apt/apt-keys.json'):
|
||||||
for key in keys:
|
|
||||||
os.system("wget -O - {} | apt-key add -".format(key))
|
os.system("wget -O - {} | apt-key add -".format(key))
|
||||||
|
|
||||||
|
|
||||||
|
@ -26,14 +27,12 @@ def add_apt_sources(ctx):
|
||||||
|
|
||||||
|
|
||||||
def add_apt_repos(ctx):
|
def add_apt_repos(ctx):
|
||||||
repos = json.load(open(DIR + '/apt/apt-repos.json'))
|
for repo in get_json('/apt/apt-repos.json'):
|
||||||
for repo in repos:
|
|
||||||
os.system("add-apt-repository {} -y".format(repo))
|
os.system("add-apt-repository {} -y".format(repo))
|
||||||
|
|
||||||
|
|
||||||
def apt_install_extras(ctx):
|
def apt_install_extras(ctx):
|
||||||
packages = json.load(open(DIR + '/apt/apt-installs-extra.json'))
|
for package in get_json('/apt/apt-installs-extra.json'):
|
||||||
for package in packages:
|
|
||||||
os.system("apt-get install {} -y".format(package))
|
os.system("apt-get install {} -y".format(package))
|
||||||
|
|
||||||
|
|
||||||
|
@ -42,8 +41,7 @@ def run_custom_installs(ctx):
|
||||||
|
|
||||||
|
|
||||||
def install_atom_packages(ctx):
|
def install_atom_packages(ctx):
|
||||||
packages = json.load(open(DIR + '/atom/packages.json'))
|
packages = " ".join(get_json('/atom/packages.json'))
|
||||||
packages = " ".join(packages)
|
|
||||||
os.system("apm install {}".format(packages))
|
os.system("apm install {}".format(packages))
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue