~peter-pearse/ubuntu/oneiric/at/prop001

« back to all changes in this revision

Viewing changes to debian/preinst

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2005-11-09 12:57:45 UTC
  • Revision ID: james.westby@ubuntu.com-20051109125745-64eslxy1v1jjm2gm
Tags: 3.1.9ubuntu1
* Merge to new Debian version.
* Derooting patch was accepted in Debian; manually reapply remaining Ubuntu
  changes to the clean Debian version (see below).
* debian/control: Only recommend mail-transport-agent and prefer postfix.
* debian/rc: LSB init script.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/perl --
2
 
 
3
 
system("/etc/init.d/atd stop") if -x "/etc/init.d/atd";
4
 
$etc='/etc';
5
 
$seqfile='/var/spool/cron/atjobs/.SEQ';
6
 
 
7
 
$re='\*[^\s]*\s+(\*\s+){3}(\*|\d+)\s+root\s+atrun\s';
8
 
 
9
 
open(OI,"$etc/crontab") || exit 0;
10
 
open(NI,">$etc/crontab.prermnew") || die "Creating new crontab: $!\n";
11
 
while(<OI>) {
12
 
    if (m/^$re/o) { $mod++; next; }
13
 
    print NI || die "Writing new crontab: $!\n";
14
 
}
15
 
close(NI) || die "Closing new crontab: $!\n";
16
 
if ($mod) {
17
 
    rename("$etc/crontab.prermnew","$etc/crontab") ||
18
 
        die "Installing new crontab: $!\n"; # 
19
 
} else {
20
 
    unlink("$etc/crontab.prermnew") || die "Aborting new crontab: $!\n";
21
 
}
22
 
 
23
 
# Save the old sequence number, if it's there...
24
 
rename($seqfile, $seqfile . "-old");
25
 
exit 0;