]> git.donarmstrong.com Git - debhelper.git/blob - dh_installemacsen
Typo. Closes: #653339
[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 B<dh_installemacsen> is a debhelper program that is responsible for installing
19 files used by the Debian B<emacsen-common> package into package build
20 directories.
21
22 It also automatically generates the F<postinst> and F<prerm> commands needed to
23 register a package as an Emacs add on package. The commands are added to
24 the maintainer scripts by B<dh_installdeb>. See L<dh_installdeb(1)>
25 for an explanation of how this works.
26
27 =head1 FILES
28
29 =over 4
30
31 =item debian/I<package>.emacsen-install
32
33 Installed into F<usr/lib/emacsen-common/packages/install/package> in the
34 package build directory.
35
36 =item debian/I<package>.emacsen-remove
37
38 Installed into F<usr/lib/emacsen-common/packages/remove/package> in the
39 package build directory.
40
41 =item debian/I<package>.emacsen-startup
42
43 Installed into etc/emacs/site-start.d/50I<package>.el in the package
44 build directory. Use B<--priority> to use a different priority than 50.
45
46 =back
47
48 =head1 OPTIONS
49
50 =over 4
51
52 =item B<-n>, B<--noscripts>
53
54 Do not modify F<postinst>/F<prerm> scripts.
55
56 =item B<--priority=>I<n>
57
58 Sets the priority number of a F<site-start.d> file. Default is 50.
59
60 =item B<--flavor=>I<foo>
61
62 Sets the flavor a F<site-start.d> file will be installed in. Default is
63 B<emacs>, alternatives include B<xemacs> and B<emacs20>.
64
65 =back
66
67 =head1 NOTES
68
69 Note that this command is not idempotent. L<dh_prep(1)> should be called
70 between invocations of this command. Otherwise, it may cause multiple
71 instances of the same text to be added to maintainer scripts.
72
73 =cut
74
75 init(options => {
76         "flavor=s" => \$dh{FLAVOR},
77 });
78
79 if (! defined $dh{PRIORITY}) {
80         $dh{PRIORITY}=50;
81 }
82 if (! defined $dh{FLAVOR}) {
83         $dh{FLAVOR}='emacs';
84 }
85
86 foreach my $package (@{$dh{DOPACKAGES}}) {
87         my $tmp=tmpdir($package);
88
89         my $emacsen_install=pkgfile($package,"emacsen-install");
90         my $emacsen_remove=pkgfile($package,"emacsen-remove");
91         my $emacsen_startup=pkgfile($package,"emacsen-startup");
92
93         if ($emacsen_install ne '') {
94                 if (! -d "$tmp/usr/lib/emacsen-common/packages/install") {
95                         doit("install","-d","$tmp/usr/lib/emacsen-common/packages/install");
96                 }
97                 doit("install","-m0755",$emacsen_install,"$tmp/usr/lib/emacsen-common/packages/install/$package");
98         }
99
100         if ($emacsen_remove ne '') {
101                 if (! -d "$tmp/usr/lib/emacsen-common/packages/remove") {
102                         doit("install","-d","$tmp/usr/lib/emacsen-common/packages/remove");
103                 }
104                 doit("install","-m0755","$emacsen_remove","$tmp/usr/lib/emacsen-common/packages/remove/$package");
105         }
106         
107         if ($emacsen_startup ne '') {
108                 if (! -d "$tmp/etc/$dh{FLAVOR}/site-start.d/") {
109                         doit("install","-d","$tmp/etc/$dh{FLAVOR}/site-start.d/");
110                 }
111                 doit("install","-m0644",$emacsen_startup,"$tmp/etc/$dh{FLAVOR}/site-start.d/$dh{PRIORITY}$package.el");
112         }
113
114         if ($emacsen_install ne '' || $emacsen_remove ne '') {
115                 if (! $dh{NOSCRIPTS}) {
116                         autoscript($package,"postinst","postinst-emacsen",
117                                 "s/#PACKAGE#/$package/");
118                         autoscript($package,"prerm","prerm-emacsen",
119                                 "s/#PACKAGE#/$package/");
120                 }
121         }
122 }
123
124 =head1 SEE ALSO
125
126 L<debhelper(7)>
127
128 This program is a part of debhelper.
129
130 =head1 AUTHOR
131
132 Joey Hess <joeyh@debian.org>
133
134 =cut