summaryrefslogtreecommitdiff
path: root/meta/recipes-devtools/rpm/rpm-postinsts.bb
blob: c8fc1c33f45afdaaac5d873a9e38cdd9b66053f6 (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
53
54
DESCRIPTION = "RPM postinstall script"
SECTION = "core"
LICENSE = "LGPLv2.1"
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/LGPL-2.1;md5=1a6d268fd218675ffea8be556788b780"

inherit allarch
#
# Allow distributions to alter when [postponed] package install scripts are run
#
POSTINSTALL_INITPOSITION ?= "98"

do_fetch() {
	:
}

do_configure() {
	:
}

do_compile() {
	:
}

do_install() {
	:
}

pkg_postinst_${PN} () {
if [ "x$D" != "x" ] && [ -f $D/var/lib/rpm/Packages ]; then
	install -d $D/${sysconfdir}/rcS.d
	cat > $D${sysconfdir}/rcS.d/S${POSTINSTALL_INITPOSITION}run-postinsts << "EOF"
#!/bin/sh
[ -e ${sysconfdir}/default/postinst ] && . ${sysconfdir}/default/postinst
[ -d ${sysconfdir}/rpm-postinsts ] && for i in `ls ${sysconfdir}/rpm-postinsts/`; do
	i=${sysconfdir}/rpm-postinsts/$i
	echo "Running postinst $i..."
	if [ -x $i ]; then
		if [ "$POSTINST_LOGGING" = "1" ]; then
			$i >>$LOGFILE 2&>1
		else
			$i
		fi
		rm $i
	else
		echo "ERROR: postinst $i failed."
	fi
done
rm -f ${sysconfdir}/rcS.d/S${POSTINSTALL_INITPOSITION}run-postinsts 2>/dev/null
EOF
	chmod 0755 $D${sysconfdir}/rcS.d/S${POSTINSTALL_INITPOSITION}run-postinsts
fi
}

ALLOW_EMPTY_${PN} = "1"