summaryrefslogtreecommitdiff
path: root/dh_installemacsen
blob: 3fbaf8ba100e5278f85fb5cc3ec76b1db1889526 (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
52
#!/usr/bin/perl -w
#
# Registration with emacsen-common.

BEGIN { push @INC, "debian", "/usr/share/debhelper" }
use Dh_Lib;
init();

if (! defined $dh{number}) {
	$dh{number}=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{number}$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/");
		}
	}
}