All of lore.kernel.org
 help / color / mirror / Atom feed
* Problems with postinstall
@ 2014-06-05 10:44 Neuer User
  2014-06-06  6:16 ` Neuer User
  0 siblings, 1 reply; 9+ messages in thread
From: Neuer User @ 2014-06-05 10:44 UTC (permalink / raw)
  To: yocto

Hi

I am desperately trying to get some postinstall scripts working. They
should replace some defualt files with custom files I have. They are all
in one package. The package looks like this:

do_install() {
    install -d ${D}${sbindir}
    install -m 0700 ${S}/sbin/* ${D}${sbindir}

    install -d ${D}${bindir}
    install -m 0755 ${S}/bin/LEDstatus ${D}${bindir}

    install -d ${D}/etc/udev/rules.d
    install -m 0644 ${S}/udev/* ${D}/etc/udev/rules.d/

    install -d ${D}/etc/ssh
    install -m 0600 ${S}/ssh/ssh_* ${D}/etc/ssh/
    install -m 0644 ${S}/ssh/authorized_keys ${D}/etc/ssh/

    install -d ${D}/etc/gnupg
    install -m 0600 ${S}/gnupg/trustedkeys.gpg ${D}/etc/gnupg/
}

# Overwrite some configuration data with specific files
pkg_postinst_${PN} () {
    install -o root -g root -m 0600 ${S}/ssh/sshd_config ${D}/etc/ssh/
    install -m 0755 ${S}/etc/rc.local ${D}/etc/
    install -m 0644 ${S}/etc/watchdog.conf ${D}/etc/
    install -m 0400 ${S}/etc/shadow ${D}/etc/
    install -m 0440 ${S}/etc/sudoers ${D}/etc/
    install -d ${D}/etc/default
    install -o root -g root -m 0644 ${S}/etc/default-ntpdate
${D}/etc/default/ntpdate
}

RDEPENDS_${PN} += "ntpdate udev ssh sudo"

FILES_${PN} += "/*"


I even tried changing the ownership of the files, but that did not
change aything.

Am I doing this completely wrong?

Thanks for any hints

Michael



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

* Re: Problems with postinstall
  2014-06-05 10:44 Problems with postinstall Neuer User
@ 2014-06-06  6:16 ` Neuer User
  2014-06-06  7:11   ` Søren Holm
  2014-06-06 10:54   ` Paul Barker
  0 siblings, 2 replies; 9+ messages in thread
From: Neuer User @ 2014-06-06  6:16 UTC (permalink / raw)
  To: yocto

Nobody using any postinstalls?

I am still wondering why the postinstall does not work. I don't get any
error messages. The files are just not installed.

Am 05.06.2014 12:44, schrieb Neuer User:
> Hi
> 
> I am desperately trying to get some postinstall scripts working. They
> should replace some defualt files with custom files I have. They are all
> in one package. The package looks like this:
> 
> do_install() {
>     install -d ${D}${sbindir}
>     install -m 0700 ${S}/sbin/* ${D}${sbindir}
> 
>     install -d ${D}${bindir}
>     install -m 0755 ${S}/bin/LEDstatus ${D}${bindir}
> 
>     install -d ${D}/etc/udev/rules.d
>     install -m 0644 ${S}/udev/* ${D}/etc/udev/rules.d/
> 
>     install -d ${D}/etc/ssh
>     install -m 0600 ${S}/ssh/ssh_* ${D}/etc/ssh/
>     install -m 0644 ${S}/ssh/authorized_keys ${D}/etc/ssh/
> 
>     install -d ${D}/etc/gnupg
>     install -m 0600 ${S}/gnupg/trustedkeys.gpg ${D}/etc/gnupg/
> }
> 
> # Overwrite some configuration data with specific files
> pkg_postinst_${PN} () {
>     install -o root -g root -m 0600 ${S}/ssh/sshd_config ${D}/etc/ssh/
>     install -m 0755 ${S}/etc/rc.local ${D}/etc/
>     install -m 0644 ${S}/etc/watchdog.conf ${D}/etc/
>     install -m 0400 ${S}/etc/shadow ${D}/etc/
>     install -m 0440 ${S}/etc/sudoers ${D}/etc/
>     install -d ${D}/etc/default
>     install -o root -g root -m 0644 ${S}/etc/default-ntpdate
> ${D}/etc/default/ntpdate
> }
> 
> RDEPENDS_${PN} += "ntpdate udev ssh sudo"
> 
> FILES_${PN} += "/*"
> 
> 
> I even tried changing the ownership of the files, but that did not
> change aything.
> 
> Am I doing this completely wrong?
> 
> Thanks for any hints
> 
> Michael
> 




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

* Re: Problems with postinstall
  2014-06-06  6:16 ` Neuer User
@ 2014-06-06  7:11   ` Søren Holm
  2014-06-06 10:54   ` Paul Barker
  1 sibling, 0 replies; 9+ messages in thread
From: Søren Holm @ 2014-06-06  7:11 UTC (permalink / raw)
  To: yocto; +Cc: Neuer User

Hi 

postinstall is afaik run during installation. And that could very well be on 
the actual target. So ${S} etc. are not available. The step is just for steps 
that *need* to run on the actual target utilizing the files that where install 
in do_install.


Fredag den 6. juni 2014 08:16:39 skrev Neuer User:
> Nobody using any postinstalls?
> 
> I am still wondering why the postinstall does not work. I don't get any
> error messages. The files are just not installed.
> 
> Am 05.06.2014 12:44, schrieb Neuer User:
> > Hi
> > 
> > I am desperately trying to get some postinstall scripts working. They
> > should replace some defualt files with custom files I have. They are all
> > in one package. The package looks like this:
> > 
> > do_install() {
> > 
> >     install -d ${D}${sbindir}
> >     install -m 0700 ${S}/sbin/* ${D}${sbindir}
> >     
> >     install -d ${D}${bindir}
> >     install -m 0755 ${S}/bin/LEDstatus ${D}${bindir}
> >     
> >     install -d ${D}/etc/udev/rules.d
> >     install -m 0644 ${S}/udev/* ${D}/etc/udev/rules.d/
> >     
> >     install -d ${D}/etc/ssh
> >     install -m 0600 ${S}/ssh/ssh_* ${D}/etc/ssh/
> >     install -m 0644 ${S}/ssh/authorized_keys ${D}/etc/ssh/
> >     
> >     install -d ${D}/etc/gnupg
> >     install -m 0600 ${S}/gnupg/trustedkeys.gpg ${D}/etc/gnupg/
> > 
> > }
> > 
> > # Overwrite some configuration data with specific files
> > pkg_postinst_${PN} () {
> > 
> >     install -o root -g root -m 0600 ${S}/ssh/sshd_config ${D}/etc/ssh/
> >     install -m 0755 ${S}/etc/rc.local ${D}/etc/
> >     install -m 0644 ${S}/etc/watchdog.conf ${D}/etc/
> >     install -m 0400 ${S}/etc/shadow ${D}/etc/
> >     install -m 0440 ${S}/etc/sudoers ${D}/etc/
> >     install -d ${D}/etc/default
> >     install -o root -g root -m 0644 ${S}/etc/default-ntpdate
> > 
> > ${D}/etc/default/ntpdate
> > }
> > 
> > RDEPENDS_${PN} += "ntpdate udev ssh sudo"
> > 
> > FILES_${PN} += "/*"
> > 
> > 
> > I even tried changing the ownership of the files, but that did not
> > change aything.
> > 
> > Am I doing this completely wrong?
> > 
> > Thanks for any hints
> > 
> > Michael

-- 
Søren Holm



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

* Re: Problems with postinstall
  2014-06-06  6:16 ` Neuer User
  2014-06-06  7:11   ` Søren Holm
@ 2014-06-06 10:54   ` Paul Barker
  2014-06-06 11:08     ` Neuer User
  1 sibling, 1 reply; 9+ messages in thread
From: Paul Barker @ 2014-06-06 10:54 UTC (permalink / raw)
  To: Neuer User; +Cc: Yocto discussion list

On 6 June 2014 07:16, Neuer User <auslands-kv@gmx.de> wrote:
> Nobody using any postinstalls?
>
> I am still wondering why the postinstall does not work. I don't get any
> error messages. The files are just not installed.
>

I usually leave things more than a day before sending a ping email,
people can be busy but usually you'll get replies within a couple of
days on this list.

>>
>> # Overwrite some configuration data with specific files
>> pkg_postinst_${PN} () {
>>     install -o root -g root -m 0600 ${S}/ssh/sshd_config ${D}/etc/ssh/
>>     install -m 0755 ${S}/etc/rc.local ${D}/etc/
>>     install -m 0644 ${S}/etc/watchdog.conf ${D}/etc/
>>     install -m 0400 ${S}/etc/shadow ${D}/etc/
>>     install -m 0440 ${S}/etc/sudoers ${D}/etc/
>>     install -d ${D}/etc/default
>>     install -o root -g root -m 0644 ${S}/etc/default-ntpdate
>> ${D}/etc/default/ntpdate
>> }
>>

The postinst is executed by the package manager when the package is
installed. If that installation takes place during do_rootfs, ${D}
will refer to the rootfs directory for the image being built and ${S}
will probably refer to something else to do with the image recipe but
I'm not entirely sure on the details. If the installation takes place
on the device, or the postinst is delayed until the first boot, ${D}
and ${S} will not be set.

Hope this helps,

-- 
Paul Barker

Email: paul@paulbarker.me.uk
http://www.paulbarker.me.uk


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

* Re: Problems with postinstall
  2014-06-06 10:54   ` Paul Barker
@ 2014-06-06 11:08     ` Neuer User
  2014-06-06 11:19       ` Jacob Kroon
  2014-06-06 12:31       ` Burton, Ross
  0 siblings, 2 replies; 9+ messages in thread
From: Neuer User @ 2014-06-06 11:08 UTC (permalink / raw)
  To: yocto

Am 06.06.2014 12:54, schrieb Paul Barker:
> I usually leave things more than a day before sending a ping email,
> people can be busy but usually you'll get replies within a couple of
> days on this list.
>

Sorry, I guess these 18h were driving me crazy as I don't understand why
it is not working. I actually thought, it had already been working
earlier...

>>>
>>> # Overwrite some configuration data with specific files
>>> pkg_postinst_${PN} () {
>>>     install -o root -g root -m 0600 ${S}/ssh/sshd_config ${D}/etc/ssh/
>>>     install -m 0755 ${S}/etc/rc.local ${D}/etc/
>>>     install -m 0644 ${S}/etc/watchdog.conf ${D}/etc/
>>>     install -m 0400 ${S}/etc/shadow ${D}/etc/
>>>     install -m 0440 ${S}/etc/sudoers ${D}/etc/
>>>     install -d ${D}/etc/default
>>>     install -o root -g root -m 0644 ${S}/etc/default-ntpdate
>>> ${D}/etc/default/ntpdate
>>> }
>>>
> 
> The postinst is executed by the package manager when the package is
> installed. If that installation takes place during do_rootfs, ${D}
> will refer to the rootfs directory for the image being built and ${S}
> will probably refer to something else to do with the image recipe but
> I'm not entirely sure on the details. If the installation takes place
> on the device, or the postinst is delayed until the first boot, ${D}
> and ${S} will not be set.
> 
> Hope this helps,
> 

So, I guess there are now two possibilities:
a.) The postinstall is not done at all.
b.) The postinstall is done, but before the other packages are
installed, which overwrite the files again. Is this possible? If yes,
howto specify that this postinstall should really be done last of all?

Thanks a lot

Michael



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

* Re: Problems with postinstall
  2014-06-06 11:08     ` Neuer User
@ 2014-06-06 11:19       ` Jacob Kroon
  2014-06-06 11:24         ` Neuer User
  2014-06-06 12:31       ` Burton, Ross
  1 sibling, 1 reply; 9+ messages in thread
From: Jacob Kroon @ 2014-06-06 11:19 UTC (permalink / raw)
  To: Neuer User; +Cc: yocto

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

On Fri, Jun 6, 2014 at 1:08 PM, Neuer User <auslands-kv@gmx.de> wrote:

> Am 06.06.2014 12:54, schrieb Paul Barker:
> > I usually leave things more than a day before sending a ping email,
> > people can be busy but usually you'll get replies within a couple of
> > days on this list.
> >
>
> Sorry, I guess these 18h were driving me crazy as I don't understand why
> it is not working. I actually thought, it had already been working
> earlier...
>
> >>>
> >>> # Overwrite some configuration data with specific files
> >>> pkg_postinst_${PN} () {
> >>>     install -o root -g root -m 0600 ${S}/ssh/sshd_config ${D}/etc/ssh/
> >>>     install -m 0755 ${S}/etc/rc.local ${D}/etc/
> >>>     install -m 0644 ${S}/etc/watchdog.conf ${D}/etc/
> >>>     install -m 0400 ${S}/etc/shadow ${D}/etc/
> >>>     install -m 0440 ${S}/etc/sudoers ${D}/etc/
> >>>     install -d ${D}/etc/default
> >>>     install -o root -g root -m 0644 ${S}/etc/default-ntpdate
> >>> ${D}/etc/default/ntpdate
> >>> }
> >>>
> >
> > The postinst is executed by the package manager when the package is
> > installed. If that installation takes place during do_rootfs, ${D}
> > will refer to the rootfs directory for the image being built and ${S}
> > will probably refer to something else to do with the image recipe but
> > I'm not entirely sure on the details. If the installation takes place
> > on the device, or the postinst is delayed until the first boot, ${D}
> > and ${S} will not be set.
> >
> > Hope this helps,
> >
>
> So, I guess there are now two possibilities:
> a.) The postinstall is not done at all.
> b.) The postinstall is done, but before the other packages are
> installed, which overwrite the files again. Is this possible? If yes,
> howto specify that this postinstall should really be done last of all?
>
>
I'm not sure if this helps, but you can specify rootfs-post-process
commands in your image recipe:

setup_my_image() {
    # do stuff
}

ROOTFS_POSTPROCESS_COMMAND += 'setup_my_image ;'

This will run after the rootfs is created from the package installations

/Jacob

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

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

* Re: Problems with postinstall
  2014-06-06 11:19       ` Jacob Kroon
@ 2014-06-06 11:24         ` Neuer User
  0 siblings, 0 replies; 9+ messages in thread
From: Neuer User @ 2014-06-06 11:24 UTC (permalink / raw)
  To: yocto

Am 06.06.2014 13:19, schrieb Jacob Kroon:
> I'm not sure if this helps, but you can specify rootfs-post-process
> commands in your image recipe:
> 
> setup_my_image() {
>     # do stuff
> }
> 
> ROOTFS_POSTPROCESS_COMMAND += 'setup_my_image ;'
> 
> This will run after the rootfs is created from the package installations
> 
> /Jacob

Thanks, that sounds like a good idea. Will try that out. :-)




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

* Re: Problems with postinstall
  2014-06-06 11:08     ` Neuer User
  2014-06-06 11:19       ` Jacob Kroon
@ 2014-06-06 12:31       ` Burton, Ross
  2014-06-06 12:37         ` Neuer User
  1 sibling, 1 reply; 9+ messages in thread
From: Burton, Ross @ 2014-06-06 12:31 UTC (permalink / raw)
  To: Neuer User; +Cc: yocto@yoctoproject.org

On 6 June 2014 12:08, Neuer User <auslands-kv@gmx.de> wrote:
>> The postinst is executed by the package manager when the package is
>> installed. If that installation takes place during do_rootfs, ${D}
>> will refer to the rootfs directory for the image being built and ${S}
>> will probably refer to something else to do with the image recipe but
>> I'm not entirely sure on the details. If the installation takes place
>> on the device, or the postinst is delayed until the first boot, ${D}
>> and ${S} will not be set.
>>
>> Hope this helps,
>>
>
> So, I guess there are now two possibilities:
> a.) The postinstall is not done at all.
> b.) The postinstall is done, but before the other packages are
> installed, which overwrite the files again. Is this possible? If yes,
> howto specify that this postinstall should really be done last of all?

Basically a postinstall is *not* the way of doing this.  You can't
control when it runs and when it does, you can't get to the files you
want to install.

If the files are installed by other packages then use a bbappend to
change those files.  If nothing installs them already, write a recipe
to install them.  If there are changes that can only be done at rootfs
time, then use a rootfs postproces command.

Ross


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

* Re: Problems with postinstall
  2014-06-06 12:31       ` Burton, Ross
@ 2014-06-06 12:37         ` Neuer User
  0 siblings, 0 replies; 9+ messages in thread
From: Neuer User @ 2014-06-06 12:37 UTC (permalink / raw)
  To: yocto

Am 06.06.2014 14:31, schrieb Burton, Ross:
> On 6 June 2014 12:08, Neuer User <auslands-kv@gmx.de> wrote:
>>> The postinst is executed by the package manager when the package is
>>> installed. If that installation takes place during do_rootfs, ${D}
>>> will refer to the rootfs directory for the image being built and ${S}
>>> will probably refer to something else to do with the image recipe but
>>> I'm not entirely sure on the details. If the installation takes place
>>> on the device, or the postinst is delayed until the first boot, ${D}
>>> and ${S} will not be set.
>>>
>>> Hope this helps,
>>>
>>
>> So, I guess there are now two possibilities:
>> a.) The postinstall is not done at all.
>> b.) The postinstall is done, but before the other packages are
>> installed, which overwrite the files again. Is this possible? If yes,
>> howto specify that this postinstall should really be done last of all?
> 
> Basically a postinstall is *not* the way of doing this.  You can't
> control when it runs and when it does, you can't get to the files you
> want to install.
> 
> If the files are installed by other packages then use a bbappend to
> change those files.  If nothing installs them already, write a recipe
> to install them.  If there are changes that can only be done at rootfs
> time, then use a rootfs postproces command.
> 
> Ross
> 
Thanks Ross

I guess the "rootfs postprocess command" is the way to go.

I have already separated the files into new files (which get installed
as a normal install process by that package) and files that overwrite
other package files.

I guess, I could for most (but not all) files add a bbappend to the
relevant original package, but it would be more complicated than doing
it all together at rootfs postprocess.

Thanks for all the help. I will try the rootfs postprocess today :-)

Cheers

Michael



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

end of thread, other threads:[~2014-06-07 10:12 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-05 10:44 Problems with postinstall Neuer User
2014-06-06  6:16 ` Neuer User
2014-06-06  7:11   ` Søren Holm
2014-06-06 10:54   ` Paul Barker
2014-06-06 11:08     ` Neuer User
2014-06-06 11:19       ` Jacob Kroon
2014-06-06 11:24         ` Neuer User
2014-06-06 12:31       ` Burton, Ross
2014-06-06 12:37         ` Neuer User

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.