[xen-tools-discuss] Roles and many chroot commands

Axel Beckert abe at deuxchevaux.org
Fri Sep 7 00:39:28 CEST 2012


Hi,

On Fri, Sep 07, 2012 at 12:05:40AM +0200, Bubba Sour wrote:
> I have tried this, but it doesn't work, and the installation process seem
> to hang:
> 
> #!/bin/sh
> if [ -e /usr/lib/xen-tools/common.sh ]; then
>     . /usr/lib/xen-tools/common.sh
> else
>     echo "Installation problem"
> fi
> chroot ${prefix} /usr/bin/apt-get update
> 
> chroot ${prefix} /bin/bash -e -x
> 
> command 1
> command 2
> ...
> 
> exit
> 
> Are there any better way of executing several chrooted commands?

You have to redirect STDIN to bash, e.g. with a so called "here
document":

chroot ${prefix} /bin/bash -e -x <<EOF
echo foobar
echo fnord
EOF

Hope, this helps.

		Kind regards, Axel
-- 
/~\  Plain Text Ribbon Campaign                   | Axel Beckert
\ /  Say No to HTML in E-Mail and News            | abe at deuxchevaux.org  (Mail)
 X   See http://www.asciiribbon.org/              | abe at noone.org (Mail+Jabber)
/ \  I love long mails: http://email.is-not-s.ms/ | http://noone.org/abe/ (Web)


More information about the xen-tools-discuss mailing list