Merge pull request #1254 from austinmoore-/master

Add check for root in script/bootstrap.py
This commit is contained in:
Cheng Zhao 2015-03-18 20:36:29 +08:00
Родитель b19cfba98e 521f61d7db
Коммит b8d918d24f
1 изменённых файлов: 14 добавлений и 0 удалений

Просмотреть файл

@ -19,6 +19,9 @@ def main():
os.chdir(SOURCE_ROOT)
args = parse_args()
if (args.yes is False and
sys.platform not in ('win32', 'cygwin')):
check_root()
if args.verbose:
enable_verbose_mode()
if sys.platform == 'cygwin':
@ -46,8 +49,19 @@ def parse_args():
parser.add_argument('-v', '--verbose',
action='store_true',
help='Prints the output of the subprocesses')
parser.add_argument('-y', '--yes', '--assume-yes',
action='store_true',
help='Run non-interactively by assuming "yes" to all ' \
'prompts.')
return parser.parse_args()
def check_root():
if os.geteuid() == 0:
print "We suggest not running this as root, unless you're really sure."
choice = raw_input("Do you want to continue? [y/N]: ")
if choice not in ('y', 'Y'):
sys.exit(0)
def update_submodules():
execute_stdout(['git', 'submodule', 'sync'])