summaryrefslogtreecommitdiff
path: root/dh_installmenu
blob: 5071a2f3a2760d7e3e142a7e4f64012831b550cb (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
#!/bin/sh -e
#
# Integration with debian menu system:
#
# If debian/menu file exists, save it to $TMP/usr/lib/menu/$PACKAGE
# If debian/menu-method file exists, save it to 
# $TMP/etc/menu-methods/$PACKAGE
#
# Also, add to postinst and postrm.

PATH=debian:$PATH:/usr/lib/debhelper
. dh_lib

for PACKAGE in $DH_DOPACKAGES; do
	TMP=`tmpdir $PACKAGE`
	EXT=`pkgext $PACKAGE`

	if [ -e debian/${EXT}menu ]; then
		if [ ! -d $TMP/usr/lib/menu ]; then
			doit "install -d $TMP/usr/lib/menu"
		fi
		doit "install -p -m644 debian/${EXT}menu $TMP/usr/lib/menu/$PACKAGE"

		# Add the scripts if a menu-method file doesn't exist.
		# The scripts for menu-method handle everything these do, too.
		if [ ! -e debian/${EXT}menu-method -a ! "$DH_NOSCRIPTS" ]; then
			autoscript "postinst" "postinst-menu"
			autoscript "postrm" "postrm-menu"
		fi
	fi

	if [ -e debian/${EXT}menu-method ]; then
		if [ ! -d $TMP/etc/menu-methods ]; then
			doit "install -d $TMP/etc/menu-methods"
		fi
		doit "install -p debian/${EXT}menu-method $TMP/etc/menu-methods/$PACKAGE"

		if [ ! "$DH_NOSCRIPTS" ]; then
			autoscript "postinst" "postinst-menu-method" "s/#PACKAGE#/$PACKAGE/"
			autoscript "postrm" "postrm-menu-method" "s/#PACKAGE#/$PACKAGE/"
		fi
	fi
done