From e8dcca25b1a97a3a7b96e08558db41a79fe690e2 Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Sat, 17 Apr 2004 14:23:03 +0000 Subject: [PATCH] Against my better judgment, I'm adding a command-line option to allow dumb people to run their bots as root. --- scripts/supybot | 1 - scripts/supybot-wizard | 14 ++++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/scripts/supybot b/scripts/supybot index 7bbb944d5..e625173e7 100755 --- a/scripts/supybot +++ b/scripts/supybot @@ -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': diff --git a/scripts/supybot-wizard b/scripts/supybot-wizard index 49744d8f5..ed2ff3eb8 100755 --- a/scripts/supybot-wizard +++ b/scripts/supybot-wizard @@ -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.')