forked from josch/mmdebstrap
add --skip check/empty
This commit is contained in:
parent
1b380e4513
commit
4ea784c1bc
1 changed files with 34 additions and 29 deletions
23
mmdebstrap
23
mmdebstrap
|
@ -3911,9 +3911,12 @@ sub main() {
|
|||
if (!-d $options->{root}) {
|
||||
error "$options->{root} exists and is not a directory";
|
||||
}
|
||||
# check if the directory is empty or contains nothing more than an
|
||||
# empty lost+found directory. The latter exists on freshly created
|
||||
# ext3 and ext4 partitions.
|
||||
if (any { $_ eq 'check/empty' } @{ $options->{skip} }) {
|
||||
info "skipping check/empty as requested";
|
||||
} else {
|
||||
# check if the directory is empty or contains nothing more than
|
||||
# an empty lost+found directory. The latter exists on freshly
|
||||
# created ext3 and ext4 partitions.
|
||||
# rationale for requiring an empty directory:
|
||||
# https://bugs.debian.org/833525
|
||||
opendir(my $dh, $options->{root})
|
||||
|
@ -3922,13 +3925,14 @@ sub main() {
|
|||
# skip the "." and ".." entries
|
||||
next if $entry eq ".";
|
||||
next if $entry eq "..";
|
||||
# if the entry is a directory named "lost+found" then skip it
|
||||
# if it's empty
|
||||
if ($entry eq "lost+found" and -d "$options->{root}/$entry") {
|
||||
# if the entry is a directory named "lost+found" then skip
|
||||
# it, if it's empty
|
||||
if ($entry eq "lost+found"
|
||||
and -d "$options->{root}/$entry") {
|
||||
opendir(my $dh2, "$options->{root}/$entry");
|
||||
# Attempt reading the directory thrice. If the third time
|
||||
# succeeds, then it has more entries than just "." and ".."
|
||||
# and must thus not be empty.
|
||||
# Attempt reading the directory thrice. If the third
|
||||
# time succeeds, then it has more entries than just "."
|
||||
# and ".." and must thus not be empty.
|
||||
readdir $dh2;
|
||||
readdir $dh2;
|
||||
# rationale for requiring an empty directory:
|
||||
|
@ -3943,6 +3947,7 @@ sub main() {
|
|||
}
|
||||
}
|
||||
closedir($dh);
|
||||
}
|
||||
} else {
|
||||
my $num_created = make_path "$options->{root}",
|
||||
{ error => \my $err };
|
||||
|
|
Loading…
Reference in a new issue