]> git.donarmstrong.com Git - debhelper.git/blob - dh_installemacsen
r496: * Man page cleanups, Closes: #119335
[debhelper.git] / dh_installemacsen
1 #!/usr/bin/perl -w
2
3 =head1 NAME
4
5 dh_installemacsen - register an emacs add on package
6
7 =cut
8
9 use strict;
10 use Debian::Debhelper::Dh_Lib;
11
12 =head1 SYNOPSIS
13
14 B<dh_installemacsen> [S<I<debhelper options>>] [B<-n>] [B<--priority=>I<n>] [B<--flavor=>I<foo>]
15
16 =head1 DESCRIPTION
17
18 dh_installemacsen is a debhelper program that is responsible for installing
19 files used by the debian emacsen-common package into package build
20 directories.
21
22 It also automatically generates the postinst and prerm commands needed to
23 register a package as an emacs add on package. See L<dh_installdeb(1)>
24 for an explanation of how this works.
25
26 If a file named debian/package.emacsen-install exists, then it is installed
27 into
28 usr/lib/emacsen-common/packages/install/package in the package build
29 directory. Similarly, debian/package.emacsen-remove is installed into
30 usr/lib/emacsen-common/packages/remove/package . And similarly,
31 debian/package.emacsen-startup is installed into
32 etc/emacs/site-start.d/50<package>.el (by default).
33
34 =head1 OPTIONS
35
36 =over 4
37
38 =item B<-n>, B<--noscripts>
39
40 Do not modify postinst/prerm scripts.
41
42 =item B<--priority=>I<n>
43
44 Sets the priority number of a site-start.d file. Default is 50.
45
46 =item B<--flavor=>I<foo>
47
48 Sets the flavor a site-start.d file will be installed in. Default is
49 "emacs", alternatives include "xemacs" and "emacs20".
50
51 =back
52
53 =head1 NOTES
54
55 Note that this command is not idempotent. "dh_clean -k" should be called
56 between invocations of this command. Otherwise, it may cause multiple
57 instances of the same text to be added to maintainer scripts.
58
59 =cut
60
61 init();
62
63 if (! defined $dh{PRIORITY}) {
64         $dh{PRIORITY}=50;
65 }
66 if (! defined $dh{FLAVOR}) {
67         $dh{FLAVOR}='emacs';
68 }
69
70 foreach my $package (@{$dh{DOPACKAGES}}) {
71         my $tmp=tmpdir($package);
72
73         my $emacsen_install=pkgfile($package,"emacsen-install");
74         my $emacsen_remove=pkgfile($package,"emacsen-remove");
75         my $emacsen_startup=pkgfile($package,"emacsen-startup");
76
77         if ($emacsen_install ne '') {
78                 if (! -d "$tmp/usr/lib/emacsen-common/packages/install") {
79                         doit("install","-d","$tmp/usr/lib/emacsen-common/packages/install");
80                 }
81                 doit("install","-m0755",$emacsen_install,"$tmp/usr/lib/emacsen-common/packages/install/$package");
82         }
83
84         if ($emacsen_remove ne '') {
85                 if (! -d "$tmp/usr/lib/emacsen-common/packages/remove") {
86                         doit("install","-d","$tmp/usr/lib/emacsen-common/packages/remove");
87                 }
88                 doit("install","-m0755","$emacsen_remove","$tmp/usr/lib/emacsen-common/packages/remove/$package");
89         }
90         
91         if ($emacsen_startup ne '') {
92                 if (! -d "$tmp/etc/$dh{FLAVOR}/site-start.d/") {
93                         doit("install","-d","$tmp/etc/$dh{FLAVOR}/site-start.d/");
94                 }
95                 doit("install","-m0644",$emacsen_startup,"$tmp/etc/$dh{FLAVOR}/site-start.d/$dh{PRIORITY}$package.el");
96         }
97
98         if ($emacsen_install ne '' || $emacsen_remove ne '') {
99                 if (! $dh{NOSCRIPTS}) {
100                         autoscript($package,"postinst","postinst-emacsen",
101                                 "s/#PACKAGE#/$package/");
102                         autoscript($package,"prerm","prerm-emacsen",
103                                 "s/#PACKAGE#/$package/");
104                 }
105         }
106 }
107
108 =head1 SEE ALSO
109
110 L<debhelper(1)>
111
112 This program is a part of debhelper.
113
114 =head1 AUTHOR
115
116 Joey Hess <joeyh@debian.org>
117
118 =cut