dotfiles/INSTALL_ALL_THE_THINGS

26 lines
667 B
Text
Raw Normal View History

2016-02-07 22:09:07 +00:00
#!/usr/bin/env python3
2016-02-05 18:05:20 +00:00
import os
2016-02-05 18:26:20 +00:00
import sys
2016-02-05 18:05:20 +00:00
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__':
2016-02-05 18:26:20 +00:00
if os.geteuid() != 0:
2016-02-07 19:09:53 +00:00
print("Please run as root!")
2016-02-05 18:26:20 +00:00
elif input("Are you sure you want to install (allthethings)? [Y/N]: ").lower() == 'y':
2016-02-07 21:53:49 +00:00
scripts = []
2016-02-05 18:19:08 +00:00
for key, func in get_functions().items():
2016-02-07 21:53:49 +00:00
if type(func).__name__ == 'function' and func.__name__[0] != '_':
scripts.append(func)
2016-02-05 18:05:20 +00:00
2016-02-07 21:53:49 +00:00
for func in scripts:
func()