[OE-core] [PATCH 1/2] dhcp: move dhcp leases files handling to postinst/postrm

Phil Blundell philb at gnu.org
Mon Feb 6 11:27:51 UTC 2012


On Mon, 2012-02-06 at 09:21 -0200, Otavio Salvador wrote:
> On Mon, Feb 6, 2012 at 09:13, Phil Blundell <philb at gnu.org> wrote:
>         On Mon, 2012-02-06 at 11:03 +0000, Otavio Salvador wrote:
>         > +pkg_postrm_dhcp-server() {
>         > +    rm -f $D/${localstatedir}/lib/dhcp/dhcpd.leases
>         > +    rm -f $D/${localstatedir}/lib/dhcp/dhcpd6.leases
>         > +    rmdir $D/${localstatedir}/lib/dhcp
>         > +}
>         > +
>         > +pkg_postrm_dhcp-client() {
>         > +    rm -f $D/${localstatedir}/lib/dhcp/dhclient.leases
>         > +    rm -f $D/${localstatedir}/lib/dhcp/dhclient6.leases
>         > +    rmdir $D/${localstatedir}/lib/dhcp
>         
>         
>         Are those rmdirs not going to fail if you try to remove one
>         package with
>         the other one still installed?
> 
> 
> I think they will. I'll add an || true on it.

If you do that then you'd also need to redirect stderr to avoid getting
error messages on the console.  Might be better to wrap the rmdir calls
in a check to see if the directory is empty.

p.







More information about the Openembedded-core mailing list