* Add support for compressing the filesystem into a tarball. * Add support for reinstalling packages known to fail due to preinst problems.

git-svn-id: http://emdebian.org/svn/current@7118 563faec7-e20c-0410-992a-a66f704d0ccd
This commit is contained in:
codehelp 2010-04-20 17:15:15 +00:00
parent e539d3965c
commit 2cda5f4cc1
2 changed files with 43 additions and 3 deletions

5
debian/changelog vendored
View file

@ -6,8 +6,11 @@ multistrap (2.1.2) experimental; urgency=low
* fix handling of omitrequired and configsh when empty * fix handling of omitrequired and configsh when empty
* add force-yes when using noauth * add force-yes when using noauth
* split the package list even if using only spaces, not commas * split the package list even if using only spaces, not commas
* Add support for compressing the filesystem into a tarball.
* Add support for reinstalling packages known to fail due to preinst
problems.
-- Neil Williams <codehelp@debian.org> Tue, 20 Apr 2010 16:46:49 +0100 -- Neil Williams <codehelp@debian.org> Tue, 20 Apr 2010 18:14:51 +0100
multistrap (2.1.1) experimental; urgency=low multistrap (2.1.1) experimental; urgency=low

View file

@ -31,7 +31,7 @@ use vars qw/ $progname $ourversion $dstrap $extra @aptsources $mirror
$component $repo @dirs @touch %sources $section %keys $host $key $value $component $repo @dirs @touch %sources $section %keys $host $key $value
$type $file $config $tidy $noauth $keyring %keyrings $deflist $cfgdir $type $file $config $tidy $noauth $keyring %keyrings $deflist $cfgdir
@extrapkgs @includes %source $setupsh $configsh $omitrequired $dryrun @extrapkgs @includes %source $setupsh $configsh $omitrequired $dryrun
$omitpreinst /; $omitpreinst @reinstall $tgzname /;
setlocale(LC_MESSAGES, ""); setlocale(LC_MESSAGES, "");
textdomain("multistrap"); textdomain("multistrap");
@ -382,11 +382,26 @@ END
} }
} }
if (defined $tgzname)
{
printf (_g("\nCompressing multistrap system in '%s' to a tarball called: '%s'.\n"), $dir, $tgzname);
chdir ("$dir");
unlink $tgzname if (-f $tgzname);
my $retval = system ("tar -czf ../$tgzname .");
$retval /= 256;
if ($retval == 0)
{
printf (_g("\nRemoving build directory: '%s'\n\n"), $dir);
system ("rm -rf $dir/*");
}
printf (_g("\nMultistrap system packaged successfully as %s.\n\n"), $tgzname);
}
exit 0; exit 0;
sub our_version { sub our_version {
my $query = `dpkg-query -W -f='\${Version}' multistrap`; my $query = `dpkg-query -W -f='\${Version}' multistrap`;
(defined $query) ? return $query : return "0.0.9"; (defined $query) ? return $query : return "2.1.1";
} }
sub add_extra_packages sub add_extra_packages
@ -655,11 +670,20 @@ sub native
my @preinsts=grep(/\.preinst$/, readdir PRI); my @preinsts=grep(/\.preinst$/, readdir PRI);
closedir (PRI); closedir (PRI);
printf (_g("I: Running preinst scripts with 'upgrade' argument.\n")); printf (_g("I: Running preinst scripts with 'upgrade' argument.\n"));
my $f = join (" ", @reinstall);
foreach my $script (sort @preinsts) foreach my $script (sort @preinsts)
{ {
my $t = $script;
$t =~ s/\.preinst//;
next if ($t =~ /$f/);
next if ($script =~ /bash/); next if ($script =~ /bash/);
system ("$str $env chroot $dir /var/lib/dpkg/info/$script upgrade"); system ("$str $env chroot $dir /var/lib/dpkg/info/$script upgrade");
} }
# reinstall set
foreach my $reinst (sort @reinstall)
{
system ("$str $env chroot $dir apt-get --reinstall -y install $reinst");
}
} }
sub get_required_debs sub get_required_debs
@ -826,6 +850,9 @@ sub cascade
$configsh = lc($keys{$section}{'configscript'}) $configsh = lc($keys{$section}{'configscript'})
if (defined $keys{$section}{'configscript'} if (defined $keys{$section}{'configscript'}
and (not defined $configsh)); and (not defined $configsh));
$tgzname = lc($keys{$section}{'tarballname'})
if (defined $keys{$section}{'tarballname'}
and (not defined $tgzname));
undef $configsh if ((defined $configsh) and (-x $configsh)); undef $configsh if ((defined $configsh) and (-x $configsh));
$setupsh = lc($keys{$section}{'setupscript'}) $setupsh = lc($keys{$section}{'setupscript'})
if (defined $keys{$section}{'setupscript'} if (defined $keys{$section}{'setupscript'}
@ -862,6 +889,7 @@ sub cascade
if (not exists $suites{$section}); if (not exists $suites{$section});
$components{$section}=$keys{$section}{'components'} $components{$section}=$keys{$section}{'components'}
if (not exists $components{$section}); if (not exists $components{$section});
push @reinstall, split (/ /, lc($keys{$section}{'reinstall'}));
if (not defined $components{$section}) if (not defined $components{$section})
{ {
$components{$section}='main'; $components{$section}='main';
@ -871,6 +899,13 @@ sub cascade
push @extrapkgs, split (' ', lc($keys{$section}{'additional'})); push @extrapkgs, split (' ', lc($keys{$section}{'additional'}));
} }
} }
my %uniq=();
foreach my $listing (@reinstall)
{
$uniq{$listing}++;
}
@reinstall=();
@reinstall=sort keys %uniq;
} }
sub _g { sub _g {
@ -887,6 +922,8 @@ sub dump_config {
print "Components: ".join (", ", sort values %components)."\n"; print "Components: ".join (", ", sort values %components)."\n";
print "Extra Packages: ".join (", ", sort @extrapkgs)."\n" print "Extra Packages: ".join (", ", sort @extrapkgs)."\n"
if (scalar @extrapkgs > 0); if (scalar @extrapkgs > 0);
print "reinstall: ".join (", ", sort (@reinstall))."\n"
if (scalar @reinstall > 0);
print "arch: $arch\n"; print "arch: $arch\n";
print "dir: $dir\n"; print "dir: $dir\n";
print "unpack: $unpack\n" if (defined $unpack); print "unpack: $unpack\n" if (defined $unpack);