mirror of
https://git.yoctoproject.org/poky
synced 2026-09-14 03:49:32 +02:00
postinst: fix and simplify the postinst test recipe
Reduce the number of packages, and fix some syntax and logic errors in the scripts. (From OE-Core rev: 228f5f072218823aa9d47f2fb1dcde584fde7a44) Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
6436ffbb02
commit
d39a301778
@@ -1,126 +1,70 @@
|
|||||||
|
SUMMARY = "Packages to exercise postinstall functions"
|
||||||
LICENSE = "MIT"
|
LICENSE = "MIT"
|
||||||
ALLOW_EMPTY_${PN}-at-rootfs = "1"
|
|
||||||
|
inherit allarch
|
||||||
|
|
||||||
|
PACKAGES = "${PN}-rootfs ${PN}-delayed-a ${PN}-delayed-b"
|
||||||
|
|
||||||
|
ALLOW_EMPTY_${PN}-rootfs = "1"
|
||||||
ALLOW_EMPTY_${PN}-delayed-a = "1"
|
ALLOW_EMPTY_${PN}-delayed-a = "1"
|
||||||
ALLOW_EMPTY_${PN}-delayed-b = "1"
|
ALLOW_EMPTY_${PN}-delayed-b = "1"
|
||||||
ALLOW_EMPTY_${PN}-delayed-d = "1"
|
|
||||||
ALLOW_EMPTY_${PN}-delayed-p = "1"
|
|
||||||
ALLOW_EMPTY_${PN}-delayed-t = "1"
|
|
||||||
|
|
||||||
PACKAGES += "${PN}-at-rootfs ${PN}-delayed-a ${PN}-delayed-b ${PN}-delayed-d ${PN}-delayed-p ${PN}-delayed-t"
|
RDEPENDS_${PN}-delayed-a = "${PN}-rootfs"
|
||||||
PROVIDES += "${PN}-at-rootfs ${PN}-delayed-a ${PN}-delayed-b ${PN}-delayed-d ${PN}-delayed-p ${PN}-delayed-t"
|
|
||||||
FILES_${PN}-delayed-a = ""
|
|
||||||
FILES_${PN}-delayed-b = ""
|
|
||||||
FILES_${PN}-delayed-d = ""
|
|
||||||
FILES_${PN}-delayed-p = ""
|
|
||||||
FILES_${PN}-delayed-t = ""
|
|
||||||
|
|
||||||
# Runtime dependencies
|
|
||||||
RDEPENDS_${PN}-delayed-a = "${PN}-at-rootfs"
|
|
||||||
RDEPENDS_${PN}-delayed-b = "${PN}-delayed-a"
|
RDEPENDS_${PN}-delayed-b = "${PN}-delayed-a"
|
||||||
RDEPENDS_${PN}-delayed-d = "${PN}-delayed-b"
|
|
||||||
RDEPENDS_${PN}-delayed-p = "${PN}-delayed-d"
|
|
||||||
RDEPENDS_${PN}-delayed-t = "${PN}-delayed-p"
|
|
||||||
|
|
||||||
# Main recipe post-install
|
TESTDIR = "${sysconfdir}/postinst-test"
|
||||||
pkg_postinst_${PN}-at-rootfs () {
|
|
||||||
tfile="/etc/postinsta-test"
|
# At rootfs time touch $TESTDIR/rootfs. Errors if the file already exists, or
|
||||||
touch "$D"/this-was-created-at-rootfstime
|
# if the function runs on first boot.
|
||||||
if test "x$D" != "x" then
|
pkg_postinst_${PN}-rootfs () {
|
||||||
# Need to run on first boot
|
set -e
|
||||||
|
|
||||||
|
if [ -z "$D" ]; then
|
||||||
|
echo "${PN}-rootfs should have finished at rootfs time"
|
||||||
exit 1
|
exit 1
|
||||||
else
|
|
||||||
echo "lets write postinst" > $tfile
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -e $D${TESTDIR}/rootfs ]; then
|
||||||
|
echo "$D${TESTDIR}/rootfs exists, but should not"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
mkdir -p $D${TESTDIR}
|
||||||
|
touch $D${TESTDIR}/rootfs
|
||||||
}
|
}
|
||||||
|
|
||||||
# Dependency recipes post-installs
|
# Depends on rootfs, delays until first boot, verifies that the rootfs file was
|
||||||
|
# written.
|
||||||
pkg_postinst_${PN}-delayed-a () {
|
pkg_postinst_${PN}-delayed-a () {
|
||||||
efile="/etc/postinst-test"
|
set -e
|
||||||
tfile="/etc/postinsta-test"
|
|
||||||
rdeps="postinst"
|
|
||||||
|
|
||||||
if test "x$D" != "x"; then
|
if [ -n "$D" ]; then
|
||||||
# Need to run on first boot
|
echo "Delaying ${PN}-delayed-a until first boot"
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
touch /etc/this-was-created-at-first-boot
|
|
||||||
if test -e $efile ; then
|
|
||||||
echo 'success' > $tfile
|
|
||||||
else
|
|
||||||
echo 'fail to install $rdeps first!' >&2
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
if [ ! -e ${TESTDIR}/rootfs ]; then
|
||||||
|
echo "${PN}-delayed-a: ${TESTDIR}/rootfs not found"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
touch ${TESTDIR}/delayed-a
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Depends on delayed-a, delays until first boot, verifies that the delayed-a file was
|
||||||
|
# written. This verifies the ordering between delayed postinsts.
|
||||||
pkg_postinst_${PN}-delayed-b () {
|
pkg_postinst_${PN}-delayed-b () {
|
||||||
efile="/etc/postinsta-test"
|
set -e
|
||||||
tfile="/etc/postinstb-test"
|
|
||||||
rdeps="postinsta"
|
|
||||||
|
|
||||||
if test "x$D" != "x"; then
|
if [ -n "$D" ]; then
|
||||||
# Need to run on first boot
|
echo "Delaying ${PN}-delayed-b until first boot"
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
if test -e $efile ; then
|
|
||||||
echo 'success' > $tfile
|
|
||||||
else
|
|
||||||
echo 'fail to install $rdeps first!' >&2
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
pkg_postinst_${PN}-delayed-d () {
|
if [ ! -e ${TESTDIR}/delayed-a ]; then
|
||||||
efile="/etc/postinstb-test"
|
echo "${PN}-delayed-b: ${TESTDIR}/delayed-a not found"
|
||||||
tfile="/etc/postinstd-test"
|
|
||||||
rdeps="postinstb"
|
|
||||||
|
|
||||||
if test "x$D" != "x"; then
|
|
||||||
# Need to run on first boot
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
if test -e $efile ; then
|
|
||||||
echo 'success' > $tfile
|
|
||||||
else
|
|
||||||
echo 'fail to install $rdeps first!' >&2
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
}
|
touch ${TESTDIR}/delayed-b
|
||||||
|
|
||||||
pkg_postinst_${PN}-delayed-p () {
|
|
||||||
efile="/etc/postinstd-test"
|
|
||||||
tfile="/etc/postinstp-test"
|
|
||||||
rdeps="postinstd"
|
|
||||||
|
|
||||||
if test "x$D" != "x"; then
|
|
||||||
# Need to run on first boot
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
if test -e $efile ; then
|
|
||||||
echo 'success' > $tfile
|
|
||||||
else
|
|
||||||
echo 'fail to install $rdeps first!' >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
pkg_postinst_${PN}-delayed-t () {
|
|
||||||
efile="/etc/postinstp-test"
|
|
||||||
tfile="/etc/postinstt-test"
|
|
||||||
rdeps="postinstp"
|
|
||||||
|
|
||||||
if test "x$D" != "x"; then
|
|
||||||
# Need to run on first boot
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
if test -e $efile ; then
|
|
||||||
echo 'success' > $tfile
|
|
||||||
else
|
|
||||||
echo 'fail to install $rdeps first!' >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user