Browse Source

Now makes the diversions file .. this is cool.

master
freesource 24 years ago
parent
commit
5ff942d4fe
  1. 42
      yard/scripts/make_debian

42
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 <freesource@users.sourceforge.net>
#
@ -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 (<DIVERT>) {
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;

Loading…
Cancel
Save