On Dec 30, 2010, at 6:32 PM, ghoulmann wrote:
> 
> Jonathon, Niphlod, Massimo, thank you for taking the time to write. I
> think I know much less than I implied in my original post.
> 
> Is the Jonathon and Niphlod produced something I can simply drop into /
> usr/lib/inithooks/firstboot.d and expect to ask the user the web2py
> password?
> 
> I'm assuming a shebang line first, of course.

Almost. It requires a web2py patch first, and for the two web2py.py commands to 
work, you'll have to know the full path.

And that's assuming that firstboot.d runs interactively....


> 
> Or is this to get me started and working in the right direction?
> Because I truly don't know Python (had three lessons in an online
> course), I'm afraid a need direction.
> 
> Any takers?
> 
> Rik Goldman
> 
> On Dec 30, 9:20 pm, Niphlod <niph...@gmail.com> wrote:
>> glad to be helpful and give my 2 cents to this community.
>> your helptext is definetely acceptable, in the long run maybe a
>> comment in the code will be more helpful than the "explicit"
>> helpstring of optparse
>> 
>> Niphlod
>> 
>> On Dec 30, 11:06 pm, Jonathan Lundell <jlund...@pobox.com> wrote:
>> 
>>> On Dec 30, 2010, at 12:51 PM, Niphlod wrote:
>> 
>>>> uhm....
>>>> virtually very very very draft of Jonathan's concept.....
>> 
>>> That looks about right, perhaps with some minor wording changes:
>> 
>>>         help='exit after saving password' (no sense in confusing the user 
>>> about file names, and there's really no other initialization involved)
>> 
>>>         print 'no password to save; exiting'
>> 
>>>         (remove the "Creating..." print)
>>>         print 'password saved; exiting'
>> 
>>>> in gluon/widget.py , after "if '-A' in sys.argv: k = sys.argv.index('-
>>>> A')" (line 695, in trunk), add:
>> 
>>>> parser.add_option('',
>>>>                     '--exit',
>>>>                     action='store_true',
>>>>                     dest='force_exit',
>>>>                     default=False,
>>>>                     help='allows to save parameters.py file in order
>>>> to initialize the environment'
>>>>                     )
>> 
>>>> then, before " if options.quiet:" (line 704, in trunk):
>> 
>>>>   if options.force_exit and options.password == '<ask>':
>>>>       options.password = raw_input('choose a password:')
>>>>       if not options.password:
>>>>           print 'no password, --exit specified, clean shutdown'
>>>>           sys.exit(0)
>>>>   if options.force_exit and options.password:
>>>>       print 'Creating parameters.py file'
>>>>       main.save_password(options.password, options.port)
>>>>       print 'parameters.py created, now exiting'
>>>>       sys.exit(0)
>> 
>>>> tested and working....
>> 
>>>> eg: you can call
>>>>> web2py.py -a yourpass --exit
>>>>> web2py.py -a '<recycle>'
>> 
>>>> and everything works.
>> 
>>>> Make sure you start the webserver with the same port (default 8000,
>>>> can be overridden with -p)
>> 
>>>> Humbly helping ^_^
>> 
>>>> Happy new year, if we'll not see within the next days....


Reply via email to