Skip to content

Instantly share code, notes, and snippets.

@orf
Created January 5, 2015 10:42
Show Gist options
  • Select an option

  • Save orf/2f37fb82fd995fc29048 to your computer and use it in GitHub Desktop.

Select an option

Save orf/2f37fb82fd995fc29048 to your computer and use it in GitHub Desktop.
if sys.platform.startswith('linux'):
if os.geteuid() == 0:
print 'DO. NOT. RUN. AS. ROOT.'
sys.exit()
else:
print 'Welcome to Contrl, Linux user!'
elif sys.platform.startswith('darwin'):
if os.geteuid() == 0:
print 'DO. NOT. RUN. AS. ROOT.'
sys.exit()
else:
print 'Welcome to Contrl, Mac user!'
# by the power of greyskull
if sys.platform.startswith('linux') or sys.platform.startswith("darwin"):
if os.geteuid() == 0:
print 'DO. NOT. RUN. AS. ROOT.'
sys.exit()
else:
print 'Welcome to Contrl, {0} user!'.format(get_system_name())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment