2016-02-05 18:02:02 +00:00
|
|
|
#!/usr/bin/env python3
|
2016-02-07 16:39:18 +00:00
|
|
|
import json, os, shutil
|
2016-02-07 16:19:03 +00:00
|
|
|
|
2016-02-09 21:54:21 +00:00
|
|
|
|
2016-02-07 16:19:03 +00:00
|
|
|
DIR = os.getcwd()
|
2016-02-14 17:47:57 +00:00
|
|
|
HOME = os.path.expanduser('~')
|
2016-02-07 16:19:03 +00:00
|
|
|
|
2016-02-08 11:07:00 +00:00
|
|
|
|
2016-02-07 21:53:49 +00:00
|
|
|
def _get_json(path):
|
2016-02-07 19:09:53 +00:00
|
|
|
return json.load(open(DIR + path))
|
|
|
|
|
2016-02-09 21:54:21 +00:00
|
|
|
|
2016-02-08 22:27:58 +00:00
|
|
|
def update():
|
2016-02-14 17:47:57 +00:00
|
|
|
os.system('sudo apt-get update -y')
|
2016-02-08 22:27:58 +00:00
|
|
|
|
|
|
|
|
|
|
|
def apt_upgrade():
|
2016-02-14 17:47:57 +00:00
|
|
|
os.system('sudo apt-get upgrade -y')
|
|
|
|
os.system('sudo apt-get dist-upgrade -y')
|
2016-02-07 16:39:18 +00:00
|
|
|
|
|
|
|
|
2016-02-07 22:08:48 +00:00
|
|
|
def apt_install_core():
|
2016-02-09 22:22:34 +00:00
|
|
|
packages = " ".join(_get_json('/apt/apt-installs-core.json'))
|
2016-02-14 17:47:57 +00:00
|
|
|
os.system("sudo apt-get install {} -y".format(packages))
|
2016-02-07 16:19:03 +00:00
|
|
|
|
|
|
|
|
2016-02-07 22:08:48 +00:00
|
|
|
def add_apt_keys():
|
2016-02-07 21:53:49 +00:00
|
|
|
for key in _get_json('/apt/apt-keys.json'):
|
2016-02-14 17:47:57 +00:00
|
|
|
os.system("wget -O - {} | sudo apt-key add -".format(key))
|
2016-02-07 16:19:03 +00:00
|
|
|
|
|
|
|
|
2016-02-07 22:08:48 +00:00
|
|
|
def add_apt_sources():
|
2016-02-14 17:47:57 +00:00
|
|
|
os.system('sudo apt/add-apt-sources.sh')
|
2016-02-07 16:19:03 +00:00
|
|
|
|
|
|
|
|
2016-02-07 22:08:48 +00:00
|
|
|
def add_apt_repos():
|
2016-02-07 21:53:49 +00:00
|
|
|
for repo in _get_json('/apt/apt-repos.json'):
|
2016-02-14 17:47:57 +00:00
|
|
|
os.system("sudo add-apt-repository {} -y".format(repo))
|
2016-02-07 16:19:03 +00:00
|
|
|
|
|
|
|
|
2016-02-07 22:08:48 +00:00
|
|
|
def apt_install_extras():
|
2016-02-09 22:22:34 +00:00
|
|
|
packages = " ".join(_get_json('/apt/apt-installs-extra.json'))
|
2016-02-14 17:47:57 +00:00
|
|
|
os.system("sudo apt-get install {} -y".format(packages))
|
2016-02-07 16:19:03 +00:00
|
|
|
|
2016-02-07 17:13:23 +00:00
|
|
|
|
2016-02-07 22:08:48 +00:00
|
|
|
def run_custom_installs():
|
2016-02-07 17:13:23 +00:00
|
|
|
os.system('apt/custom-installs.sh')
|
|
|
|
|
2016-02-07 16:32:59 +00:00
|
|
|
|
2016-02-07 22:08:48 +00:00
|
|
|
def install_atom_packages():
|
2016-02-07 21:53:49 +00:00
|
|
|
packages = " ".join(_get_json('/atom/packages.json'))
|
2016-02-07 16:32:59 +00:00
|
|
|
os.system("apm install {}".format(packages))
|
|
|
|
|
2016-02-05 18:02:02 +00:00
|
|
|
|
2016-02-08 11:07:00 +00:00
|
|
|
def export_atom_config():
|
2016-02-09 22:49:59 +00:00
|
|
|
os.makedirs("~/.atom", exist_ok=True)
|
2016-02-08 11:07:00 +00:00
|
|
|
os.system("cp -R atom/* ~/.atom/")
|
|
|
|
|
|
|
|
|
2016-02-07 22:08:48 +00:00
|
|
|
def install_configs():
|
2016-02-09 22:49:59 +00:00
|
|
|
os.makedirs("~/.config/terminator/", exist_ok=True)
|
2016-02-14 17:47:57 +00:00
|
|
|
shutil.copyfile(os.path.join(DIR, "config/terminator.conf"), os.path.expanduser("~/.config/terminator/config"))
|
|
|
|
shutil.copyfile(os.path.join(DIR, "bash/.bash_aliases"), os.path.expanduser("~/.bash_aliases"))
|
2016-02-09 22:49:59 +00:00
|
|
|
|
|
|
|
|
|
|
|
def source():
|
|
|
|
os.system(". ~/.bashrc")
|
2016-02-07 16:39:18 +00:00
|
|
|
|
2016-02-07 17:13:23 +00:00
|
|
|
|
2016-02-05 18:02:02 +00:00
|
|
|
if __name__ == '__main__':
|
2016-02-07 21:53:49 +00:00
|
|
|
print("Please run this file using the install script, not directly.")
|
2016-02-05 18:02:02 +00:00
|
|
|
exit(1)
|