There is processing in entrypoint.sh that looks to be intended to take the first file in /etc/wireguard to pass to wg-quick up, but this doesn't seem to work if there actually is more than one config file: the container fails to start.
The reason is line 17:
config=`echo $configs | head -n 1`
It looks like it should take the first of (potentially) several lines in the $configs variable, but echo doesn't print newline chars, instead replacing them with spaces. This means that when the variable does contain several lines, only a single long line is sent to head and subsequent processing fails.
It can be fixed by substituting printf which preserves newlines (and works more consistently across shells, I believe):
config=`printf "$configs" | head -n 1`
I'm sure most people will only have one config file, so it won't have a big impact (I only spotted it by chance), but I thought I'd file a report.
Edit
A bit of experimentation suggests that the issue can also be solved by just putting inverted comas around the variable in the original line:
config=`echo "$configs" | head -n 1`
also works.
There is processing in
entrypoint.shthat looks to be intended to take the first file in/etc/wireguardto pass towg-quick up, but this doesn't seem to work if there actually is more than one config file: the container fails to start.The reason is line 17:
config=`echo $configs | head -n 1`It looks like it should take the first of (potentially) several lines in the
$configsvariable, butechodoesn't print newline chars, instead replacing them with spaces. This means that when the variable does contain several lines, only a single long line is sent toheadand subsequent processing fails.It can be fixed by substituting
printfwhich preserves newlines (and works more consistently across shells, I believe):config=`printf "$configs" | head -n 1`I'm sure most people will only have one config file, so it won't have a big impact (I only spotted it by chance), but I thought I'd file a report.
Edit
A bit of experimentation suggests that the issue can also be solved by just putting inverted comas around the variable in the original line:
config=`echo "$configs" | head -n 1`also works.