summaryrefslogtreecommitdiff
path: root/dh_installcron
blob: 0ebb4b56604b01baeffc36c16e5fb16e39e8535c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/perl -w
#
# Install cron scripts into the appropriate places.

use strict;
use Debian::Debhelper::Dh_Lib;
init();

foreach my $package (@{$dh{DOPACKAGES}}) {
	my $tmp=tmpdir($package);
	foreach my $type (qw{daily weekly monthly}) {
		my $cron=pkgfile($package,"cron.$type");
		if ($cron) {
			if (! -d "$tmp/etc/cron.$type") {
				doit("install","-o",0,"-g",0,"-d","$tmp/etc/cron.$type");
			}
			doit("install",$cron,"$tmp/etc/cron.$type/$package");
		}
	}
	# Seperate because this needs to be mode 644.
	my $cron=pkgfile($package,"cron.d");
	if ($cron) {
		if (! -d "$tmp/etc/cron.d") {
			doit("install","-o",0,"-g",0,"-d","$tmp/etc/cron.d");
		}	
		doit("install","-m",644,$cron,"$tmp/etc/cron.d/$package");
	}
}