public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [PATCH] Do not clobber policy-rc.d if it already exists
@ 2019-09-11  8:19 Dalamagkidis, Konstantinos
  2019-09-11  8:24 ` Jan Kiszka
  0 siblings, 1 reply; 2+ messages in thread
From: Dalamagkidis, Konstantinos @ 2019-09-11  8:19 UTC (permalink / raw)
  To: isar-users; +Cc: Dalamagkidis, Konstantinos

We had the problem that our policy-rc.d was removed by the chroot-setup
script. This proposed patch uses the mechanism used for the
start-stop-daemon.
---
 meta/recipes-core/isar-bootstrap/files/chroot-setup.sh | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/meta/recipes-core/isar-bootstrap/files/chroot-setup.sh b/meta/recipes-core/isar-bootstrap/files/chroot-setup.sh
index f84f63a..4150011 100644
--- a/meta/recipes-core/isar-bootstrap/files/chroot-setup.sh
+++ b/meta/recipes-core/isar-bootstrap/files/chroot-setup.sh
@@ -78,6 +78,9 @@ chroot_setup() {
 	# Create a policy-rc.d to stop maintainer scripts using invoke-rc.d
 	# from running init scripts. In case of maintainer scripts that do not
 	# use invoke-rc.d, add a dummy start-stop-daemon.
+	if [ -e "/${TARGET}/sbin/policy-rc.d" ]; then
+		divert "${TARGET}" /sbin/policy-rc.d
+	fi
 	cat > "/${TARGET}/usr/sbin/policy-rc.d" <<-EOF
 		#!/bin/sh
 		exit 101
@@ -114,7 +117,7 @@ chroot_cleanup() {
 
 	check_target "${TARGET}" || return 1
 
-	rm -f "/${TARGET}/usr/sbin/policy-rc.d"
+	undivert "${TARGET}" /usr/sbin/policy-rc.d
 	undivert "${TARGET}" /sbin/start-stop-daemon
 	if [ -x "/${TARGET}/sbin/initctl.REAL" ]; then
 		undivert "${TARGET}" /sbin/initctl
-- 
2.20.1

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

* Re: [PATCH] Do not clobber policy-rc.d if it already exists
  2019-09-11  8:19 [PATCH] Do not clobber policy-rc.d if it already exists Dalamagkidis, Konstantinos
@ 2019-09-11  8:24 ` Jan Kiszka
  0 siblings, 0 replies; 2+ messages in thread
From: Jan Kiszka @ 2019-09-11  8:24 UTC (permalink / raw)
  To: [ext] Dalamagkidis, Konstantinos, isar-users

On 11.09.19 10:19, [ext] Dalamagkidis, Konstantinos wrote:
> We had the problem that our policy-rc.d was removed by the chroot-setup
> script. This proposed patch uses the mechanism used for the
> start-stop-daemon.

Your signed-off line is missing, to declare https://developercertificate.org.

> ---
>   meta/recipes-core/isar-bootstrap/files/chroot-setup.sh | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/meta/recipes-core/isar-bootstrap/files/chroot-setup.sh b/meta/recipes-core/isar-bootstrap/files/chroot-setup.sh
> index f84f63a..4150011 100644
> --- a/meta/recipes-core/isar-bootstrap/files/chroot-setup.sh
> +++ b/meta/recipes-core/isar-bootstrap/files/chroot-setup.sh
> @@ -78,6 +78,9 @@ chroot_setup() {
>   	# Create a policy-rc.d to stop maintainer scripts using invoke-rc.d
>   	# from running init scripts. In case of maintainer scripts that do not
>   	# use invoke-rc.d, add a dummy start-stop-daemon.
> +	if [ -e "/${TARGET}/sbin/policy-rc.d" ]; then
> +		divert "${TARGET}" /sbin/policy-rc.d
> +	fi
>   	cat > "/${TARGET}/usr/sbin/policy-rc.d" <<-EOF
>   		#!/bin/sh
>   		exit 101
> @@ -114,7 +117,7 @@ chroot_cleanup() {
>   
>   	check_target "${TARGET}" || return 1
>   
> -	rm -f "/${TARGET}/usr/sbin/policy-rc.d"
> +	undivert "${TARGET}" /usr/sbin/policy-rc.d
>   	undivert "${TARGET}" /sbin/start-stop-daemon
>   	if [ -x "/${TARGET}/sbin/initctl.REAL" ]; then
>   		undivert "${TARGET}" /sbin/initctl
> 

Seems reasonable to me.

Thanks,
Jan

-- 
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux

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

end of thread, other threads:[~2019-09-11  8:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-11  8:19 [PATCH] Do not clobber policy-rc.d if it already exists Dalamagkidis, Konstantinos
2019-09-11  8:24 ` Jan Kiszka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox