Rex icon indicating copy to clipboard operation
Rex copied to clipboard

Add chroot support

Open ferki opened this issue 11 years ago • 1 comments

Two methods have been discussed so far:

run 'command', chroot => { newroot => '/chroot/here' };

and

task "foo", sub {
  chroot "/some/path", sub {
    pkg "vim";
    service "blah", ensure => "running";
  };
};

ferki avatar Nov 05 '14 21:11 ferki

I see three options in relation to original intent of issue.

  1. Single command. In this one, I am not sure a nested hash is necessary. If the chroot string is present it is a directory. Otherwise, a hash could be available for options:
run 'cmd', chroot => '/chroot/here';
run 'cmd', chroot => { newroot => '/chroot/here', bang => 'diddly' };
  1. A block of commands (could also be like LOCAL):
task 'foo', sub {
  statement_0;
  chroot '/chroot/here', sub {
    statement_1;
    statement_2;
  };
  statement_3;
};
  1. An entire task, in the vein of no_ssh:
chroot task 'foo', sub {
  statement_0;
};

In the first two, it should make sense that some commands could be in a chroot while some commands could be on the target, just like some commands for a remote task could be local. But I think the last case is the least useful. How a task is run is a property of the host it is run against, not of the task.

So I am wondering if "running in a chroot" could be generalized to other connection forms. Connecting via ssh is kind of like setting up a chroot and then entering it.

bernyrd-cyber avatar Sep 24 '19 22:09 bernyrd-cyber