>>>>> On Sun, 16 Jun 2024, Florian Schmaus wrote:

> First, the content of README.gento will only be shown on new

Typo.

> +greadme_pkg_postinst() {
> +     debug-print-function ${FUNCNAME} "${@}"
> +
> +     if [[ ! -v _GREADME_SHOW ]]; then
> +             die "_GREADME_SHOW not set. Did you call greadme_pkg_preinst?"
> +     fi
> +
> +     if [[ -z ${_GREADME_SHOW} ]]; then
> +             # If _GREADME_SHOW is empty, then there is no reason to show 
> the contents.
> +             return
> +     fi
> +
> +     local greadme="${EROOT}${_GREADME_REL_PATH}"
> +
> +     if [[ ! -f ${greadme} ]]; then
> +             ewarn "Unable to show ${_GREADME_FILENAME}, file not installed 
> (FEATURES=nodoc enabled?)."

I still think that the file's contents should be saved in a variable,
which would avoid the problem. (Presumably, pkg_preinst wouldn't be
necessary then either, because the variable is still available in the
postinst phase, whereas ${D} isn't.)

In any case, showing this warning every time might be annoying.
How about showing it only the first time, i.e. if REPLACING_VERSIONS
is empty?

> +             return
> +     fi
> +
> +     local line
> +     while read -r line; do elog "${line}"; done < "${greadme}"
> +     elog ""
> +     elog "(Note: Above message is only printed the first time package is"
> +     elog "installed or if the message changes on update. Please look at"
> +     elog "${EPREFIX}${_GREADME_REL_PATH} for future reference)"
> +}

Attachment: signature.asc
Description: PGP signature

Reply via email to