[Tutor] Run a few Python commands from a temporary filesystem when the rootfs is halted

Frederick Grose fgrose at gmail.com
Sat Apr 23 03:18:55 CEST 2011


On Fri, Apr 22, 2011 at 8:55 PM, Steve Willoughby <steve at alchemy.com> wrote:

> On 22-Apr-11 17:14, Frederick Grose wrote:
>
>> The particulars are that I've rebuilt a Fedora LiveOS filesystem image
>> from a currently running instance (incorporating the filesystem changes
>> in the device-mapper overlay into a new base filesystem image file).
>>
>
> Right, so essentially you're talking about chrooting into the LiveOS image
> temporarily.  It's not really "halting" as such, just where the OS's idea of
> "root" is at the moment.  That involves mounting your LiveOS filesystem as
> well.
>
> The short answer is that if you can do it in the shell, you can do it in
> Python, but there's got to be more to the story than just this.  What are
> you trying to actually do that you need Python for this?  I assume you're
> trying to automate the process of what you're doing?
>
> Almost probably this is possible with Python, if I understand what you're
> doing.  If you just want to know how to write a Python script around the
> steps you want to accomplish, as a simple beginning Python experience, we
> may still be of service to you.
>
> We could, for example point you to read up on the os.chroot() function in
> the Python standard library.
>
> If your question has more to do with the particulars of managing chroot()ed
> mountpoints or preparing LiveOS images, you'd need to look to a forum
> devoted to that.
>
>
> --
> Steve Willoughby / steve at alchemy.com
>

Thank you Steve and Steven for your assistance!

I misread this sentence in the list description, "While the list is called
tutor, anyone, whether novice or expert, can answer questions." .. to
include 'ask' as well as answer questions that may be instructive.

I've posted in Python-list, as suggested.

Steven's synopsis, "... you would need somehow to end the *current* Python
process and start up a *new* Python process running from executables on the
new file system, without manual intervention." is the situation I'm
attempting.

I have written the LiveOS rebuilding code in Python, and am working to
complete the operation in Python, if possible, but don't know enough about
how the Python shutdown and startup might be scripted within Python.

        --Fred
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20110422/0de212a5/attachment.html>


More information about the Tutor mailing list