severity 595017 important
quit

On Wed, 1 Sep 2010 02:47:07 +1000
trentb...@gmail.com wrote:

> I tried that already; it doesn't work because it's looking for the
> keyring inside the target now, rather than looking in /etc/apt/.
> 
> I'll make a transcript to confirm this tomorrow.

Please try the attached patch.

-- 


Neil Williams
=============
http://www.data-freedom.org/
http://www.linux.codehelp.co.uk/
http://e-mail.is-not-s.ms/

Index: multistrap
===================================================================
--- multistrap	(revision 7506)
+++ multistrap	(working copy)
@@ -151,6 +151,8 @@
 system ("mkdir -p ${dir}${dpkgdir}") if (not -d "${dir}${dpkgdir}");
 system ("mkdir -p ${dir}etc/apt/sources.list.d/")
 	if (not -d "${dir}etc/apt/sources.list.d/");
+system ("mkdir -p ${dir}etc/apt/trusted.gpg.d/")
+	if (not -d "${dir}etc/apt/trusted.gpg.d/");
 system ("mkdir -p ${dir}etc/apt/preferences.d/")
 	if (not -d "${dir}etc/apt/preferences.d/");
 system ("mkdir -p ${dir}usr/share/info/")
@@ -256,8 +258,6 @@
 foreach my $pkg (values %keyrings) {
 	next if (not defined $pkg);
 	next if ("" eq "$pkg");
-	my $status = `LC_ALL=C dpkg -s $pkg`;
-	next if $status =~ /Status: install ok installed/;
 	$k .= "$pkg ";
 }
 if (defined $k) {
@@ -267,13 +267,36 @@
 		if (($e =~ /\nUSER=root\n/)) {
 			$str = "sudo" if (-f "/usr/bin/sudo");
 		}
-		printf (_g("I: Installing %s\n"), $k);
-		system ("$str apt-get install $k");
+		printf (_g("I: Downloading %s\n"), $k);
+		system ("$str apt-get -d --reinstall install $k");
 	}
 }
+foreach my $keyring_pkg (values %keyrings) {
+	my @files=();
+	my $file = `find /var/cache/apt/archives/ -name "$keyring_pkg*"`;
+	chomp ($file);
+	my $xdir = `mktemp -d -t keyring.XXXXXX`;
+	chomp ($xdir);
+	system ("dpkg -X $file $xdir >/dev/null");
+	if (-d "${xdir}/usr/share/keyrings") {
+		opendir (DIR, "${xdir}/usr/share/keyrings");
+		@files=grep(!m:\.\.?$:,readdir DIR);
+		closedir (DIR);
+	}
+	foreach my $gpg (@files) {
+		next if ($gpg =~ /removed/);
+		system ("gpg --no-default-keyring ".
+			"--homedir=${dir}/etc/apt/trusted.gpg.d/ ".
+			"--keyring=multistrap.gpg ".
+			" --import ${xdir}/usr/share/keyrings/${gpg} 2>/dev/null");
+	}
+	system ("rm -rf ${xdir}");
+}
 
 $config_str = '';
 $config_str .= " -o Apt::Architecture=$arch";
+$config_str .= " -o Dir::Etc::TrustedParts=${dir}${etcdir}trusted.gpg.d";
+$config_str .= " -o Dir::Etc::Trusted=${dir}${etcdir}trusted.gpg";
 $config_str .= " -o Apt::Get::AllowUnauthenticated=true"
 	if (defined $noauth);
 $config_str .= " -o Apt::Get::Download-Only=true";
@@ -933,11 +956,11 @@
 	print "packages:\tPackages: ".join (", ", sort @long)."\n";
 	print "suites:  \tSuites: ".join (", ", sort values %suites)."\n";
 	print "components\tComponents: ".join (", ", sort values %components)."\n";
-	my $msg="omitdebsrc\t"._g("Omit deb-src from sources.list for sections:");
+	my $srcmsg="omitdebsrc\t"._g("Omit deb-src from sources.list for sections:");
 	foreach my $omit (sort keys %omitdebsrc) {
-		$msg .= $omitdebsrc{$omit} if (defined $omitdebsrc{$omit});
+		$srcmsg .= $omitdebsrc{$omit} if (defined $omitdebsrc{$omit});
 	}
-	print "$msg\n";
+	print "$srcmsg\n";
 	if (defined $explicit_suite) {
 		printf("explicitsuite:\t"._g("Explicit suite selection: Yes\n"));
 	} else {

Attachment: pgpJmDMP2MGUe.pgp
Description: PGP signature

Reply via email to