> -----Original Message----- > From: Linux on 390 Port [mailto:[EMAIL PROTECTED] On > Behalf Of Romanowski, John (OFT) > Sent: Monday, October 23, 2006 10:37 AM > To: [email protected] > Subject: How to script chroot steps? > > > Is it possible to have a shell script that does chroot, does some > commands while chroot-ed and exits out of the chroot > environment back to > the shell script? > Do I need to use perl? I don't know any perl.
I'd break this into two scripts. The first script would invoke the second script in a subshell. The second script would chroot itself. When it exits, the first script would then resume and not be chrooted. The problem would be communicating back changes to the first script, if that is necessary. For example any changes to environment variables would need to be placed in a unique file. This could be done by having the first script use the "exec" to open the file (created with a mkstemp?) to a specific handle which would be passed to the second script. I am not good enough to know if a subshell can be done within a single script. But a subshell is the only what that I am aware of to "get back" from a chroot'ed environment. Hopefully somebody more knowledgable might have a better way to do this. Maybe a HERE document could be used somehow? -- John McKown Senior Systems Programmer HealthMarkets Keeping the Promise of Affordable Coverage Administrative Services Group Information Technology This message (including any attachments) contains confidential information intended for a specific individual and purpose, and its content is protected by law. If you are not the intended recipient, you should delete this message and are hereby notified that any disclosure, copying, or distribution of this transmission, or taking any action based on it, is strictly prohibited. ---------------------------------------------------------------------- For LINUX-390 subscribe / signoff / archive access instructions, send email to [EMAIL PROTECTED] with the message: INFO LINUX-390 or visit http://www.marist.edu/htbin/wlvindex?LINUX-390
