All of lore.kernel.org
 help / color / mirror / Atom feed
* Adding custom scripts to home directory and /etc/init.d/*
@ 2018-03-05 21:18 Giordon Stark
  2018-03-06  0:36 ` Anuj Mittal
  0 siblings, 1 reply; 3+ messages in thread
From: Giordon Stark @ 2018-03-05 21:18 UTC (permalink / raw)
  To: N:

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

Hi all,

I am wondering if there's a nice pattern or workflow within Yocto where I
can add a custom shell script to /etc/init.d for the purposes of running it
on OS boot (which also requires running update.rc I believe) as well as
prepopulating the home directory with some files of my choosing.

If someone could point me in the right direction, that would be great!

Giordon
-- 
Giordon Stark

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

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

* Re: Adding custom scripts to home directory and /etc/init.d/*
  2018-03-05 21:18 Adding custom scripts to home directory and /etc/init.d/* Giordon Stark
@ 2018-03-06  0:36 ` Anuj Mittal
  2018-03-06 16:19   ` Giordon Stark
  0 siblings, 1 reply; 3+ messages in thread
From: Anuj Mittal @ 2018-03-06  0:36 UTC (permalink / raw)
  To: Giordon Stark, N:

On 03/06/2018 05:18 AM, Giordon Stark wrote:
> Hi all,
> 
> I am wondering if there's a nice pattern or workflow within Yocto where
> I can add a custom shell script to /etc/init.d for the purposes of
> running it on OS boot (which also requires running update.rc I believe)

You can inherit update-rc.d class and define INITSCRIPT_NAME/PARAMS in
your recipe.

https://www.yoctoproject.org/docs/latest/ref-manual/ref-manual.html#ref-classes-update-rc.d

> as well as prepopulating the home directory with some files of my choosing.
> 
> If someone could point me in the right direction, that would be great!
> 
> Giordon
> -- 
> Giordon Stark
> 
> 



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

* Re: Adding custom scripts to home directory and /etc/init.d/*
  2018-03-06  0:36 ` Anuj Mittal
@ 2018-03-06 16:19   ` Giordon Stark
  0 siblings, 0 replies; 3+ messages in thread
From: Giordon Stark @ 2018-03-06 16:19 UTC (permalink / raw)
  To: Anuj Mittal; +Cc: N:

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

Thanks Anuj,

This is where I ended up for now (let me know if this looks about right):

# see https://stackoverflow.com/a/40768781
DESCRIPTION = "Clock Configuration via I2C"
SRC_URI = "file://init-clock"
LICENSE = "MIT"
LIC_FILES_CHKSUM =
"file://${WORKDIR}/init-clock;beginline=2;endline=19;md5=846eef20187f1d9f7f2af0d254faa171"

# these 3 lines will have the script run on boot
inherit update-rc.d
INITSCRIPT_PACKAGES = "${PN}"
INITSCRIPT_NAME = "init-clock"

# install it in the correct location for update-rc.d
do_install() {
  install -d ${D}${INIT_D_DIR}
  install -m 0755 ${WORKDIR}/init-clock ${D}${INIT_D_DIR}/init-clock
}

*# package it as it is not installed in a standard location*
*FILES_${PN} = "${INIT_D_DIR}/init-clock"*

The one thing I'm not 100% sure I understand is the last line that I
bolded, but it seems to be needed.

Thanks,

Giordon

On Mon, Mar 5, 2018 at 6:36 PM Anuj Mittal <anuj.mittal@intel.com> wrote:

> On 03/06/2018 05:18 AM, Giordon Stark wrote:
> > Hi all,
> >
> > I am wondering if there's a nice pattern or workflow within Yocto where
> > I can add a custom shell script to /etc/init.d for the purposes of
> > running it on OS boot (which also requires running update.rc I believe)
>
> You can inherit update-rc.d class and define INITSCRIPT_NAME/PARAMS in
> your recipe.
>
>
> https://www.yoctoproject.org/docs/latest/ref-manual/ref-manual.html#ref-classes-update-rc.d
>
> > as well as prepopulating the home directory with some files of my
> choosing.
> >
> > If someone could point me in the right direction, that would be great!
> >
> > Giordon
> > --
> > Giordon Stark
> >
> >
>
> --
Giordon Stark

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

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

end of thread, other threads:[~2018-03-06 16:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-05 21:18 Adding custom scripts to home directory and /etc/init.d/* Giordon Stark
2018-03-06  0:36 ` Anuj Mittal
2018-03-06 16:19   ` Giordon Stark

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.