warn if a hook is named like one but not executable and if a hook is executable but not named like one
This commit is contained in:
parent
0b7188ce32
commit
ea2b57870b
1 changed files with 17 additions and 3 deletions
20
mmdebstrap
20
mmdebstrap
|
@ -4526,13 +4526,27 @@ sub main() {
|
||||||
opendir(my $dh, $opt_value)
|
opendir(my $dh, $opt_value)
|
||||||
or error "Can't opendir($opt_value): $!";
|
or error "Can't opendir($opt_value): $!";
|
||||||
while (my $entry = readdir $dh) {
|
while (my $entry = readdir $dh) {
|
||||||
|
# skip the "." and ".." entries
|
||||||
|
next if $entry eq ".";
|
||||||
|
next if $entry eq "..";
|
||||||
|
my $found = 0;
|
||||||
foreach
|
foreach
|
||||||
my $hook ('setup', 'extract', 'essential', 'customize') {
|
my $hook ('setup', 'extract', 'essential', 'customize') {
|
||||||
if ($entry =~ m/^\Q$hook\E/ and -x "$opt_value/$entry") {
|
if ($entry =~ m/^\Q$hook\E/) {
|
||||||
push @{ $scripts{$hook} }, "$opt_value/$entry";
|
if (-x "$opt_value/$entry") {
|
||||||
$count += 1;
|
push @{ $scripts{$hook} }, "$opt_value/$entry";
|
||||||
|
$count += 1;
|
||||||
|
$found = 1;
|
||||||
|
} else {
|
||||||
|
warning("$opt_value/$entry is named like a "
|
||||||
|
. "hook but not executable");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!$found && -x "$opt_value/$entry") {
|
||||||
|
warning("$opt_value/$entry: is executable "
|
||||||
|
. "but not prefixed with a hook name");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
closedir($dh);
|
closedir($dh);
|
||||||
if ($count == 0) {
|
if ($count == 0) {
|
||||||
|
|
Loading…
Reference in a new issue