Re: [PATCH] mount-boot.eclass: do not create /boot/.keep in pkg_prerm

Mike Gilbert <[email protected]> Thu, 18 Jun 2026 13:50:08 -0400
Newsgroups gmane.linux.gentoo.devel
Message-ID <CAJ0EP425nyO2vDS=sKsN573YDFsvQNo+zuSgxG=x_tpBaW9Dfg@mail.gmail.com>
On Thu, Jun 18, 2026 at 1:39 PM Mike Gilbert <[email protected]> wrote:
>
> On Thu, Jun 18, 2026 at 12:03 PM Ulrich Müller <[email protected]> wrote:
> >
> > >>>>> On Thu, 18 Jun 2026, Mike Gilbert wrote:
> >
> > >> > +     if [[ -n ${BOOT_EXISTS} && ! -d ${EROOT}/boot ]]; then
> > >> > +             # Recreate /boot in case it got un-merged
> > >> > +             mkdir "${EROOT}"/boot
> > >> >       fi
> > >>
> > >> That looks like a horrible hack.
> >
> > > What's so horrible about it? It accomplishes the same goal without
> > > leaving an orphaned file behind. If it will cause problems, please
> > > elaborate.
> >
> > Sorry, probably I am missing something here. What is the exact scenario
> > where an unmerge can remove the /boot directory, so that it must be
> > recreated?
> >
> > - If /boot is on a separate FS, then the eclass will have made sure that
> >   it is mounted at this point, so rmdir won't succeed (and most likely
> >   the dir won't be empty anyway).
>
> Right, this scenario isn't an issue.
>
> > - If /boot a normal directory as part of the root FS, then it should
> >   contain a .keep* file owned by baselayout.
>
> baselayout has not installed a .keep file for a few years. See bug 888807.
>
> If ${EROOT}/boot is not a mount point, unmerging a package which
> installs files under that directory may result in the directory being
> removed.

That said, I guess there is really no need to keep an empty /boot
directory around if it is empty and not a mount point anyway.

Maybe we should just drop this hack from mount-boot.eclass entirely?