Skip to content

Commit

Permalink
Add better example to demonstrate multi-dir merging
Browse files Browse the repository at this point in the history
  • Loading branch information
gliargovas committed Oct 7, 2023
1 parent 5284a8d commit b1f5873
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,22 +155,20 @@ explore /tmp/tmp.X6OQb5tJwr` to explore an existing sandbox.
To specify multiple lower directories for overlay (by merging them together), you can use the `-L` flag followed by a colon-separated list of directories. The directories on the left have higher precedence and can overwrite the directories on the right:

```ShellSession
$ try -D rustup-sandbox "curl https://sh.rustup.rs > rustup.sh"
$ try -D sandbox1 "echo 'File 1 Contents - sandbox1' > file1.txt"
...
$ try -L rustup-sandbox "sh rustup.sh"

Changes detected in the following files:

rustup-sandbox//upperdir/home/ubuntu/.profile (modified/added)
rustup-sandbox//upperdir/home/ubuntu/.bashrc (modified/added)
rustup-sandbox//upperdir/home/ubuntu/.rustup/update-hashes/stable-x86_64-unknown-linux-gnu (modified/added)
$ try -D sandbox2 "echo 'File 2 Contents - sandbox2' > file2.txt"
...
$ try -D sandbox3 "echo 'File 2 Contents - sandbox3' > file2.txt"
...

Commit these changes? [y/N] y

# Now use the -L flag to merge both sandbox directories together, with sandbox3 having precedence over sandbox2
$ try -L "sandbox3:sandbox2:sandbox1" "cat file1.txt file2.txt"
File 1 Contents - sandbox1
File 2 Contents - sandbox3
```

In this example, `try`` will merge `/lowerdir1`, `/lowerdir2` and `/lowerdir3` together before mounting the overlay. This way, you can combine the contents of multiple `try` sandboxes .
In this example, `try` will merge `/sandbox1`, `/sandbox2` and `/sandbox3` together before mounting the overlay. This way, you can combine the contents of multiple `try` sandboxes.


## Known Issues
Expand Down

0 comments on commit b1f5873

Please sign in to comment.