From ca2a4dce8c556eff70fa9fc103662a7699baeffe Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Fri, 5 Feb 2016 18:26:20 +0000 Subject: [PATCH] Force runnning as root --- INSTALL_ALL_THE_THINGS | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/INSTALL_ALL_THE_THINGS b/INSTALL_ALL_THE_THINGS index cba700d..98cff8b 100755 --- a/INSTALL_ALL_THE_THINGS +++ b/INSTALL_ALL_THE_THINGS @@ -1,6 +1,8 @@ #!/usr/bin/env python import os +import sys + def get_functions(): ns = {} @@ -11,7 +13,11 @@ def get_functions(): return ns if __name__ == '__main__': - if input("Are you sure you want to install (allthethings)? [Y/N]: ").lower() == 'y': + if os.geteuid() != 0: + print("Not running as root. Elevating...") + 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': waf_scripts = [] for key, func in get_functions().items(): if type(func).__name__ == 'function':