Did you know that new* helpers can read from stdin? Well, now you know! So instead of writing to a temporary file you can install your inline text straight to the destination:
src_install() {
# old code
cat <<-EOF >"${T}"/mywrapper || die
#!/bin/sh
exec do-something --with-some-argument
EOF
dobin "${T}"/mywrapper
# replacement
newbin - mywrapper <<-EOF
#!/bin/sh
exec do-something --with-some-argument
EOF
}
Does that include `newmenu` from the desktop eclass for example? Or is it just limited to the default set of helpers?
I haven’t tested it but I don’t see why not. As long as they are implemented on top of newins without too much trickery inside, it should work just fine.
Well it does work with newmenu at least. I have tested it now.