Fix hook implementation if no hooks in use

git-svn-id: http://emdebian.org/svn/current@7761 563faec7-e20c-0410-992a-a66f704d0ccd
This commit is contained in:
codehelp 2011-02-08 15:59:56 +00:00
parent 9919f96b3d
commit 471a7ba778
2 changed files with 18 additions and 7 deletions

6
debian/changelog vendored
View file

@ -1,3 +1,9 @@
multistrap (2.1.12) unstable; urgency=low
* Fix hook implementation if no hooks in use
-- Neil Williams <codehelp@debian.org> Tue, 08 Feb 2011 15:19:15 +0000
multistrap (2.1.11) unstable; urgency=low multistrap (2.1.11) unstable; urgency=low
* Fix examples in comments within device_table.txt to * Fix examples in comments within device_table.txt to

View file

@ -355,7 +355,7 @@ die (sprintf (_g("apt download failed. Exit value: %d\n"),($retval/256)))
system ("touch ${dir}${libdir}lists/lock"); system ("touch ${dir}${libdir}lists/lock");
system ("$setupsh $dir $arch") if ((defined $setupsh) and (-x $setupsh)); system ("$setupsh $dir $arch") if ((defined $setupsh) and (-x $setupsh));
# run first set of hooks # run first set of hooks
&run_download_hooks(sort @{$hooks{'D'}}); &run_download_hooks(sort @{$hooks{'D'}}) if (defined $hooks{'D'});
&native if (not defined ($foreign) and $unpack eq "true"); &native if (not defined ($foreign) and $unpack eq "true");
&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));
@ -396,7 +396,7 @@ foreach my $aptsrc (@aptsources) {
# altered the sources, so get apt to update. # altered the sources, so get apt to update.
(not defined $tidy) ? system ("apt-get $config_str update") : &tidy_apt; (not defined $tidy) ? system ("apt-get $config_str update") : &tidy_apt;
# run second set of hooks # run second set of hooks
&run_completion_hooks(sort @{$hooks{'A'}}); &run_completion_hooks(sort @{$hooks{'A'}}) if (defined ($hooks{'A'}));
printf (_g("\nMultistrap system installed successfully in %s.\n"), $dir); printf (_g("\nMultistrap system installed successfully in %s.\n"), $dir);
if (defined $tgzname) { if (defined $tgzname) {
printf (_g("\nCompressing multistrap system in '%s' to a tarball called: '%s'.\n"), $dir, $tgzname); printf (_g("\nCompressing multistrap system in '%s' to a tarball called: '%s'.\n"), $dir, $tgzname);
@ -621,12 +621,17 @@ sub guard_lib64 {
if (-l "${dir}lib64" ) { if (-l "${dir}lib64" ) {
my $r = readlink "${dir}lib64"; my $r = readlink "${dir}lib64";
chomp ($r); chomp ($r);
unlink "${dir}lib64" if ($r =~ m:^/lib$:); if ($r =~ m:^/lib$:) {
print _g("I: Unlinking unsafe ${dir}lib64 -> /lib symbolic link.\n");
unlink "${dir}lib64";
} else {
print _g("I: Keeping the ${dir}lib64 -> ${dir}lib symbolic link.\n");
}
} elsif (not -d "${dir}lib64") { } elsif (not -d "${dir}lib64") {
chdir ("$dir"); chdir ("$dir");
if ($host eq 'i386' and $arch eq 'amd64') { if ($host eq 'i386' and $arch eq 'amd64') {
print _g("I: Replaced ./lib64 -> /lib symbolic link with new ./lib64 directory.\n"); print _g("I: Replaced ./lib64 -> /lib symbolic link with new ${dir}lib64 directory.\n");
mkdir ("./lib64"); mkdir ("${dir}lib64");
} else { } else {
print _g("I: Setting ./lib64 -> ./lib symbolic link.\n"); print _g("I: Setting ./lib64 -> ./lib symbolic link.\n");
symlink "./lib", "lib64"; symlink "./lib", "lib64";
@ -742,7 +747,7 @@ sub native {
system ("$str $env chroot $dir debconf-set-selections /tmp/preseeds/$s"); system ("$str $env chroot $dir debconf-set-selections /tmp/preseeds/$s");
} }
} }
&run_native_hooks_start(sort @{$hooks{'N'}}); &run_native_hooks_start(sort @{$hooks{'N'}}) if (defined ($hooks{'N'}));
opendir (PRI, "${dir}/var/lib/dpkg/info") or return; opendir (PRI, "${dir}/var/lib/dpkg/info") or return;
my @preinsts=grep(/\.preinst$/, readdir PRI); my @preinsts=grep(/\.preinst$/, readdir PRI);
closedir (PRI); closedir (PRI);
@ -760,7 +765,7 @@ sub native {
foreach my $reinst (sort @reinstall) { foreach my $reinst (sort @reinstall) {
system ("$str $env chroot $dir apt-get --reinstall -y install $reinst"); system ("$str $env chroot $dir apt-get --reinstall -y install $reinst");
} }
&run_native_hooks_end(sort @{$hooks{'N'}}); &run_native_hooks_end(sort @{$hooks{'N'}}) if (defined $hooks{'N'});
} }
sub get_required_debs { sub get_required_debs {