Against my better judgment, I'm adding a command-line option to allow dumb people to run their bots as root.

This commit is contained in:
Jeremy Fincher 2004-04-17 14:23:03 +00:00
parent 4c7985f35c
commit e8dcca25b1
2 changed files with 10 additions and 5 deletions

View File

@ -140,7 +140,6 @@ if __name__ == '__main__':
'Even if you think you want it, you don\'t. '
'You\'re probably dumb if you do this.')
(options, args) = parser.parse_args()
if os.name == 'posix':

View File

@ -3,10 +3,6 @@
import os
import sys
if os.name == 'posix':
if os.getuid() == 0 or os.geteuid() == 0:
sys.stderr.write('Please, don\'t run this as root.\n')
import supybot
import fix
@ -133,7 +129,17 @@ def main():
log._stdoutHandler.setLevel(100) # *Nothing* gets through this!
parser = optparse.OptionParser(usage='Usage: %prog [options] [configFile]',
version='Supybot %s' % conf.version)
parser.add_option('', '--allow-root', action='store_true',
dest='allowRoot',
help='Determines whether the bot will be allowed to run'
'as root. You don\'t want this. Don\'t do it.'
'Even if you think you want it, you don\'t. '
'You\'re probably dumb if you do this.')
(options, args) = parser.parse_args()
if os.name == 'posix':
if os.getuid() == 0 or os.geteuid() == 0 and not options.allowRoot:
sys.stderr.write('Please, don\'t run this as root.\n')
filename = ''
if len(args) > 1:
parser.error('the wizard takes one argument at most.')