Improve the fix for #553599 and generalise it. Handle making a real directory for amd64 to cope with libc6-amd64 [i386].

git-svn-id: http://emdebian.org/svn/current@7752 563faec7-e20c-0410-992a-a66f704d0ccd
This commit is contained in:
codehelp 2011-02-07 12:19:44 +00:00
parent 451dc6920d
commit 8eae53de0f
3 changed files with 52 additions and 43 deletions

4
debian/changelog vendored
View file

@ -4,8 +4,10 @@ multistrap (2.1.11) unstable; urgency=low
use consistent tabs. (Closes: #611808) use consistent tabs. (Closes: #611808)
* Add example for wheezy and use permanent codenames. * Add example for wheezy and use permanent codenames.
* Remove workaround for apt from lenny. * Remove workaround for apt from lenny.
* Improve the fix for #553599 and generalise it. Handle making a real
directory for amd64 to cope with libc6-amd64 [i386].
-- Neil Williams <codehelp@debian.org> Mon, 07 Feb 2011 12:09:55 +0000 -- Neil Williams <codehelp@debian.org> Mon, 07 Feb 2011 12:14:17 +0000
multistrap (2.1.10) experimental; urgency=low multistrap (2.1.10) experimental; urgency=low

View file

@ -193,27 +193,7 @@ if (not -d "${dir}dev") {
mkdir "${dir}dev"; mkdir "${dir}dev";
} }
# prevent the absolute symlink in libc6 from allowing &guard_lib64($dir);
# writes outside the multistrap root dir. See: #553599
if (-l "${dir}lib64" ) {
my $r = readlink "${dir}lib64";
if ($r =~ m:^/:) {
my $old = `pwd`;
chomp ($old);
unlink "${dir}lib64";
chdir ("$dir");
print _g("INF: ./lib64 -> /lib symbolic link reset to ./lib.\n");
symlink "./lib", "lib64";
chdir ("${old}");
}
} else {
my $old = `pwd`;
chomp ($old);
chdir ("$dir");
print _g("INF: Setting ./lib64 -> ./lib symbolic link.\n");
symlink "./lib", "lib64";
chdir ("${old}");
}
system ("rm -rf ${dir}etc/apt/sources.list.d/*"); system ("rm -rf ${dir}etc/apt/sources.list.d/*");
unlink ("${dir}etc/apt/sources.list") unlink ("${dir}etc/apt/sources.list")
@ -378,13 +358,8 @@ system ("$setupsh $dir $arch") if ((defined $setupsh) and (-x $setupsh));
&add_extra_packages; &add_extra_packages;
system ("cp $configsh $dir/") if ((defined $configsh) and (-f $configsh)); system ("cp $configsh $dir/") if ((defined $configsh) and (-f $configsh));
(not defined $tidy) ? system ("apt-get $config_str update") : &tidy_apt; (not defined $tidy) ? system ("apt-get $config_str update") : &tidy_apt;
if (-l "${dir}lib64" ) { &guard_lib64($dir);
my $r = readlink "${dir}lib64";
if ($r =~ m:^/:) {
print _g("ERR: ./lib64 -> /lib symbolic link reset to ./lib after unpacking.\n");
printf (_g("ERR: Some files may have been unpacked outside %s!\n"), $dir);
}
}
# cleanly separate the bootstrap sources from the final apt sources. # cleanly separate the bootstrap sources from the final apt sources.
unlink ("${dir}etc/apt/sources.list.d/multistrap.sources.list") unlink ("${dir}etc/apt/sources.list.d/multistrap.sources.list")
if (-f "${dir}etc/apt/sources.list.d/multistrap.sources.list"); if (-f "${dir}etc/apt/sources.list.d/multistrap.sources.list");
@ -570,19 +545,7 @@ sub force_unpack {
print STATUS "\n"; print STATUS "\n";
close (STATUS); close (STATUS);
system ("rm -rf ./${tmpdir}"); system ("rm -rf ./${tmpdir}");
if (-l "${dir}lib64" ) { &guard_lib64 ($dir);
my $r = readlink "${dir}lib64";
if ($r =~ m:^/:) {
my $old = `pwd`;
chomp ($old);
printf (_g("ERR: lib64 -> ./lib symbolic link clobbered by %s\n"), $pkg);
unlink "${dir}lib64";
chdir ("$dir");
print _g("INF: lib64 -> /lib symbolic link reset to ./lib.\n");
symlink "./lib", "lib64";
chdir ("${old}");
}
}
} }
chdir ("$old"); chdir ("$old");
print _g("I: Unpacking complete.\n"); print _g("I: Unpacking complete.\n");
@ -600,6 +563,30 @@ sub force_unpack {
} }
} }
# prevent the absolute symlink in libc6 from allowing
# writes outside the multistrap root dir. See: #553599
sub guard_lib64 {
my $dir = shift;
my $old = `pwd`;
chomp ($old);
unlink "${dir}lib64" if (-f "${dir}lib64");
if (-l "${dir}lib64" ) {
my $r = readlink "${dir}lib64";
chomp ($r);
unlink "${dir}lib64" if ($r =~ m:^/lib$:);
} elsif (not -d "${dir}lib64") {
chdir ("$dir");
if ($host eq 'i386' and $arch eq 'amd64') {
print _g("INF: Replaced ./lib64 -> /lib symbolic link with new ./lib64 directory.\n");
mkdir ("./lib64");
} else {
print _g("INF: Setting ./lib64 -> ./lib symbolic link.\n");
symlink "./lib", "lib64";
}
}
chdir ("${old}");
}
sub check_bin_sh { sub check_bin_sh {
$dir = shift; $dir = shift;
my $old = `pwd`; my $old = `pwd`;

View file

@ -227,7 +227,7 @@ never actually happen.
listed in this Section. If no keyring is specified, the C<noauth> listed in this Section. If no keyring is specified, the C<noauth>
option must be set to B<true>. See Secure Apt. option must be set to B<true>. See Secure Apt.
'suite' is the suite to use from this source. Note that this B<must> 'suite' is the suite to use from this source. Note that this should
be the suite, not the codename. be the suite, not the codename.
Suites change from time to time: (oldstable, stable, testing, sid) Suites change from time to time: (oldstable, stable, testing, sid)
@ -592,6 +592,26 @@ Files which do not exist or which cannot be opened will be silently
ignored. Check the results of the parsing using the C<--simulate> ignored. Check the results of the parsing using the C<--simulate>
option to C<multistrap>. option to C<multistrap>.
=head1 Hooks
If a hook directory is specified in the General section of the
C<multistrap> configuration file, the hook scripts which are executable
will be run from outside the multistrap directory at the following stages:
A hooks
Executed before unpacking is started
D hooks
Executed immediately before the tarball is created or C<multistrap> exits
if not configured to create a tarball.
Hooks are passed the absolute path to the directory which will be the
top level directory of the chroot or multistrap system. Hooks which
cannot be resolved using realpath or which are not executable will be
ignored.
=head1 Output =head1 Output
C<multistrap> can produce a lot of output - informational messages C<multistrap> can produce a lot of output - informational messages