]> git.donarmstrong.com Git - debhelper.git/blob - dh_installcron
r1676:
[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, debian/package.cron.hourly, and
22 debian/package.cron.d are installed.
23
24 =head1 OPTIONS
25
26 =over 4
27
28 =item B<--name=>I<name>
29
30 Look for files named debian/package.name.cron.* and install them as
31 etc/cron.*/name, instead of using the usual files and installing them
32 as the package name.
33
34 =back
35
36 =cut
37
38 init();
39
40 foreach my $package (@{$dh{DOPACKAGES}}) {
41         my $tmp=tmpdir($package);
42         foreach my $type (qw{hourly daily weekly monthly}) {
43                 my $cron=pkgfile($package,"cron.$type");
44                 if ($cron) {
45                         if (! -d "$tmp/etc/cron.$type") {
46                                 doit("install","-o",0,"-g",0,"-d","$tmp/etc/cron.$type");
47                         }
48                         doit("install",$cron,"$tmp/etc/cron.$type/".pkgfilename($package));
49                 }
50         }
51         # Seperate because this needs to be mode 644.
52         my $cron=pkgfile($package,"cron.d");
53         if ($cron) {
54                 if (! -d "$tmp/etc/cron.d") {
55                         doit("install","-o",0,"-g",0,"-d","$tmp/etc/cron.d");
56                 }       
57                 doit("install","-m",644,$cron,"$tmp/etc/cron.d/".pkgfilename($package));
58         }
59 }
60
61 =head1 SEE ALSO
62
63 L<debhelper(7)>
64
65 This program is a part of debhelper.
66
67 =head1 AUTHOR
68
69 Joey Hess <joeyh@debian.org>
70
71 =cut