[Tutor] Run a few Python commands from a temporary filesystem when the rootfs is halted
Steve Willoughby
steve at alchemy.com
Sat Apr 23 02:55:40 CEST 2011
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
"A ship in harbor is safe, but that is not what ships are built for."
PGP Fingerprint 4615 3CCE 0F29 AE6C 8FF4 CA01 73FE 997A 765D 696C
More information about the Tutor
mailing list