mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-26 20:59:27 +01:00
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:
parent
4c7985f35c
commit
e8dcca25b1
@ -140,7 +140,6 @@ if __name__ == '__main__':
|
|||||||
'Even if you think you want it, you don\'t. '
|
'Even if you think you want it, you don\'t. '
|
||||||
'You\'re probably dumb if you do this.')
|
'You\'re probably dumb if you do this.')
|
||||||
|
|
||||||
|
|
||||||
(options, args) = parser.parse_args()
|
(options, args) = parser.parse_args()
|
||||||
|
|
||||||
if os.name == 'posix':
|
if os.name == 'posix':
|
||||||
|
@ -3,10 +3,6 @@
|
|||||||
import os
|
import os
|
||||||
import sys
|
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 supybot
|
||||||
|
|
||||||
import fix
|
import fix
|
||||||
@ -133,7 +129,17 @@ def main():
|
|||||||
log._stdoutHandler.setLevel(100) # *Nothing* gets through this!
|
log._stdoutHandler.setLevel(100) # *Nothing* gets through this!
|
||||||
parser = optparse.OptionParser(usage='Usage: %prog [options] [configFile]',
|
parser = optparse.OptionParser(usage='Usage: %prog [options] [configFile]',
|
||||||
version='Supybot %s' % conf.version)
|
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()
|
(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 = ''
|
filename = ''
|
||||||
if len(args) > 1:
|
if len(args) > 1:
|
||||||
parser.error('the wizard takes one argument at most.')
|
parser.error('the wizard takes one argument at most.')
|
||||||
|
Loading…
Reference in New Issue
Block a user