From 548cb09e0a71603361d4bc2b2417bfd30396d800 Mon Sep 17 00:00:00 2001 From: codehelp Date: Fri, 28 May 2010 21:08:00 +0000 Subject: [PATCH] Handle fakeroot with native architectures. git-svn-id: http://emdebian.org/svn/current@7238 563faec7-e20c-0410-992a-a66f704d0ccd --- debian/changelog | 3 +- debian/control | 2 +- multistrap | 85 +++++++++++++++++++++--------------------------- pod/multistrap | 17 ++++++++++ 4 files changed, 57 insertions(+), 50 deletions(-) diff --git a/debian/changelog b/debian/changelog index 4319569..452c4ba 100644 --- a/debian/changelog +++ b/debian/changelog @@ -11,8 +11,9 @@ multistrap (2.1.5) unstable; urgency=low default, usable by selecting explicitsuite to true. * When moving downloaded packages to a sourcedir, also download the source packages for GPL compliance. + * Handle fakeroot with native architectures. - -- Neil Williams Thu, 27 May 2010 16:59:13 +0100 + -- Neil Williams Fri, 28 May 2010 22:07:18 +0100 multistrap (2.1.4) unstable; urgency=low diff --git a/debian/control b/debian/control index afd63ab..7a62720 100644 --- a/debian/control +++ b/debian/control @@ -15,7 +15,7 @@ Section: admin Architecture: all Depends: ${perl:Depends}, ${misc:Depends}, apt, realpath, libconfig-auto-perl, libparse-debian-packages-perl -Recommends: emdebian-archive-keyring +Recommends: emdebian-archive-keyring, fakeroot | sudo Replaces: emdebian-rootfs (<= 2.0.9) Conflicts: emdebian-rootfs (<= 2.0.9) Provides: emdebian-rootfs diff --git a/multistrap b/multistrap index 96d0d54..3611a76 100755 --- a/multistrap +++ b/multistrap @@ -284,10 +284,14 @@ foreach my $pkg (values %keyrings) if (defined $k) { my $e=`LC_ALL=C printenv`; - my $str = ($e =~ /\nUSER=root\n/) ? "" : "sudo "; - $str = (-f "/usr/bin/sudo") ? "$str" : ""; - printf (_g("I: Installing %s\n"), $k); - system ("$str apt-get install $k"); + if ($e !~ /\nFAKEROOTKEY=[0-9]+\n/) { + my $str = ""; + 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"); + } } $config_str = ''; @@ -695,14 +699,20 @@ sub tidy_apt # if native arch, do a few tasks just because we can and probably should. sub native { - print _g("I: Native mode - configuring unpacked packages . . .\n"); my $e=`LC_ALL=C printenv`; - my $str = ($e =~ /\nUSER=root\n/) ? "" : "sudo"; - $str = (-f "/usr/bin/sudo") ? "$str" : ""; my $env = "DEBIAN_FRONTEND=noninteractive ". "DEBCONF_NONINTERACTIVE_SEEN=true ". "LC_ALL=C LANGUAGE=C LANG=C"; printf (_g("I: dpkg configuration settings:\n\t%s\n"), $env); + if ($e =~ /\nFAKEROOTKEY=[0-9]+\n/) { + warn ("W: Cannot use 'chroot' when fakeroot is in use. Skipping package configuration.\n"); + return; + } + print _g("I: Native mode - configuring unpacked packages . . .\n"); + my $str = ""; + if ($e =~ /\nUSER=root\n/) { + $str = "sudo" if (-f "/usr/bin/sudo"); + } # check that we have a workable shell inside the chroot &check_bin_sh("$dir"); system ("$str $env chroot $dir dpkg --configure -a"); @@ -873,42 +883,30 @@ sub cascade if ($section eq "general") { $arch = $keys{$section}{'arch'} - if (defined $keys{$section}{'arch'} - and (not defined $arch)); + if (defined $keys{$section}{'arch'} and (not defined $arch)); $dir = $keys{$section}{'directory'} - if (defined $keys{$section}{'directory'} - and (not defined $dir)); + if (defined $keys{$section}{'directory'} and (not defined $dir)); # support the original value but replace by new value. $unpack = lc($keys{$section}{'unpack'}) - if (defined $keys{$section}{'forceunpack'} - and (not defined $unpack)); + if (defined $keys{$section}{'forceunpack'} and (not defined $unpack)); $unpack = lc($keys{$section}{'unpack'}) - if (defined $keys{$section}{'unpack'} - and (not defined $unpack)); + if (defined $keys{$section}{'unpack'} and (not defined $unpack)); $configsh = lc($keys{$section}{'configscript'}) - if (defined $keys{$section}{'configscript'} - and (not defined $configsh)); + if (defined $keys{$section}{'configscript'} and (not defined $configsh)); $tgzname = lc($keys{$section}{'tarballname'}) - if (defined $keys{$section}{'tarballname'} - and (not defined $tgzname)); + if (defined $keys{$section}{'tarballname'} and (not defined $tgzname)); undef $configsh if ((defined $configsh) and (not -x $configsh)); $setupsh = lc($keys{$section}{'setupscript'}) - if (defined $keys{$section}{'setupscript'} - and (not defined $setupsh)); + if (defined $keys{$section}{'setupscript'} and (not defined $setupsh)); undef $setupsh if ((defined $setupsh) and (not -x $setupsh)); $omitrequired = lc($keys{$section}{'omitrequired'}) - if (defined $keys{$section}{'omitrequired'} - and (not defined $omitrequired)); + if (defined $keys{$section}{'omitrequired'} and (not defined $omitrequired)); $omitpreinst = lc($keys{$section}{'omitpreinst'}) - if (defined $keys{$section}{'omitpreinst'} - and (not defined $omitpreinst)); - $tidy++ if ((defined $keys{$section}{'cleanup'}) and - ($keys{$section}{'cleanup'} eq "true")); - $noauth++ if ((defined $keys{$section}{'noauth'}) and - ($keys{$section}{'noauth'} eq "true")); - $sourcedir = $keys{$section}{'retainsources'} if - ((defined $keys{$section}{'retainsources'}) and - (-d $keys{$section}{'retainsources'})); + if (defined $keys{$section}{'omitpreinst'} and (not defined $omitpreinst)); + $tidy++ if ((defined $keys{$section}{'cleanup'}) and ($keys{$section}{'cleanup'} eq "true")); + $noauth++ if ((defined $keys{$section}{'noauth'}) and ($keys{$section}{'noauth'} eq "true")); + $sourcedir = $keys{$section}{'retainsources'} + if ((defined $keys{$section}{'retainsources'}) and (-d $keys{$section}{'retainsources'})); $explicit_suite++ if ((defined $keys{$section}{'explicitsuite'}) and ($keys{$section}{'explicitsuite'} eq "true")); $allow_recommends++ if ((defined $keys{$section}{'allowrecommends'}) and @@ -924,23 +922,14 @@ sub cascade } else { - $sources{$section}=$keys{$section}{'source'} - if (not exists $source{$section}); - $packages{$section}=$keys{$section}{'packages'} - if (not exists $packages{$section}); - $suites{$section}=$keys{$section}{'suite'} - if (not exists $suites{$section}); - $components{$section}=$keys{$section}{'components'} - if (not exists $components{$section}); - $omitdebsrc{$section}=$keys{$section}{'omitdebsrc'} - if (not exists $omitdebsrc{$section}); + $sources{$section}=$keys{$section}{'source'} if (not exists $source{$section}); + $packages{$section}=$keys{$section}{'packages'} if (not exists $packages{$section}); + $suites{$section}=$keys{$section}{'suite'} if (not exists $suites{$section}); + $components{$section}=$keys{$section}{'components'} if (not exists $components{$section}); + $omitdebsrc{$section}=$keys{$section}{'omitdebsrc'} if (not exists $omitdebsrc{$section}); push @reinstall, split (/ /, lc($keys{$section}{'reinstall'})); - if (not defined $components{$section}) - { - $components{$section}='main'; - } - $keyrings{$section}=$keys{$section}{'keyring'} - if (not exists $keyrings{$section}); + $components{$section}='main' if (not defined $components{$section}); + $keyrings{$section}=$keys{$section}{'keyring'} if (not exists $keyrings{$section}); push @extrapkgs, split (' ', lc($keys{$section}{'additional'})); } } diff --git a/pod/multistrap b/pod/multistrap index 45bda15..0d08454 100644 --- a/pod/multistrap +++ b/pod/multistrap @@ -437,3 +437,20 @@ apt-cache size), use the omitdebsrc field in each Section. omitdebsrc=true =cut + +=head1 fakeroot + +Foreign architecture bootstraps can operate under C (C +is designed to do as much as it can within a single call to make this +easier) but the configuration stage which normally happens with a native +architecture bootstrap requires C and C itself will +not operate under C. + +Therefore, if C detects that C is in use, native +mode configuration is skipped with a reminder warning. + +The same problem applies to C and therefore the +installation of the keyring package on the host system is also skipped +if fakeroot is detected. + +=cut