Openembedded Core Discussions
 help / color / mirror / Atom feed
* is it best practice to use ${sysconfdir} rather than hard-coding "/etc"?
@ 2012-06-30 13:25 Robert P. J. Day
  2012-06-30 13:29 ` Martin Jansa
  2012-06-30 14:34 ` Andrei Gherzan
  0 siblings, 2 replies; 5+ messages in thread
From: Robert P. J. Day @ 2012-06-30 13:25 UTC (permalink / raw)
  To: OE Core mailing list


  i suspect i know the answer to this, but in the recipe file
usbinit.bb, we have:

do_install() {
    install -d ${D}/etc
    install -d ${D}/etc/init.d
    install usb-gether ${D}/etc/init.d
}

  i'm guessing that would more properly be coded:

do_install() {
    install -d ${D}${sysconfdir}
    install -d ${D}${sysconfdir}/init.d
    install usb-gether ${D}${sysconfdir}/init.d
}

  the end result is functionally identical, of course, it's all just a
matter of style.

rday

-- 

========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================



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

* Re: is it best practice to use ${sysconfdir} rather than hard-coding "/etc"?
  2012-06-30 13:25 is it best practice to use ${sysconfdir} rather than hard-coding "/etc"? Robert P. J. Day
@ 2012-06-30 13:29 ` Martin Jansa
  2012-06-30 13:41   ` Robert P. J. Day
  2012-06-30 14:34 ` Andrei Gherzan
  1 sibling, 1 reply; 5+ messages in thread
From: Martin Jansa @ 2012-06-30 13:29 UTC (permalink / raw)
  To: Patches and discussions about the oe-core layer

[-- Attachment #1: Type: text/plain, Size: 1489 bytes --]

On Sat, Jun 30, 2012 at 09:25:57AM -0400, Robert P. J. Day wrote:
> 
>   i suspect i know the answer to this, but in the recipe file
> usbinit.bb, we have:
> 
> do_install() {
>     install -d ${D}/etc
>     install -d ${D}/etc/init.d
>     install usb-gether ${D}/etc/init.d
> }
> 
>   i'm guessing that would more properly be coded:
> 
> do_install() {
>     install -d ${D}${sysconfdir}
>     install -d ${D}${sysconfdir}/init.d
>     install usb-gether ${D}${sysconfdir}/init.d
> }
> 
>   the end result is functionally identical, of course, it's all just a
> matter of style.

using sysconfdir is better as someone can define it to different value
then 'etc' and the later will still work (be consistent across image)

Cheers,

> 
> rday
> 
> -- 
> 
> ========================================================================
> Robert P. J. Day                                 Ottawa, Ontario, CANADA
>                         http://crashcourse.ca
> 
> Twitter:                                       http://twitter.com/rpjday
> LinkedIn:                               http://ca.linkedin.com/in/rpjday
> ========================================================================
> 
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core

-- 
Martin 'JaMa' Jansa     jabber: Martin.Jansa@gmail.com

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 205 bytes --]

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

* Re: is it best practice to use ${sysconfdir} rather than hard-coding "/etc"?
  2012-06-30 13:29 ` Martin Jansa
@ 2012-06-30 13:41   ` Robert P. J. Day
  2012-06-30 14:45     ` Mark Hatle
  0 siblings, 1 reply; 5+ messages in thread
From: Robert P. J. Day @ 2012-06-30 13:41 UTC (permalink / raw)
  To: Patches and discussions about the oe-core layer

On Sat, 30 Jun 2012, Martin Jansa wrote:

> On Sat, Jun 30, 2012 at 09:25:57AM -0400, Robert P. J. Day wrote:
> >
> >   i suspect i know the answer to this, but in the recipe file
> > usbinit.bb, we have:
> >
> > do_install() {
> >     install -d ${D}/etc
> >     install -d ${D}/etc/init.d
> >     install usb-gether ${D}/etc/init.d
> > }
> >
> >   i'm guessing that would more properly be coded:
> >
> > do_install() {
> >     install -d ${D}${sysconfdir}
> >     install -d ${D}${sysconfdir}/init.d
> >     install usb-gether ${D}${sysconfdir}/init.d
> > }
> >
> >   the end result is functionally identical, of course, it's all just a
> > matter of style.
>
> using sysconfdir is better as someone can define it to different value
> then 'etc' and the later will still work (be consistent across image)

  there are definitely a number of examples of hard-coded "/etc" in
the recipes, but i'm not about to run around cleaning them -- i just
wanted to make sure there was no compelling reason to do that
hard-coding.  thanks.

rday

-- 

========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================



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

* Re: is it best practice to use ${sysconfdir} rather than hard-coding "/etc"?
  2012-06-30 13:25 is it best practice to use ${sysconfdir} rather than hard-coding "/etc"? Robert P. J. Day
  2012-06-30 13:29 ` Martin Jansa
@ 2012-06-30 14:34 ` Andrei Gherzan
  1 sibling, 0 replies; 5+ messages in thread
From: Andrei Gherzan @ 2012-06-30 14:34 UTC (permalink / raw)
  To: Patches and discussions about the oe-core layer

[-- Attachment #1: Type: text/plain, Size: 1363 bytes --]

As a general rule is it better to use any "path variable" instead of a
hard-coded one.

@g

On Sat, Jun 30, 2012 at 4:25 PM, Robert P. J. Day <rpjday@crashcourse.ca>wrote:

>
>  i suspect i know the answer to this, but in the recipe file
> usbinit.bb, we have:
>
> do_install() {
>    install -d ${D}/etc
>    install -d ${D}/etc/init.d
>    install usb-gether ${D}/etc/init.d
> }
>
>  i'm guessing that would more properly be coded:
>
> do_install() {
>    install -d ${D}${sysconfdir}
>    install -d ${D}${sysconfdir}/init.d
>    install usb-gether ${D}${sysconfdir}/init.d
> }
>
>  the end result is functionally identical, of course, it's all just a
> matter of style.
>
> rday
>
> --
>
> ========================================================================
> Robert P. J. Day                                 Ottawa, Ontario, CANADA
>                        http://crashcourse.ca
>
> Twitter:                                       http://twitter.com/rpjday
> LinkedIn:                               http://ca.linkedin.com/in/rpjday
> ========================================================================
>
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
>

[-- Attachment #2: Type: text/html, Size: 2107 bytes --]

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

* Re: is it best practice to use ${sysconfdir} rather than hard-coding "/etc"?
  2012-06-30 13:41   ` Robert P. J. Day
@ 2012-06-30 14:45     ` Mark Hatle
  0 siblings, 0 replies; 5+ messages in thread
From: Mark Hatle @ 2012-06-30 14:45 UTC (permalink / raw)
  To: openembedded-core

On 6/30/12 8:41 AM, Robert P. J. Day wrote:
> On Sat, 30 Jun 2012, Martin Jansa wrote:
>
>> On Sat, Jun 30, 2012 at 09:25:57AM -0400, Robert P. J. Day wrote:
>>>
>>>    i suspect i know the answer to this, but in the recipe file
>>> usbinit.bb, we have:
>>>
>>> do_install() {
>>>      install -d ${D}/etc
>>>      install -d ${D}/etc/init.d
>>>      install usb-gether ${D}/etc/init.d
>>> }
>>>
>>>    i'm guessing that would more properly be coded:
>>>
>>> do_install() {
>>>      install -d ${D}${sysconfdir}
>>>      install -d ${D}${sysconfdir}/init.d
>>>      install usb-gether ${D}${sysconfdir}/init.d
>>> }
>>>
>>>    the end result is functionally identical, of course, it's all just a
>>> matter of style.
>>
>> using sysconfdir is better as someone can define it to different value
>> then 'etc' and the later will still work (be consistent across image)
>
>    there are definitely a number of examples of hard-coded "/etc" in
> the recipes, but i'm not about to run around cleaning them -- i just
> wanted to make sure there was no compelling reason to do that
> hard-coding.  thanks.

There are instances where programs have hard coded paths, such as /etc/init.d. 
In those cases, it may be better to do the install and FILES_ work using the 
same hard coded path, since the item won't work if the variable version is renamed.

But for most things that use autoconf, the install locations are completely 
variable, so using the path variables is preferred.

My rule of thumb, if in doubt, use the path variables.  If you know that the 
path variables won't work for some reason -- either fix the problem, or use hard 
coded paths... IMHO this will help someone discover places that need to be 
modified if they ever change the value.

--Mark

> rday
>





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

end of thread, other threads:[~2012-06-30 14:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-30 13:25 is it best practice to use ${sysconfdir} rather than hard-coding "/etc"? Robert P. J. Day
2012-06-30 13:29 ` Martin Jansa
2012-06-30 13:41   ` Robert P. J. Day
2012-06-30 14:45     ` Mark Hatle
2012-06-30 14:34 ` Andrei Gherzan

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