Skip to content

Commit

Permalink
fix root duplicates
Browse files Browse the repository at this point in the history
  • Loading branch information
thesayyn committed Dec 5, 2024
1 parent 43811c3 commit bda06c2
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions distroless/private/flatten.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,20 @@ if [[ "$output" != "-" ]]; then
fi
done


awk '{
if (substr($0,0,1) == "#") {
next;
}
line_count[$1]++;
if (line_count[$1] > 1) {
print substr($1, 3, length($1));
if ($1 == "/.") {
next
}
print $1
}
}' "$mtree" | sort | uniq | sort -r > "$duplicates"
$bsdtar $@ | run_gtar --delete --file - --occurrence=1 --files-from="$duplicates" > "$output"

$bsdtar --exclude "^./$" $@ | run_gtar --delete --file - --occurrence=1 --files-from="$duplicates" > "$output"
rm "$mtree"
else
# No deduplication, business as usual
Expand Down

0 comments on commit bda06c2

Please sign in to comment.