Solved ezjails-admin flavour_setup() fails under FreeBSD 13

ucc

New Member

Reaction score: 1
Messages: 14

So my initial problem was solved before I made this post (don't use - in $name) but I'm here to ask your help in aiding me to find the changes and showing me, where to look/read.

  • I have multiple flavours one of them called basic-dns
  • On first run /etc/rc.d/ezjail_flavour_basic-dns is called and executed
  • My setup works fine under FreeBSD 12.2
  • The rc.d-script fails under FreeBSD 13 – export: -dns_env: bad variable name

Here is the only relevant bit of the rc.d-script:

Bash:
#!/bin/sh
#
# BEFORE: DAEMON
# PROVIDE: ezjail.basic-dns.config
#
# ezjail_flavour_basic-dns

. /etc/rc.subr

name=ezjail_flavour_basic-dns
start_cmd=flavour_setup

flavour_setup() {
…
}

run_rc_command "$1"

Changing line 10 solves the problem, remove the - from the name and everything works fine (e.g. name=ezjail_flavour_basic_dns), quotes did not help.

But why? – What was changed and where can I read on this?

My first thought brought me to rc.subr(8) which only states "The name of this script. This is not optional." – but also listed ${name}_env which brought me to thinking: Maybe the - is interpreted as shell substitution like ${name-dns} – but then the error wouldn't include the -
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 12,268
Messages: 38,773

I would suggest using sysutils/bastille instead of EZJail. While EZjail certainly was a good tool, development on it stopped years ago and the cracks are starting to show.
 
OP
U

ucc

New Member

Reaction score: 1
Messages: 14

If I ever run into something Dirk's EZJail does not cover, I might have a look around – other than that, it's basically feature complete.
 

_martin

Daemon

Reaction score: 302
Messages: 1,107

This is not related to a jail wrapper but rather the /etc/rc.subr script. I'm not feeling like debugging shell script today but it's failing on line 1040 on export here:
Code:
                if [ -n "$_cmd" ]; then
                        if [ -n "$_env" ]; then
                                eval "export -- $_env"
                        fi
There are few changes in this script, if you diff the one from 12 and 13 you'll see the differences. While dash does create problem on 12 too it's silent as only program name is not correctly parsed, there's no export as above. So the actual command gets executed.
 
  • Like
Reactions: ucc
OP
U

ucc

New Member

Reaction score: 1
Messages: 14

Thank you for pointing me in that direction, as I am just curious, I will dig into there this weekend.
 
Top