]> git.donarmstrong.com Git - debhelper.git/blob - dh_installcron
r1596: * Remove duplicate packages from DOPACKAGES after argument processing.
[debhelper.git] / dh_installcron
1 #!/usr/bin/perl -w
2
3 =head1 NAME
4
5 dh_installcron - install cron scripts into etc/cron.*
6
7 =cut
8
9 use strict;
10 use Debian::Debhelper::Dh_Lib;
11
12 =head1 SYNOPSIS
13
14 B<dh_installcron> [S<B<debhelper options>>] [B<--name=>I<name>]
15
16 =head1 DESCRIPTION
17
18 dh_installcron is a debhelper program that is responsible for installing
19 cron scripts into etc/cron.*/ in package build directories. The files
20 debian/package.cron.daily, debian/package.cron.weekly,
21 debian/package.cron.monthly, and debian/package.cron.d are installed.
22
23 =head1 OPTIONS
24
25 =over 4
26
27 =item B<--name=>I<name>
28
29 Look for files named debian/package.name.cron.* and install them as
30 etc/cron.*/name, instead of using the usual files and installing them
31 as the package name.
32
33 =back
34
35 =cut
36
37 init();
38
39 foreach my $package (@{$dh{DOPACKAGES}}) {
40         my $tmp=tmpdir($package);
41         foreach my $type (qw{daily weekly monthly}) {
42                 my $cron=pkgfile($package,"cron.$type");
43                 if ($cron) {
44                         if (! -d "$tmp/etc/cron.$type") {
45                                 doit("install","-o",0,"-g",0,"-d","$tmp/etc/cron.$type");
46                         }
47                         doit("install",$cron,"$tmp/etc/cron.$type/".pkgfilename($package));
48                 }
49         }
50         # Seperate because this needs to be mode 644.
51         my $cron=pkgfile($package,"cron.d");
52         if ($cron) {
53                 if (! -d "$tmp/etc/cron.d") {
54                         doit("install","-o",0,"-g",0,"-d","$tmp/etc/cron.d");
55                 }       
56                 doit("install","-m",644,$cron,"$tmp/etc/cron.d/".pkgfilename($package));
57         }
58 }
59
60 =head1 SEE ALSO
61
62 L<debhelper(7)>
63
64 This program is a part of debhelper.
65
66 =head1 AUTHOR
67
68 Joey Hess <joeyh@debian.org>
69
70 =cut