All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] Fixes for run-postinsts
@ 2014-01-24 10:04 Chen Qi
  2014-01-24 10:04 ` [PATCH 1/5] run-postinsts: remove the init script after a clean start-up Chen Qi
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Chen Qi @ 2014-01-24 10:04 UTC (permalink / raw)
  To: openembedded-core

This patchset is target to making run-postinsts work on systemd based images
no matter 'package-management' is in IMAGE_FEATURES or not.

//Chen Qi

The following changes since commit 24d5b449e5f4d91119f0d8e13c457618811aadfc:

  libtool-cross/native: Force usage of bash due to sstate inconsistencies (2014-01-23 12:14:34 +0000)

are available in the git repository at:

  git://git.openembedded.org/openembedded-core-contrib ChenQi/postinsts-fixes
  http://cgit.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h=ChenQi/postinsts-fixes

Chen Qi (2):
  run-postinsts: remove the init script after a clean start-up
  dpkg: use systemd service for first boot configuration

Ross Burton (3):
  run-postinsts: Add systemd service file
  systemd-compat-units: remove run-postints service
  image.bbclass: fix paths to run-postinsts

 meta/classes/image.bbclass                         |    4 ++--
 meta/recipes-core/systemd/systemd-compat-units.bb  |   19 +----------------
 meta/recipes-devtools/dpkg/dpkg.inc                |   21 +++++++++++++++++--
 .../dpkg/dpkg/dpkg-configure.service               |   17 +++++++++++++++
 meta/recipes-devtools/dpkg/dpkg_1.17.4.bb          |    1 +
 .../run-postinsts/run-postinsts/run-postinsts      |   15 +++++++++----
 .../run-postinsts/run-postinsts/run-postinsts.init |    3 +++
 .../run-postinsts}/run-postinsts.service           |    8 +++----
 .../run-postinsts/run-postinsts_1.0.bb             |   22 ++++++++++++++++----
 9 files changed, 76 insertions(+), 34 deletions(-)
 create mode 100644 meta/recipes-devtools/dpkg/dpkg/dpkg-configure.service
 create mode 100644 meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts.init
 rename meta/{recipes-core/systemd/systemd-compat-units => recipes-devtools/run-postinsts/run-postinsts}/run-postinsts.service (63%)

-- 
1.7.9.5



^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/5] run-postinsts: remove the init script after a clean start-up
  2014-01-24 10:04 [PATCH 0/5] Fixes for run-postinsts Chen Qi
@ 2014-01-24 10:04 ` Chen Qi
  2014-01-24 10:04 ` [PATCH 2/5] run-postinsts: Add systemd service file Chen Qi
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Chen Qi @ 2014-01-24 10:04 UTC (permalink / raw)
  To: openembedded-core

If we enable ipk/deb package back-end, and we have 'package-management'
in our IMAGE_FEATURES, then the /etc/rcS.d/S99run-postinsts would
still exist in our system after a clean start-up.

The initial design for run-postinsts requires the related init script
to be removed if there's no more post-install script left in the system.

This patch fixes this problem.

[YOCTO #5718]

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
 .../run-postinsts/run-postinsts/run-postinsts      |   15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts b/meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts
index c94c3e9..11141ec 100755
--- a/meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts
+++ b/meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts
@@ -16,7 +16,16 @@ for pm in rpm deb ipk; do
 	fi
 done
 
-[ -z "$pi_dir" ] && exit 0
+remove_rcsd_link () {
+	if [ -n "`which update-rc.d`" ]; then
+		update-rc.d -f run-postinsts remove
+	fi
+}
+
+if [ -z "$pi_dir" ]; then
+	remove_rcsd_link
+	exit 0
+fi
 
 [ -e #SYSCONFDIR#/default/postinst ] && . #SYSCONFDIR#/default/postinst
 
@@ -43,7 +52,5 @@ done
 # and the rcS.d link
 if [ $remove_pi_dir = 1 ]; then
 	rm -rf $pi_dir
-	if [ -n "`which update-rc.d`" ]; then
-		update-rc.d -f run-postinsts remove
-	fi
+	remove_rcsd_link
 fi
-- 
1.7.9.5



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/5] run-postinsts: Add systemd service file
  2014-01-24 10:04 [PATCH 0/5] Fixes for run-postinsts Chen Qi
  2014-01-24 10:04 ` [PATCH 1/5] run-postinsts: remove the init script after a clean start-up Chen Qi
@ 2014-01-24 10:04 ` Chen Qi
  2014-01-24 10:04 ` [PATCH 3/5] systemd-compat-units: remove run-postints service Chen Qi
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Chen Qi @ 2014-01-24 10:04 UTC (permalink / raw)
  To: openembedded-core

From: Ross Burton <ross.burton@intel.com>

This patch mainly adds a systmd service file for run-postinsts,
which is started at first boot to run the post-install scripts.

Apart from this, this patch also modifies the installation location
of run-postinsts to ${sbindir}. This is because this script would be
used by both sysvinit and systemd based images. So it's more reasonable
to make it locate under ${sbindir}.

[YOCTO #5719]

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
 .../run-postinsts/run-postinsts/run-postinsts.init |    3 +++
 .../run-postinsts/run-postinsts.service            |   17 +++++++++++++++
 .../run-postinsts/run-postinsts_1.0.bb             |   22 ++++++++++++++++----
 3 files changed, 38 insertions(+), 4 deletions(-)
 create mode 100644 meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts.init
 create mode 100644 meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts.service

diff --git a/meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts.init b/meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts.init
new file mode 100644
index 0000000..473a1f7
--- /dev/null
+++ b/meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts.init
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+run-postinsts
diff --git a/meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts.service b/meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts.service
new file mode 100644
index 0000000..822327a
--- /dev/null
+++ b/meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts.service
@@ -0,0 +1,17 @@
+[Unit]
+Description=Run pending postinsts
+DefaultDependencies=no
+After=systemd-remount-fs.service systemd-tmpfiles-setup.service tmp.mount
+Before=sysinit.target
+ConditionPathExistsGlob=#SYSCONFDIR#/*-postinsts
+
+[Service]
+Type=oneshot
+ExecStart=#SBINDIR#/run-postinsts
+ExecStartPost=#BASE_BINDIR#/systemctl disable run-postinsts.service
+RemainAfterExit=No
+TimeoutSec=0
+
+[Install]
+WantedBy=basic.target
+WantedBy=sysinit.target
diff --git a/meta/recipes-devtools/run-postinsts/run-postinsts_1.0.bb b/meta/recipes-devtools/run-postinsts/run-postinsts_1.0.bb
index 03989ab..64f85c2 100644
--- a/meta/recipes-devtools/run-postinsts/run-postinsts_1.0.bb
+++ b/meta/recipes-devtools/run-postinsts/run-postinsts_1.0.bb
@@ -5,12 +5,16 @@ LICENSE = "MIT"
 LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d690 \
                     file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
 
-SRC_URI = "file://run-postinsts"
+SRC_URI = "file://run-postinsts \
+           file://run-postinsts.init \
+           file://run-postinsts.service"
+
+inherit allarch systemd update-rc.d
 
 INITSCRIPT_NAME = "run-postinsts"
 INITSCRIPT_PARAMS = "start 99 S ."
 
-inherit update-rc.d
+SYSTEMD_SERVICE_${PN} = "run-postinsts.service"
 
 do_configure() {
 	:
@@ -21,8 +25,18 @@ do_compile () {
 }
 
 do_install() {
+	install -d ${D}${sbindir}
+	install -m 0755 ${WORKDIR}/run-postinsts ${D}${sbindir}/
+
 	install -d ${D}${sysconfdir}/init.d/
-	install -m 0755 ${WORKDIR}/run-postinsts ${D}${sysconfdir}/init.d/
+	install -m 0755 ${WORKDIR}/run-postinsts.init ${D}${sysconfdir}/init.d/run-postinsts
+
+	install -d ${D}${systemd_unitdir}/system/
+	install -m 0644 ${WORKDIR}/run-postinsts.service ${D}${systemd_unitdir}/system/
 
-	sed -i -e 's:#SYSCONFDIR#:${sysconfdir}:g' ${D}${sysconfdir}/init.d/run-postinsts
+	sed -i -e 's:#SYSCONFDIR#:${sysconfdir}:g' \
+               -e 's:#SBINDIR#:${sbindir}:g' \
+               -e 's:#BASE_BINDIR#:${base_bindir}:g' \
+               ${D}${sbindir}/run-postinsts \
+               ${D}${systemd_unitdir}/system/run-postinsts.service
 }
-- 
1.7.9.5



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/5] systemd-compat-units: remove run-postints service
  2014-01-24 10:04 [PATCH 0/5] Fixes for run-postinsts Chen Qi
  2014-01-24 10:04 ` [PATCH 1/5] run-postinsts: remove the init script after a clean start-up Chen Qi
  2014-01-24 10:04 ` [PATCH 2/5] run-postinsts: Add systemd service file Chen Qi
@ 2014-01-24 10:04 ` Chen Qi
  2014-01-24 10:04 ` [PATCH 4/5] image.bbclass: fix paths to run-postinsts Chen Qi
  2014-01-24 10:04 ` [PATCH 5/5] dpkg: use systemd service for first boot configuration Chen Qi
  4 siblings, 0 replies; 6+ messages in thread
From: Chen Qi @ 2014-01-24 10:04 UTC (permalink / raw)
  To: openembedded-core

From: Ross Burton <ross.burton@intel.com>

Remove this service as it's moved to the run-postinsts recipe.

[YOCTO #5719]

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
 meta/recipes-core/systemd/systemd-compat-units.bb  |   19 +------------------
 .../systemd-compat-units/run-postinsts.service     |   17 -----------------
 2 files changed, 1 insertion(+), 35 deletions(-)
 delete mode 100644 meta/recipes-core/systemd/systemd-compat-units/run-postinsts.service

diff --git a/meta/recipes-core/systemd/systemd-compat-units.bb b/meta/recipes-core/systemd/systemd-compat-units.bb
index d8cc3f7..e653470 100644
--- a/meta/recipes-core/systemd/systemd-compat-units.bb
+++ b/meta/recipes-core/systemd/systemd-compat-units.bb
@@ -9,17 +9,7 @@ DEPENDS = "systemd-systemctl-native"
 
 inherit allarch
 
-SRC_URI = "file://*.service"
-
-do_install() {
-	install -d ${D}${systemd_unitdir}/system/basic.target.wants
-	install -d ${D}${systemd_unitdir}/system/sysinit.target.wants/
-	sed -i -e 's,@POSTINSTALL_INITPOSITION@,${POSTINSTALL_INITPOSITION},g' \
-			${WORKDIR}/run-postinsts.service
-	install -m 0644 ${WORKDIR}/run-postinsts.service ${D}${systemd_unitdir}/system
-	ln -sf ../run-postinsts.service ${D}${systemd_unitdir}/system/basic.target.wants/
-	ln -sf ../run-postinsts.service ${D}${systemd_unitdir}/system/sysinit.target.wants/
-}
+ALLOW_EMPTY_${PN} = "1"
 
 SYSTEMD_DISABLED_SYSV_SERVICES = " \
   busybox-udhcpc \
@@ -47,11 +37,4 @@ pkg_postinst_${PN} () {
 	done ; echo
 }
 
-FILES_${PN} = "${systemd_unitdir}/system ${bindir}"
 RDPEPENDS_${PN} = "systemd"
-
-# Define a variable to allow distros to run configure earlier.
-# (for example, to enable loading of ethernet kernel modules before networking starts)
-# note: modifying name or default value for POSTINSTALL_INITPOSITION requires
-# changes in opkg.inc
-POSTINSTALL_INITPOSITION ?= "98"
diff --git a/meta/recipes-core/systemd/systemd-compat-units/run-postinsts.service b/meta/recipes-core/systemd/systemd-compat-units/run-postinsts.service
deleted file mode 100644
index 35cf3d3..0000000
--- a/meta/recipes-core/systemd/systemd-compat-units/run-postinsts.service
+++ /dev/null
@@ -1,17 +0,0 @@
-[Unit]
-Description=Run pending postinsts
-DefaultDependencies=no
-ConditionPathExists=|/etc/rcS.d/S@POSTINSTALL_INITPOSITION@run-postinsts
-After=systemd-remount-fs.service systemd-tmpfiles-setup.service tmp.mount
-Before=sysinit.target
-
-[Service]
-ExecStart=/etc/rcS.d/S@POSTINSTALL_INITPOSITION@run-postinsts
-RemainAfterExit=No
-Type=oneshot
-StandardOutput=syslog
-TimeoutSec=0
-
-[Install]
-WantedBy=basic.target
-WantedBy=sysinit.target
-- 
1.7.9.5



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 4/5] image.bbclass: fix paths to run-postinsts
  2014-01-24 10:04 [PATCH 0/5] Fixes for run-postinsts Chen Qi
                   ` (2 preceding siblings ...)
  2014-01-24 10:04 ` [PATCH 3/5] systemd-compat-units: remove run-postints service Chen Qi
@ 2014-01-24 10:04 ` Chen Qi
  2014-01-24 10:04 ` [PATCH 5/5] dpkg: use systemd service for first boot configuration Chen Qi
  4 siblings, 0 replies; 6+ messages in thread
From: Chen Qi @ 2014-01-24 10:04 UTC (permalink / raw)
  To: openembedded-core

From: Ross Burton <ross.burton@intel.com>

The run-postinsts script has been moved to ${sbindir}.

[YOCTO #5719]

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
 meta/classes/image.bbclass |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index 4c63bc2..5049b3f 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -531,7 +531,7 @@ rootfs_uninstall_unneeded () {
 			# All packages were successfully configured.
 			# update-rc.d, base-passwd, run-postinsts are no further use, remove them now
 			remove_run_postinsts=false
-			if [ -e ${IMAGE_ROOTFS}${sysconfdir}/init.d/run-postinsts ]; then
+			if [ -e ${IMAGE_ROOTFS}${sbindir}/run-postinsts ]; then
 				remove_run_postinsts=true
 			fi
 
@@ -555,7 +555,7 @@ rootfs_uninstall_unneeded () {
 			# Some packages were not successfully configured, save them only
 			# if we have run-postinsts script present. Otherwise, they're
 			# useless
-			if [ -e ${IMAGE_ROOTFS}${sysconfdir}/init.d/run-postinsts ]; then
+			if [ -e ${IMAGE_ROOTFS}${sbindir}/run-postinsts ]; then
 				save_postinsts
 			fi
 		fi
-- 
1.7.9.5



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 5/5] dpkg: use systemd service for first boot configuration
  2014-01-24 10:04 [PATCH 0/5] Fixes for run-postinsts Chen Qi
                   ` (3 preceding siblings ...)
  2014-01-24 10:04 ` [PATCH 4/5] image.bbclass: fix paths to run-postinsts Chen Qi
@ 2014-01-24 10:04 ` Chen Qi
  4 siblings, 0 replies; 6+ messages in thread
From: Chen Qi @ 2014-01-24 10:04 UTC (permalink / raw)
  To: openembedded-core

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>
---
 meta/recipes-devtools/dpkg/dpkg.inc                |   21 ++++++++++++++++++--
 .../dpkg/dpkg/dpkg-configure.service               |   17 ++++++++++++++++
 meta/recipes-devtools/dpkg/dpkg_1.17.4.bb          |    1 +
 3 files changed, 37 insertions(+), 2 deletions(-)
 create mode 100644 meta/recipes-devtools/dpkg/dpkg/dpkg-configure.service

diff --git a/meta/recipes-devtools/dpkg/dpkg.inc b/meta/recipes-devtools/dpkg/dpkg.inc
index 0ccfd74..044a8eb 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 0000000..f0b0789
--- /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 9e2392c..b27e6f4 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"
-- 
1.7.9.5



^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-01-24 10:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-24 10:04 [PATCH 0/5] Fixes for run-postinsts Chen Qi
2014-01-24 10:04 ` [PATCH 1/5] run-postinsts: remove the init script after a clean start-up Chen Qi
2014-01-24 10:04 ` [PATCH 2/5] run-postinsts: Add systemd service file Chen Qi
2014-01-24 10:04 ` [PATCH 3/5] systemd-compat-units: remove run-postints service Chen Qi
2014-01-24 10:04 ` [PATCH 4/5] image.bbclass: fix paths to run-postinsts Chen Qi
2014-01-24 10:04 ` [PATCH 5/5] dpkg: use systemd service for first boot configuration Chen Qi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.