forked from josch/mmdebstrap
put fh variables into their own scope
This commit is contained in:
parent
62159d124a
commit
d503e4fd96
1 changed files with 34 additions and 27 deletions
19
mmdebstrap
19
mmdebstrap
|
@ -3302,7 +3302,9 @@ sub main() {
|
||||||
$gpghome, '--no-auto-check-trustdb',
|
$gpghome, '--no-auto-check-trustdb',
|
||||||
'--trust-model', 'always'
|
'--trust-model', 'always'
|
||||||
);
|
);
|
||||||
my ($ret, $fh, $message);
|
my ($ret, $message);
|
||||||
|
{
|
||||||
|
my $fh;
|
||||||
{
|
{
|
||||||
# change warning handler to prevent message
|
# change warning handler to prevent message
|
||||||
# Can't exec "gpg": No such file or directory
|
# Can't exec "gpg": No such file or directory
|
||||||
|
@ -3311,6 +3313,7 @@ sub main() {
|
||||||
}
|
}
|
||||||
# we only want to check if the gpg command exists
|
# we only want to check if the gpg command exists
|
||||||
close $fh;
|
close $fh;
|
||||||
|
}
|
||||||
if ($? != 0 || !defined $ret || defined $message) {
|
if ($? != 0 || !defined $ret || defined $message) {
|
||||||
info "gpg --version failed: cannot determine the right"
|
info "gpg --version failed: cannot determine the right"
|
||||||
. " signed-by value";
|
. " signed-by value";
|
||||||
|
@ -3336,6 +3339,7 @@ sub main() {
|
||||||
$signedby = " [signed-by=\"$keyring\"]";
|
$signedby = " [signed-by=\"$keyring\"]";
|
||||||
last;
|
last;
|
||||||
}
|
}
|
||||||
|
{
|
||||||
open my $fh, '-|', @gpgcmd, @keyringopts, '--with-colons',
|
open my $fh, '-|', @gpgcmd, @keyringopts, '--with-colons',
|
||||||
'--list-keys' // error "failed to fork(): $!";
|
'--list-keys' // error "failed to fork(): $!";
|
||||||
while (my $line = <$fh>) {
|
while (my $line = <$fh>) {
|
||||||
|
@ -3345,6 +3349,7 @@ sub main() {
|
||||||
push @aptfingerprints, $1;
|
push @aptfingerprints, $1;
|
||||||
}
|
}
|
||||||
close $fh;
|
close $fh;
|
||||||
|
}
|
||||||
if ($? != 0) {
|
if ($? != 0) {
|
||||||
error "gpg failed";
|
error "gpg failed";
|
||||||
}
|
}
|
||||||
|
@ -3356,21 +3361,23 @@ sub main() {
|
||||||
# are known by apt and only add signed-by option if that's not
|
# are known by apt and only add signed-by option if that's not
|
||||||
# the case
|
# the case
|
||||||
my @suitefingerprints = ();
|
my @suitefingerprints = ();
|
||||||
open my $suitefh, '-|', @gpgcmd, '--keyring', $keyring,
|
{
|
||||||
|
open my $fh, '-|', @gpgcmd, '--keyring', $keyring,
|
||||||
'--with-colons',
|
'--with-colons',
|
||||||
'--list-keys' // error "failed to fork(): $!";
|
'--list-keys' // error "failed to fork(): $!";
|
||||||
while (my $line = <$suitefh>) {
|
while (my $line = <$fh>) {
|
||||||
if ($line !~ /^fpr:::::::::([^:]+):/) {
|
if ($line !~ /^fpr:::::::::([^:]+):/) {
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
# if this fingerprint is not known by apt, then we need to
|
# if this fingerprint is not known by apt, then we need
|
||||||
# add the signed-by option
|
#to add the signed-by option
|
||||||
if (none { $_ eq $1 } @aptfingerprints) {
|
if (none { $_ eq $1 } @aptfingerprints) {
|
||||||
$signedby = " [signed-by=\"$keyring\"]";
|
$signedby = " [signed-by=\"$keyring\"]";
|
||||||
last;
|
last;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
close $suitefh;
|
close $fh;
|
||||||
|
}
|
||||||
if ($? != 0) {
|
if ($? != 0) {
|
||||||
error "gpg failed";
|
error "gpg failed";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue