summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChen Qi <Qi.Chen@windriver.com>2014-01-24 04:47:37 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-01-28 00:48:27 +0000
commit56490921d267b784118df43cbd107925c8b94200 (patch)
tree38a581eb97b1de0928862d685470f71b74a78040
parent2c8dc1b00c0cf83da106ef9544cd11cde7ce43a1 (diff)
downloadopenembedded-core-56490921d267b784118df43cbd107925c8b94200.tar.gz
openembedded-core-56490921d267b784118df43cbd107925c8b94200.tar.bz2
openembedded-core-56490921d267b784118df43cbd107925c8b94200.zip
dpkg: use systemd service for first boot configuration
Use a systemd service file for first boot configuration for dpkg based images which has 'package-management' in its IMAGE_FEATURES. [YOCTO #5719] Signed-off-by: Chen Qi <Qi.Chen@windriver.com> Signed-off-by: Saul Wold <sgw@linux.intel.com>
-rw-r--r--meta/recipes-devtools/dpkg/dpkg.inc21
-rw-r--r--meta/recipes-devtools/dpkg/dpkg/dpkg-configure.service17
-rw-r--r--meta/recipes-devtools/dpkg/dpkg_1.17.4.bb1
3 files changed, 37 insertions, 2 deletions
diff --git a/meta/recipes-devtools/dpkg/dpkg.inc b/meta/recipes-devtools/dpkg/dpkg.inc
index 0ccfd74f54..044a8eb5d3 100644
--- a/meta/recipes-devtools/dpkg/dpkg.inc
+++ b/meta/recipes-devtools/dpkg/dpkg.inc
@@ -14,7 +14,13 @@ S = "${WORKDIR}/${BPN}-${PV}"
PARALLEL_MAKE = ""
-inherit autotools gettext perlnative pkgconfig
+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"
@@ -48,11 +54,22 @@ do_install_append () {
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 [ "x$D" != "x" ] && [ -f $D/var/lib/dpkg/status ]; then
+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
diff --git a/meta/recipes-devtools/dpkg/dpkg/dpkg-configure.service b/meta/recipes-devtools/dpkg/dpkg/dpkg-configure.service
new file mode 100644
index 0000000000..f0b0789e4e
--- /dev/null
+++ b/meta/recipes-devtools/dpkg/dpkg/dpkg-configure.service
@@ -0,0 +1,17 @@
+[Unit]
+Description=dpkg first boot configure
+DefaultDependencies=no
+After=systemd-remount-fs.service systemd-tmpfiles-setup.service tmp.mount
+Before=sysinit.target
+
+[Service]
+Type=oneshot
+EnvironmentFile=-@SYSCONFDIR@/default/postinst
+ExecStart=-@BASE_BINDIR@/sh -c " if [ $POSTINST_LOGGING = '1' ]; then @BINDIR@/dpkg --configure -a > $LOGFILE 2>&1; else @BINDIR@/dpkg --configure -a; fi"
+ExecStartPost=@BASE_BINDIR@/systemctl disable dpkg-configure.service
+StandardOutput=syslog
+RemainAfterExit=No
+
+[Install]
+WantedBy=basic.target
+WantedBy=sysinit.target
diff --git a/meta/recipes-devtools/dpkg/dpkg_1.17.4.bb b/meta/recipes-devtools/dpkg/dpkg_1.17.4.bb
index 9e2392c111..b27e6f450e 100644
--- a/meta/recipes-devtools/dpkg/dpkg_1.17.4.bb
+++ b/meta/recipes-devtools/dpkg/dpkg_1.17.4.bb
@@ -9,6 +9,7 @@ SRC_URI += "file://noman.patch \
file://remove-tar-no-timestamp.patch \
file://fix-abs-redefine.patch \
file://arch_pm.patch \
+ file://dpkg-configure.service \
"
SRC_URI[md5sum] = "cc25086e1e3bd9512a95f14cfe9002e1"