All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] systemd: Remove init.d dir if systemd unit file is present and sysvinit not a distro feature
@ 2013-07-23 10:03 Shakeel, Muhammad
  2013-07-23 10:46 ` Enrico Scholz
  2013-07-25 11:08 ` ChenQi
  0 siblings, 2 replies; 8+ messages in thread
From: Shakeel, Muhammad @ 2013-07-23 10:03 UTC (permalink / raw)
  To: openembedded-core

From: Muhammad Shakeel <muhammad_shakeel@mentor.com>

If systemd is supported DISTRO_FEATURE and sysvinit is not and also if
systemd_unitdir contains a service file(s) then no need to keep init.d scripts
for sysvinit compatibility.

Signed-off-by: Muhammad Shakeel <muhammad_shakeel@mentor.com>
---
 meta/classes/systemd.bbclass |   19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/meta/classes/systemd.bbclass b/meta/classes/systemd.bbclass
index 9763faa..55f378e 100644
--- a/meta/classes/systemd.bbclass
+++ b/meta/classes/systemd.bbclass
@@ -170,3 +170,22 @@ python rm_systemd_unitdir (){
             shutil.rmtree(systemd_unitdir)
 }
 do_install[postfuncs] += "rm_systemd_unitdir "
+
+python rm_sysvinit_initddir (){
+    import shutil
+    if ("systemd" in d.getVar("DISTRO_FEATURES", True).split() and
+        "sysvinit" not in d.getVar("DISTRO_FEATURES", True).split()):
+        service_file_exists = False
+        systemd_unitdir = oe.path.join(d.getVar("D", True), d.getVar('systemd_unitdir', True), "system")
+        if os.path.exists(systemd_unitdir):
+            for filename in os.listdir(systemd_unitdir):
+                if filename.endswith(".service"):
+                    service_file_exists = True
+                    break
+
+        if service_file_exists:
+            sysv_initddir = oe.path.join(d.getVar("D", True), d.getVar('INIT_D_DIR', True))
+            if os.path.exists(sysv_initddir):
+                shutil.rmtree(sysv_initddir)
+}
+do_install[postfuncs] += "rm_sysvinit_initddir "
-- 
1.7.9.5



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

* Re: [PATCH] systemd: Remove init.d dir if systemd unit file is present and sysvinit not a distro feature
  2013-07-23 10:03 [PATCH] systemd: Remove init.d dir if systemd unit file is present and sysvinit not a distro feature Shakeel, Muhammad
@ 2013-07-23 10:46 ` Enrico Scholz
  2013-07-24 13:22   ` Muhammad Shakeel
  2013-07-25 11:08 ` ChenQi
  1 sibling, 1 reply; 8+ messages in thread
From: Enrico Scholz @ 2013-07-23 10:46 UTC (permalink / raw)
  To: openembedded-core; +Cc: Shakeel, Muhammad

"Shakeel, Muhammad"
<muhammad_shakeel-nmGgyN9QBj3QT0dZR+AlfA@public.gmane.org> writes:

> If systemd is supported DISTRO_FEATURE and sysvinit is not and also if
> systemd_unitdir contains a service file(s) then no need to keep init.d scripts
> for sysvinit compatibility.
> ...
> +            for filename in os.listdir(systemd_unitdir):
> +                if filename.endswith(".service"):

why only .service?  Other systemd files (.socket, .mount, .path, ...)
can also replace initscripts.


Enrico


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

* Re: [PATCH] systemd: Remove init.d dir if systemd unit file is present and sysvinit not a distro feature
  2013-07-23 10:46 ` Enrico Scholz
@ 2013-07-24 13:22   ` Muhammad Shakeel
  2013-07-24 13:55     ` Paul Eggleton
  0 siblings, 1 reply; 8+ messages in thread
From: Muhammad Shakeel @ 2013-07-24 13:22 UTC (permalink / raw)
  To: Enrico Scholz, openembedded-core

On 07/23/2013 03:46 PM, Enrico Scholz wrote:
> "Shakeel, Muhammad"
> <muhammad_shakeel-nmGgyN9QBj3QT0dZR+AlfA@public.gmane.org> writes:
>
>> If systemd is supported DISTRO_FEATURE and sysvinit is not and also if
>> systemd_unitdir contains a service file(s) then no need to keep init.d scripts
>> for sysvinit compatibility.
>> ...
>> +            for filename in os.listdir(systemd_unitdir):
>> +                if filename.endswith(".service"):
> why only .service?  Other systemd files (.socket, .mount, .path, ...)
> can also replace initscripts.
>
Other systemd unit files are normally accompanied with a .service file 
(this is just I observed and not mandatory).

If we come across any package which is not providing .service file but 
only some other type of systemd unit file for initscripts replacement 
then we can always add check for that type.
According to systemd documentation there can be 10 types of systemd unit 
files and checking for all here can be a little overhead.

Thanks


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

* Re: [PATCH] systemd: Remove init.d dir if systemd unit file is present and sysvinit not a distro feature
  2013-07-24 13:22   ` Muhammad Shakeel
@ 2013-07-24 13:55     ` Paul Eggleton
  2013-07-25  9:56       ` Burton, Ross
  0 siblings, 1 reply; 8+ messages in thread
From: Paul Eggleton @ 2013-07-24 13:55 UTC (permalink / raw)
  To: Muhammad Shakeel, Enrico Scholz; +Cc: openembedded-core

On Wednesday 24 July 2013 18:22:11 Muhammad Shakeel wrote:
> On 07/23/2013 03:46 PM, Enrico Scholz wrote:
> > "Shakeel, Muhammad"
> > 
> > <muhammad_shakeel-nmGgyN9QBj3QT0dZR+AlfA@public.gmane.org> writes:
> >> If systemd is supported DISTRO_FEATURE and sysvinit is not and also if
> >> systemd_unitdir contains a service file(s) then no need to keep init.d
> >> scripts for sysvinit compatibility.
> >> ...
> >> +            for filename in os.listdir(systemd_unitdir):
> > 
> >> +                if filename.endswith(".service"):
> > why only .service?  Other systemd files (.socket, .mount, .path, ...)
> > can also replace initscripts.
> 
> Other systemd unit files are normally accompanied with a .service file
> (this is just I observed and not mandatory).
> 
> If we come across any package which is not providing .service file but
> only some other type of systemd unit file for initscripts replacement
> then we can always add check for that type.
> According to systemd documentation there can be 10 types of systemd unit
> files and checking for all here can be a little overhead.

Would it work to simply check for any files instaled into systemd_unitdir?

Cheers,
Paul

-- 

Paul Eggleton
Intel Open Source Technology Centre


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

* Re: [PATCH] systemd: Remove init.d dir if systemd unit file is present and sysvinit not a distro feature
  2013-07-24 13:55     ` Paul Eggleton
@ 2013-07-25  9:56       ` Burton, Ross
  2013-07-25 10:10         ` Muhammad Shakeel
  0 siblings, 1 reply; 8+ messages in thread
From: Burton, Ross @ 2013-07-25  9:56 UTC (permalink / raw)
  To: Paul Eggleton; +Cc: Enrico Scholz, openembedded-core

On 24 July 2013 14:55, Paul Eggleton <paul.eggleton@linux.intel.com> wrote:
> Would it work to simply check for any files instaled into systemd_unitdir?

Agreed - the list of file types has grown over time so we'd been
constantly chasing systemd, and it's not like anything else is dropped
into this directory.

Ross


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

* Re: [PATCH] systemd: Remove init.d dir if systemd unit file is present and sysvinit not a distro feature
  2013-07-25  9:56       ` Burton, Ross
@ 2013-07-25 10:10         ` Muhammad Shakeel
  0 siblings, 0 replies; 8+ messages in thread
From: Muhammad Shakeel @ 2013-07-25 10:10 UTC (permalink / raw)
  To: Burton, Ross; +Cc: Paul Eggleton, openembedded-core, Enrico Scholz

On 07/25/2013 02:56 PM, Burton, Ross wrote:
> On 24 July 2013 14:55, Paul Eggleton <paul.eggleton@linux.intel.com> wrote:
>> Would it work to simply check for any files instaled into systemd_unitdir?
> Agreed - the list of file types has grown over time so we'd been
> constantly chasing systemd, and it's not like anything else is dropped
> into this directory.
>
> Ross
Ok, I will send a V2 with updated check.

Thanks


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

* Re: [PATCH] systemd: Remove init.d dir if systemd unit file is present and sysvinit not a distro feature
  2013-07-23 10:03 [PATCH] systemd: Remove init.d dir if systemd unit file is present and sysvinit not a distro feature Shakeel, Muhammad
  2013-07-23 10:46 ` Enrico Scholz
@ 2013-07-25 11:08 ` ChenQi
  2013-07-25 11:19   ` Muhammad Shakeel
  1 sibling, 1 reply; 8+ messages in thread
From: ChenQi @ 2013-07-25 11:08 UTC (permalink / raw)
  To: openembedded-core

On 07/23/2013 06:03 PM, Shakeel, Muhammad wrote:
> From: Muhammad Shakeel <muhammad_shakeel@mentor.com>
>
> If systemd is supported DISTRO_FEATURE and sysvinit is not and also if
> systemd_unitdir contains a service file(s) then no need to keep init.d scripts
> for sysvinit compatibility.
>
> Signed-off-by: Muhammad Shakeel <muhammad_shakeel@mentor.com>
> ---
>   meta/classes/systemd.bbclass |   19 +++++++++++++++++++
>   1 file changed, 19 insertions(+)
>
> diff --git a/meta/classes/systemd.bbclass b/meta/classes/systemd.bbclass
> index 9763faa..55f378e 100644
> --- a/meta/classes/systemd.bbclass
> +++ b/meta/classes/systemd.bbclass
> @@ -170,3 +170,22 @@ python rm_systemd_unitdir (){
>               shutil.rmtree(systemd_unitdir)
>   }
>   do_install[postfuncs] += "rm_systemd_unitdir "
> +
> +python rm_sysvinit_initddir (){
> +    import shutil
> +    if ("systemd" in d.getVar("DISTRO_FEATURES", True).split() and
> +        "sysvinit" not in d.getVar("DISTRO_FEATURES", True).split()):
> +        service_file_exists = False
> +        systemd_unitdir = oe.path.join(d.getVar("D", True), d.getVar('systemd_unitdir', True), "system")
> +        if os.path.exists(systemd_unitdir):
> +            for filename in os.listdir(systemd_unitdir):
> +                if filename.endswith(".service"):
> +                    service_file_exists = True
> +                    break
> +
> +        if service_file_exists:
> +            sysv_initddir = oe.path.join(d.getVar("D", True), d.getVar('INIT_D_DIR', True))
> +            if os.path.exists(sysv_initddir):
> +                shutil.rmtree(sysv_initddir)
> +}
> +do_install[postfuncs] += "rm_sysvinit_initddir "
Hi,

I just tried this patch out.
It resulted in the following warning.

WARNING: busybox: NOT adding alternative provide /etc/init.d/syslog: 
/etc/init.d/syslog.busybox does not exist

I know this warning is harmless. But it's still somewhat misleading. So 
are we going to do something about it?

//Chen Qi

//Chen Qi


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

* Re: [PATCH] systemd: Remove init.d dir if systemd unit file is present and sysvinit not a distro feature
  2013-07-25 11:08 ` ChenQi
@ 2013-07-25 11:19   ` Muhammad Shakeel
  0 siblings, 0 replies; 8+ messages in thread
From: Muhammad Shakeel @ 2013-07-25 11:19 UTC (permalink / raw)
  To: ChenQi; +Cc: openembedded-core

On 07/25/2013 04:08 PM, ChenQi wrote:
> I just tried this patch out.
> It resulted in the following warning.
>
> WARNING: busybox: NOT adding alternative provide /etc/init.d/syslog: 
> /etc/init.d/syslog.busybox does not exist
>
> I know this warning is harmless. But it's still somewhat misleading. 
> So are we going to do something about it?
>
Yes, I am going to send a V2 and that will handle this warning.

Thanks


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

end of thread, other threads:[~2013-07-25 11:19 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-23 10:03 [PATCH] systemd: Remove init.d dir if systemd unit file is present and sysvinit not a distro feature Shakeel, Muhammad
2013-07-23 10:46 ` Enrico Scholz
2013-07-24 13:22   ` Muhammad Shakeel
2013-07-24 13:55     ` Paul Eggleton
2013-07-25  9:56       ` Burton, Ross
2013-07-25 10:10         ` Muhammad Shakeel
2013-07-25 11:08 ` ChenQi
2013-07-25 11:19   ` Muhammad Shakeel

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.