Fix install

This commit is contained in:
Jake Howard 2016-02-08 22:27:58 +00:00
parent 633199826e
commit cc7597aa3e
4 changed files with 23 additions and 16 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
__pycache__/

View file

@ -2,24 +2,28 @@
import os
import sys
from scripts.install_dotfiles import *
EXEC_ORDER = [
update,
apt_upgrade,
apt_install_core,
add_apt_keys,
add_apt_sources,
add_apt_repos,
update,
apt_install_extra,
run_custom_installs,
install_atom_packages,
export_atom_config,
install_configs
]
def get_functions():
ns = {}
fn = os.path.join(os.path.dirname(__file__), 'wscript')
with open(fn) as f:
code = compile(f.read(), fn, 'exec')
eval(code, ns, ns)
return ns
if __name__ == '__main__':
if os.geteuid() != 0:
print("Please run as root!")
elif input("Are you sure you want to install (allthethings)? [Y/N]: ").lower() == 'y':
scripts = []
for key, func in get_functions().items():
if type(func).__name__ == 'function' and func.__name__[0] != '_':
scripts.append(func)
for func in scripts:
func()
for script in EXEC_ORDER:
script()
print("\n>>{} Executed.\n".format(script.__name__))

0
scripts/__init__.py Normal file
View file

View file

@ -7,9 +7,11 @@ DIR = os.getcwd()
def _get_json(path):
return json.load(open(DIR + path))
def update_and_upgrade():
def update():
os.system('apt-get update -y')
def apt_upgrade():
os.system('apt-get upgrade -y')
os.system('apt-get dist-upgrade -y')