summaryrefslogtreecommitdiff
path: root/dh_installemacsen
blob: 8d8982c3fd60530f49d4f410cffb3a80159c0459 (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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/perl -w
#
# Registration with emacsen-common.

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

if (! defined $dh{PRIORITY}) {
	$dh{PRIORITY}=50;
}
if (! defined $dh{FLAVOR}) {
	$dh{FLAVOR}='emacs';
}

foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
	$TMP=tmpdir($PACKAGE);

	$emacsen_install=pkgfile($PACKAGE,"emacsen-install");
	$emacsen_remove=pkgfile($PACKAGE,"emacsen-remove");
	$emacsen_startup=pkgfile($PACKAGE,"emacsen-startup");

	if ($emacsen_install ne '') {
		if (! -d "$TMP/usr/lib/emacsen-common/packages/install") {
			doit("install","-d","$TMP/usr/lib/emacsen-common/packages/install");
		}
		doit("install","-m0755",$emacsen_install,"$TMP/usr/lib/emacsen-common/packages/install/$PACKAGE");
	}

	if ($emacsen_remove ne '') {
		if (! -d "$TMP/usr/lib/emacsen-common/packages/remove") {
			doit("install","-d","$TMP/usr/lib/emacsen-common/packages/remove");
		}
		doit("install","-m0755","$emacsen_remove","$TMP/usr/lib/emacsen-common/packages/remove/$PACKAGE");
	}
	
	if ($emacsen_startup ne '') {
		if (! -d "$TMP/etc/$dh{FLAVOR}/site-start.d/") {
			doit("install","-d","$TMP/etc/$dh{FLAVOR}/site-start.d/");
		}
		doit("install","-m0644",$emacsen_startup,"$TMP/etc/$dh{FLAVOR}/site-start.d/$dh{PRIORITY}$PACKAGE.el");
	}

	if ($emacsen_install ne '' || $emacsen_remove ne '') {
		if (! $dh{NOSCRIPTS}) {
			autoscript($PACKAGE,"postinst","postinst-emacsen",
				"s/#PACKAGE#/$PACKAGE/");
			autoscript($PACKAGE,"prerm","prerm-emacsen",
				"s/#PACKAGE#/$PACKAGE/");
		}
	}
}