From 5ff942d4fe056b7b3b256dd0f779e56e643fba8e Mon Sep 17 00:00:00 2001 From: freesource Date: Thu, 23 Aug 2001 17:02:05 +0000 Subject: [PATCH] Now makes the diversions file .. this is cool. --- yard/scripts/make_debian | 42 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/yard/scripts/make_debian b/yard/scripts/make_debian index e9bc2e1..b2e50ab 100755 --- a/yard/scripts/make_debian +++ b/yard/scripts/make_debian @@ -1,6 +1,6 @@ #!/usr/bin/perl -# make_debian from gBootRoot Copyright (C) 2000, 2001 +# make_debian Copyright (C) 2001 from gBootRoot # Lead Developer and Project Coordinator # Jonathan Rosenbaum # @@ -151,6 +151,8 @@ close(MY_FILERC); sub stuff { $stuff = << "STUFF"; +# Generated by make_debian. + # This template creates a complete Debian system which is more streamlined # than the base.tgz used for normal installations. Once everything is made, # you can use user-mode-linux to tweak the system, as well as apt. @@ -304,7 +306,8 @@ return $stuff; # Conffiles would have to be handled both before and after Root Filesystem # creation so that their md5sums could be accounted for in status. # -# And this finds all the scripts associated with a package in info/*. +# And this finds all the scripts associated with a package in info/*, +# creates an empty available file, and creates the diversions file. sub status_info { @@ -331,12 +334,46 @@ close(NEW_STATUS); close(STATUS); $/ = "\n"; +my %dpkg_divert = []; +my $dpkg_divert = "dpkg-divert --list|"; +open(DIVERT,"$dpkg_divert") + or die "Couldn't find the dpkg-divert command: $!\n"; +while () { + + my($original,$diversion,$package) = (split(" "))[2,4,6]; + chomp $package; + if (!$dpkg_divert{$package}) { # Just add to the array + $dpkg_divert{$package} = [$original,$diversion]; + } + else { + push @{ $dpkg_divert {$package} }, $original, $diversion; + } + +} +close(DIVERT); + +open(DIVERT,">$home_yard_replacements/var/lib/dpkg/diversions") + or die "Couldn't open Replacements/var/lib/dpkg/diversions: $!\n"; my @info; foreach my $rp (@required_packages) { $rp = (split(/_/,$rp))[0]; # Get rid of the escapes from the previous invocation. $rp =~ s/\\//g if $rp =~ /\\+/g; + my $count = 0; my @divert; + if ($dpkg_divert{$rp}) { + foreach my $dv ( @{ $dpkg_divert{$rp} } ) { + push(@divert,$dv); + if ($count == 1) { + print DIVERT "$divert[0]\n"; + print DIVERT "$divert[1]\n"; + print DIVERT "$rp\n"; + $count = -1; undef @divert; + } + $count++; + } + } + # Figure out info/* .. this covers it for now. if (-f "$info/$rp.preinst") { push(@info,"$info/$rp.preinst\n"); @@ -366,6 +403,7 @@ foreach my $rp (@required_packages) { push(@info,"$info/$rp.config\n"); } } +close(DIVERT); return @info;