chroot to install packages

Himanshu Garg hgarg.india at gmail.com
Wed Nov 13 20:52:42 EST 2013


On Thursday, November 14, 2013 5:10:20 AM UTC+5:30, Chris Angelico wrote:
> On Thu, Nov 14, 2013 at 1:31 AM, Himanshu Garg <hgarg.india at gmail.com> wrote:
> 
> > I am writing a python script to run chroot command to chroot to a linux distro and then run commands.  How can I do this, as after chrooting, the script runs the commands relative to the outside not inside the chrooted env?
> 
> 
> 
> Probably the easiest way to do this is to divide your script into two
> 
> pieces: one piece runs inside the chroot, the other doesn't. Then you
> 
> have the "outer" script invoke the "inner" script as a separate
> 
> process. When the inner process terminates, the outer continues, and
> 
> since the outer wasn't chrooted, it's now running commands relative to
> 
> the outside.
> 
> 
> 
> One convenient way to manage this is to have one script that invokes
> 
> itself with arguments. Another way is to have two actually separate
> 
> script files. It really depends how much work you're doing in each
> 
> half.
> 
> 
> 
> ChrisA

How can I do that?  Can you guide me?



More information about the Python-list mailing list