#!/usr/bin/perl

=head1 NAME

dh_di_gencontrol - generate and install control file

=cut

use strict;
use warnings;

use Debian::Debhelper::Dh_Lib;
use Debian::Installer;

=head1 SYNOPSIS

B<dh_di_gencontrol> [S<I<debhelper options>>] [S<I<dh_gencontrol options>>]

=head1 DESCRIPTION

Wrappers arround the dh_gencontrol command. It sets the right filename for the
packages depending on the type and strips away a possible .udeb suffix from the
packagename.

=cut

Debian::Installer::di_init ();
my @args = Debian::Installer::packages_args ("deb", @{$dh{DOPACKAGES}});
Debian::Installer::di_doit ("dh_gencontrol", @args) if @args;

foreach my $package (@{$dh{DOPACKAGES}}) {
  next if $Debian::Installer::packages{$package}->{type} ne "udeb";
  @args = ();
  push @args, "-n" . $Debian::Installer::packages{$package}->{filename};
  push @args, "-DPackage=" . $Debian::Installer::packages{$package}->{real_package} if $package ne $Debian::Installer::packages{$package}->{real_package};
  doit ("dh_gencontrol", "-p", $package, "--", @args);
}

=head1 SEE ALSO

L<dh_gencontrol(1)>
L<debhelper(7)>

=head1 AUTHOR

Bastian Blank <waldi@debian.org>

=cut

