From 8eae53de0f2d11a664cf71412bc6354e6fa6b2ff Mon Sep 17 00:00:00 2001 From: codehelp Date: Mon, 7 Feb 2011 12:19:44 +0000 Subject: [PATCH] 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 --- debian/changelog | 4 ++- multistrap | 69 ++++++++++++++++++++---------------------------- pod/multistrap | 22 ++++++++++++++- 3 files changed, 52 insertions(+), 43 deletions(-) diff --git a/debian/changelog b/debian/changelog index 3c682ea..33bbcae 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,8 +4,10 @@ multistrap (2.1.11) unstable; urgency=low use consistent tabs. (Closes: #611808) * Add example for wheezy and use permanent codenames. * 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 Mon, 07 Feb 2011 12:09:55 +0000 + -- Neil Williams Mon, 07 Feb 2011 12:14:17 +0000 multistrap (2.1.10) experimental; urgency=low diff --git a/multistrap b/multistrap index 6157c9f..057e1cc 100755 --- a/multistrap +++ b/multistrap @@ -193,27 +193,7 @@ if (not -d "${dir}dev") { mkdir "${dir}dev"; } -# prevent the absolute symlink in libc6 from allowing -# 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}"); -} +&guard_lib64($dir); system ("rm -rf ${dir}etc/apt/sources.list.d/*"); unlink ("${dir}etc/apt/sources.list") @@ -378,13 +358,8 @@ system ("$setupsh $dir $arch") if ((defined $setupsh) and (-x $setupsh)); &add_extra_packages; system ("cp $configsh $dir/") if ((defined $configsh) and (-f $configsh)); (not defined $tidy) ? system ("apt-get $config_str update") : &tidy_apt; -if (-l "${dir}lib64" ) { - 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); - } -} +&guard_lib64($dir); + # cleanly separate the bootstrap sources from the final apt sources. unlink ("${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"; close (STATUS); system ("rm -rf ./${tmpdir}"); - if (-l "${dir}lib64" ) { - 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}"); - } - } + &guard_lib64 ($dir); } chdir ("$old"); 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 { $dir = shift; my $old = `pwd`; diff --git a/pod/multistrap b/pod/multistrap index 4600dff..4dfb278 100644 --- a/pod/multistrap +++ b/pod/multistrap @@ -227,7 +227,7 @@ never actually happen. listed in this Section. If no keyring is specified, the C option must be set to B. See Secure Apt. -'suite' is the suite to use from this source. Note that this B +'suite' is the suite to use from this source. Note that this should be the suite, not the codename. 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> option to C. +=head1 Hooks + +If a hook directory is specified in the General section of the +C 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 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 C can produce a lot of output - informational messages