For those interested in reproducing the issues experienced on Alpine, I've published an image that you should be able to start with:

$ docker run -ti brianmhunt/context-alpine:demo

(You can see the Dockerfile etc here: https://hub.docker.com/r/brianmhunt/context-alpine/)

That image applies the TODO/workarounds previously posted (sometimes inelegantly) and brings it to the point where I got stuck, namely luatools and context erroring with "unknown script base.lua" and "unknown script context.lua", respectively.


On Wed, 11 Apr 2018 at 19:14 Henri Menke <henrimenke@gmail.com> wrote:
On Wed, 2018-04-11 at 20:08 +0000, Brian Hunt wrote:
> So here's what I've got for a TODO so far to get ConTeXt working on Alpine
> Linux with musl (subject to item #6, mtx-context.lua not being found):
>
> 1. Add the musl test to first-setup.sh
> 2. Add the same musl test to tex/setuptex
> 3. Add texlua (and texluac?) to
>   a. the setup rsync bin/ directories
>   b. the tex/texmf-linuxmusl(|-ppc|-64)
> 4. Update mtxrun
>
> Here's code that ought to work for detecting musl in mtxrun.  Around line 3721
> of the mtxrun add:
>
>     if find(architecture,"x86_64",1,true) then
>       platform="linux-64"
>     elseif find(architecture,"ppc",1,true) then
>       platform="linux-ppc"
>     else
>       platform="linux"
>     end
> +   if resultof("ldd --version 2>&1"):find("musl") ~= nil then
> +     platform = platform:gsub("linux", "linuxmusl")
> +   end 
>
> 5. Note that in tex/setuptex, there's evidently no way to get the current
> script so one has to explicitly provide the TeX directory (appears to be a
> BusyBox bug).

Standard POSIX sh has no way to reliably detect sourced invocation of a script.
BusyBox uses POSIX sh underneath and thus suffers from the same limitation. See
StackOverflow for detail:
https://stackoverflow.com/questions/29832037

> 6. `context` is unable to locate `mtx-context.lua`.  Some tracker output sheds
> some light:
>   i. context --trackers=resolvers.expansions is identical
>   ii. context --trackers=resolvers.details,resolvers.details differs, with the
> output attached.  Note that to keep the comparison short I removed lines that
> differed only because `linux` had been changed to `linuxmusl`.
>
> Will keep plugging away to see if I can determine why `mtx-context.lua` cannot
> be found on Alpine Linux.
>
> Thanks for reading.
>
> Brian
>
> -- 
> from the personal account of:
> Brian M Hunt <brianmhunt@gmail.com>
> Direct: +1-289-684-4677
> LinkedIn: https://linkedin.com/in/brianmhunt
> This e-mail may contain information that is private, privileged, confidential
> and/or exempt from disclosure. Except as per this notice no waiver of any kind
> is intended by sending this e-mail, and this email is intended only for the
> named recipient(s) or the subscribers of a forwarding service the email is
> sent directly to and to which service you are an authorized recipient. Use,
> dissemination or copying without authorization is prohibited. Please notify
> the sender and destroy all copies of this e-mail if you have received this
> email in error.
> ______________________________________________________________________________
> _____
> If your question is of interest to others as well, please add an entry to the
> Wiki!
>
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki     : http://contextgarden.net
> ______________________________________________________________________________
> _____
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________
--

from the personal account of:

Brian M Hunt <brianmhunt@gmail.com>
Direct: +1-289-684-4677
LinkedIn: https://linkedin.com/in/brianmhunt

This e-mail may contain information that is private, privileged, confidential and/or exempt from disclosure. Except as per this notice no waiver of any kind is intended by sending this e-mail, and this email is intended only for the named recipient(s) or the subscribers of a forwarding service the email is sent directly to and to which service you are an authorized recipient. Use, dissemination or copying without authorization is prohibited. Please notify the sender and destroy all copies of this e-mail if you have received this email in error.