diff options
author | Chen Qi <Qi.Chen@windriver.com> | 2014-01-24 04:47:37 -0500 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-01-28 00:52:35 +0000 |
commit | b3bb9c770b17be4f7e1e424e0d0ec00ebe5bfb62 (patch) | |
tree | f39fa8bcff48a112968daf3d42388bb64337a5ff /meta/recipes-devtools | |
parent | 1ec04bb2154cbaf5ff335c873a666f8bb9c0807e (diff) | |
download | poky-b3bb9c770b17be4f7e1e424e0d0ec00ebe5bfb62.tar.gz |
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]
(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>
Diffstat (limited to 'meta/recipes-devtools')
-rw-r--r-- | meta/recipes-devtools/dpkg/dpkg.inc | 21 | ||||
-rw-r--r-- | meta/recipes-devtools/dpkg/dpkg/dpkg-configure.service | 17 | ||||
-rw-r--r-- | meta/recipes-devtools/dpkg/dpkg_1.17.4.bb | 1 |
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}" | |||
14 | 14 | ||
15 | PARALLEL_MAKE = "" | 15 | PARALLEL_MAKE = "" |
16 | 16 | ||
17 | inherit autotools gettext perlnative pkgconfig | 17 | inherit autotools gettext perlnative pkgconfig systemd |
18 | |||
19 | python () { | ||
20 | if not oe.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d): | ||
21 | pn = d.getVar('PN', True) | ||
22 | d.setVar('SYSTEMD_SERVICE_%s' % (pn), 'dpkg-configure.service') | ||
23 | } | ||
18 | 24 | ||
19 | export PERL = "${bindir}/perl" | 25 | export PERL = "${bindir}/perl" |
20 | PERL_class-native = "${STAGING_BINDIR_NATIVE}/perl-native/perl" | 26 | PERL_class-native = "${STAGING_BINDIR_NATIVE}/perl-native/perl" |
@@ -48,11 +54,22 @@ do_install_append () { | |||
48 | mv ${D}${bindir}/update-alternatives ${D}${sbindir} | 54 | mv ${D}${bindir}/update-alternatives ${D}${sbindir} |
49 | sed -i -e 's|^#!.*${bindir}/perl-native.*/perl|#!/usr/bin/env perl|' ${D}${bindir}/dpkg-* | 55 | sed -i -e 's|^#!.*${bindir}/perl-native.*/perl|#!/usr/bin/env perl|' ${D}${bindir}/dpkg-* |
50 | fi | 56 | fi |
57 | |||
58 | if ${@base_contains('DISTRO_FEATURES','sysvinit','false','true',d)};then | ||
59 | install -d ${D}${systemd_unitdir}/system | ||
60 | install -m 0644 ${WORKDIR}/dpkg-configure.service ${D}${systemd_unitdir}/system/ | ||
61 | sed -i -e 's,@BASE_BINDIR@,${base_bindir},g' \ | ||
62 | -e 's,@SYSCONFDIR@,${sysconfdir},g' \ | ||
63 | -e 's,@BINDIR@,${bindir},g' \ | ||
64 | -e 's,@SYSTEMD_UNITDIR@,${systemd_unitdir},g' \ | ||
65 | ${D}${systemd_unitdir}/system/dpkg-configure.service | ||
66 | fi | ||
51 | } | 67 | } |
52 | 68 | ||
53 | pkg_postinst_${PN} () { | 69 | pkg_postinst_${PN} () { |
54 | #!/bin/sh | 70 | #!/bin/sh |
55 | if [ "x$D" != "x" ] && [ -f $D/var/lib/dpkg/status ]; then | 71 | if ${@base_contains('DISTRO_FEATURES','sysvinit','true','false',d)} && \ |
72 | [ "x$D" != "x" ] && [ -f $D/var/lib/dpkg/status ]; then | ||
56 | install -d $D${sysconfdir}/rcS.d | 73 | install -d $D${sysconfdir}/rcS.d |
57 | 74 | ||
58 | # this happens at S98 where our good 'ole packages script used to run | 75 | # 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 @@ | |||
1 | [Unit] | ||
2 | Description=dpkg first boot configure | ||
3 | DefaultDependencies=no | ||
4 | After=systemd-remount-fs.service systemd-tmpfiles-setup.service tmp.mount | ||
5 | Before=sysinit.target | ||
6 | |||
7 | [Service] | ||
8 | Type=oneshot | ||
9 | EnvironmentFile=-@SYSCONFDIR@/default/postinst | ||
10 | ExecStart=-@BASE_BINDIR@/sh -c " if [ $POSTINST_LOGGING = '1' ]; then @BINDIR@/dpkg --configure -a > $LOGFILE 2>&1; else @BINDIR@/dpkg --configure -a; fi" | ||
11 | ExecStartPost=@BASE_BINDIR@/systemctl disable dpkg-configure.service | ||
12 | StandardOutput=syslog | ||
13 | RemainAfterExit=No | ||
14 | |||
15 | [Install] | ||
16 | WantedBy=basic.target | ||
17 | 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 \ | |||
9 | file://remove-tar-no-timestamp.patch \ | 9 | file://remove-tar-no-timestamp.patch \ |
10 | file://fix-abs-redefine.patch \ | 10 | file://fix-abs-redefine.patch \ |
11 | file://arch_pm.patch \ | 11 | file://arch_pm.patch \ |
12 | file://dpkg-configure.service \ | ||
12 | " | 13 | " |
13 | 14 | ||
14 | SRC_URI[md5sum] = "cc25086e1e3bd9512a95f14cfe9002e1" | 15 | SRC_URI[md5sum] = "cc25086e1e3bd9512a95f14cfe9002e1" |