Use a systemd service file for first boot configuration for dpkg based images which has 'package-management' in its IMAGE_FEATURES. [YOCTO #5719] (From OE-Core rev: 56490921d267b784118df43cbd107925c8b94200) Signed-off-by: Chen Qi <Qi.Chen@windriver.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
104 lines
3.1 KiB
PHP
104 lines
3.1 KiB
PHP
SUMMARY = "Package maintenance system from Debian"
|
|
LICENSE = "GPLv2.0+"
|
|
SECTION = "base"
|
|
|
|
SRC_URI = "${DEBIAN_MIRROR}/main/d/dpkg/dpkg_${PV}.tar.xz \
|
|
file://ignore_extra_fields.patch"
|
|
|
|
DEPENDS = "zlib bzip2 perl ncurses"
|
|
DEPENDS_class-native = "bzip2-native zlib-native virtual/update-alternatives-native gettext-native perl-native"
|
|
RDEPENDS_${PN} = "${VIRTUAL-RUNTIME_update-alternatives} xz"
|
|
RDEPENDS_${PN}_class-native = "xz"
|
|
|
|
S = "${WORKDIR}/${BPN}-${PV}"
|
|
|
|
PARALLEL_MAKE = ""
|
|
|
|
inherit autotools gettext perlnative pkgconfig systemd
|
|
|
|
python () {
|
|
if not oe.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d):
|
|
pn = d.getVar('PN', True)
|
|
d.setVar('SYSTEMD_SERVICE_%s' % (pn), 'dpkg-configure.service')
|
|
}
|
|
|
|
export PERL = "${bindir}/perl"
|
|
PERL_class-native = "${STAGING_BINDIR_NATIVE}/perl-native/perl"
|
|
|
|
export PERL_LIBDIR = "${libdir}/perl"
|
|
PERL_LIBDIR_class-native = "${libdir}/perl-native/perl"
|
|
|
|
EXTRA_OECONF = "\
|
|
--disable-dselect \
|
|
--enable-start-stop-daemon \
|
|
--with-zlib \
|
|
--with-bz2 \
|
|
--without-liblzma \
|
|
--without-selinux \
|
|
"
|
|
|
|
do_configure () {
|
|
echo >> ${S}/m4/compiler.m4
|
|
sed -i -e 's#PERL_LIBDIR=.*$#PERL_LIBDIR="${libdir}/perl"#' ${S}/configure
|
|
autotools_do_configure
|
|
}
|
|
|
|
DPKG_INIT_POSITION ?= "98"
|
|
|
|
do_install_append () {
|
|
if [ "${PN}" = "dpkg-native" ]; then
|
|
# update-alternatives doesn't have an offline mode
|
|
rm ${D}${bindir}/update-alternatives
|
|
sed -i -e 's|^#!.*${bindir}/perl-native.*/perl|#!/usr/bin/env nativeperl|' ${D}${bindir}/dpkg-*
|
|
else
|
|
mv ${D}${bindir}/update-alternatives ${D}${sbindir}
|
|
sed -i -e 's|^#!.*${bindir}/perl-native.*/perl|#!/usr/bin/env perl|' ${D}${bindir}/dpkg-*
|
|
fi
|
|
|
|
if ${@base_contains('DISTRO_FEATURES','sysvinit','false','true',d)};then
|
|
install -d ${D}${systemd_unitdir}/system
|
|
install -m 0644 ${WORKDIR}/dpkg-configure.service ${D}${systemd_unitdir}/system/
|
|
sed -i -e 's,@BASE_BINDIR@,${base_bindir},g' \
|
|
-e 's,@SYSCONFDIR@,${sysconfdir},g' \
|
|
-e 's,@BINDIR@,${bindir},g' \
|
|
-e 's,@SYSTEMD_UNITDIR@,${systemd_unitdir},g' \
|
|
${D}${systemd_unitdir}/system/dpkg-configure.service
|
|
fi
|
|
}
|
|
|
|
pkg_postinst_${PN} () {
|
|
#!/bin/sh
|
|
if ${@base_contains('DISTRO_FEATURES','sysvinit','true','false',d)} && \
|
|
[ "x$D" != "x" ] && [ -f $D/var/lib/dpkg/status ]; then
|
|
install -d $D${sysconfdir}/rcS.d
|
|
|
|
# this happens at S98 where our good 'ole packages script used to run
|
|
echo "#!/bin/sh
|
|
[ -e ${sysconfdir}/default/postinst ] && . ${sysconfdir}/default/postinst
|
|
if [ \"\$POSTINST_LOGGING\" = \"1\" ]; then
|
|
dpkg --configure -a >\$LOGFILE 2>&1
|
|
else
|
|
dpkg --configure -a
|
|
fi
|
|
rm -f ${sysconfdir}/rcS.d/S${DPKG_INIT_POSITION}run-postinsts
|
|
" > $D${sysconfdir}/rcS.d/S${DPKG_INIT_POSITION}run-postinsts
|
|
chmod 0755 $D${sysconfdir}/rcS.d/S${DPKG_INIT_POSITION}run-postinsts
|
|
fi
|
|
}
|
|
|
|
PROV = "virtual/update-alternatives"
|
|
PROV_class-native = ""
|
|
|
|
PROVIDES += "${PROV}"
|
|
|
|
PACKAGES =+ "update-alternatives-dpkg"
|
|
FILES_update-alternatives-dpkg = "${sbindir}/update-alternatives ${localstatedir}/lib/dpkg/alternatives ${sysconfdir}/alternatives"
|
|
RPROVIDES_update-alternatives-dpkg += "update-alternatives"
|
|
|
|
PACKAGES += "${PN}-perl"
|
|
FILES_${PN}-perl = "${libdir}/perl"
|
|
|
|
BBCLASSEXTEND = "native"
|
|
|
|
|