From cc7597aa3eac43da66b79a32d895f8b91288b6ac Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Mon, 8 Feb 2016 22:27:58 +0000 Subject: [PATCH] Fix install --- .gitignore | 1 + INSTALL_ALL_THE_THINGS | 32 +++++++++++++++----------- scripts/__init__.py | 0 wscript => scripts/install_dotfiles.py | 6 +++-- 4 files changed, 23 insertions(+), 16 deletions(-) create mode 100644 .gitignore create mode 100644 scripts/__init__.py rename wscript => scripts/install_dotfiles.py (97%) diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c18dd8d --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +__pycache__/ diff --git a/INSTALL_ALL_THE_THINGS b/INSTALL_ALL_THE_THINGS index bd31c8f..b391dc0 100755 --- a/INSTALL_ALL_THE_THINGS +++ b/INSTALL_ALL_THE_THINGS @@ -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__)) diff --git a/scripts/__init__.py b/scripts/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/wscript b/scripts/install_dotfiles.py similarity index 97% rename from wscript rename to scripts/install_dotfiles.py index fb98ef9..198ae46 100644 --- a/wscript +++ b/scripts/install_dotfiles.py @@ -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')