diff --git a/try b/try index 5774ae3..7dc5c62 100755 --- a/try +++ b/try @@ -72,6 +72,22 @@ try() { findmnt --real -r -o target -n >>"$DIRS_AND_MOUNTS" sort -u -o "$DIRS_AND_MOUNTS" "$DIRS_AND_MOUNTS" + # Setup excluded entries + excldir="$SANDBOX_DIR/excldir" + if [ -n "$EXCL_ENTS" ] + then + OLDIFS=$IFS + IFS=":" + mkdir "$excldir" + for exclent in $EXCL_ENTS + do + whiteout_file="$SANDBOX_DIR/excldir/$(realpath "$exclent")" + mkdir -p "$(dirname "$whiteout_file")" + mknod "$whiteout_file" c 0 0 + done + IFS=$OLDIFS + fi + # Calculate UPDATED_DIRS_AND_MOUNTS that contains the merge arguments in LOWER_DIRS UPDATED_DIRS_AND_MOUNTS="$(mktemp --suffix ".try-$EXECID")" export UPDATED_DIRS_AND_MOUNTS @@ -81,6 +97,11 @@ try() { OLDIFS=$IFS IFS=":" + if [ -d "$excldir/$mountpoint" ] + then + new_mountpoint="$excldir/$mountpoint" + fi + for lower_dir in $LOWER_DIRS do temp_mountpoint="$lower_dir/upperdir$mountpoint" @@ -614,7 +635,7 @@ NO_COMMIT="interactive" # Includes all patterns given using the `-i` flag; will be used with `grep -f` IGNORE_FILE="$(mktemp --suffix ".try-$EXECID")" -while getopts ":yvnhxi:D:U:L:" opt +while getopts ":yvnhxi:D:U:L:E:" opt do case "$opt" in (y) NO_COMMIT="commit";; @@ -632,6 +653,12 @@ do fi LOWER_DIRS="$OPTARG" NO_COMMIT="quiet";; + (E) if [ -n "$EXCL_ENTS" ] + then + error "the -E option has been specified multiple times" 2 + fi + EXCL_ENTS="$OPTARG" + NO_COMMIT="quiet";; (v) echo "$TRY_COMMAND version $TRY_VERSION" >&2 exit 0;; (U) if ! [ -x "$OPTARG" ]