# No More BASH Arrays in /etc/conf.d/net?  Huh?

## wswartzendruber

So if BaseLayout 2 and OpenRC aren't using BASH arrays anymore, how do we represent the following:

```
config_someinterface0=( "first_value" "second_value" )
```

And what about PPP sections:

```
some_key=( 'some_init_code' 'other_init_code' )
```

Noticing that the difference between the two is one using quotes and the other using apostrophes.

P.S.  This BaseLayout change is like being batted across town with a log.

----------

## Kloeri

 *wswartzendruber wrote:*   

> So if BaseLayout 2 and OpenRC aren't using BASH arrays anymore.

 

Unfortunately bash arrays and other features that aren't strictly POSIX features has been declared evil by Uberlord and as such is no longer supposed to be used. I believe he's invented some rather convoluted POSIX based syntax instead that looks a little like bash arrays but are likely harder to use.

You should be able to find out more about this on his blog or on the gentoo-dev ML archives.

----------

## slackline

 *wswartzendruber wrote:*   

> So if BaseLayout 2 and OpenRC aren't using BASH arrays anymore, how do we represent the following:
> 
> ```
> config_someinterface0=( "first_value" "second_value" )
> ```
> ...

 

I think you might find the answer in /usr/share/doc/openrc/net.example which contains examples that are compliant with BaseLayour2/OpenRC.

----------

## UberLord

 *Kloeri wrote:*   

>  *wswartzendruber wrote:*   So if BaseLayout 2 and OpenRC aren't using BASH arrays anymore. 
> 
> Unfortunately bash arrays and other features that aren't strictly POSIX features has been declared evil by Uberlord and as such is no longer supposed to be used. I believe he's invented some rather convoluted POSIX based syntax instead that looks a little like bash arrays but are likely harder to use.
> 
> You should be able to find out more about this on his blog or on the gentoo-dev ML archives.

 

The big issue is because the bash array config allowed for spaces in single parameters. For example

```
config_eth0=( "1.2.3.4 netmask 255.255.255.0 broadcast 1.2.3.255"

"5.6.7.8 netmask 255.0.0.0 broadcast 5.255.255.255" )
```

Is fairly common.

So to keep the same syntax and work in a POSIX fashion we now have this

```
config_eth0="1.2.3.4 netmask 255.255.255.0 broadcast 1.2.3.255

5.6.7.8 netmask 255.0.0.0 broadcast 5.255.255.255"
```

This works as we use a hard newline (\n doesn't work here)

We've done this so existing bash arrays still work (if /bin/sh links to bash) AND you can use similar configs on non bash shells.

This means documentation doesn't change that much.

For future versions we'll have something simpler, but works on both bash and POSIX shells.

Current idea is

```
address_eth0="1.2.3.4/24 5.6.7.8/8"
```

And disallow any direct ifconfig/iproute2 setup commands there.

----------

## UberLord

Just to clarify - you can still use bash arrays for the where they currently work in baselayout-1 provided that /bin/sh links to bash.

----------

## alienvenom

Can someone who uses a APN with their chat_ppp0 in /etc/conf.d/net please post an example config that works with openrc? I use my phone to connect but it requires a APN specified. The example in /usr/share/doc/openrc/net.example lists a chat script, but does not list the APN. Unfortunately, due to the old chat_ppp0 containing a mixture of " (quotes) and ' (apostrophes) when I upgraded to openrc, it basically won't parse the script correctly.

Basically, this is what I was using before:

'OK'              'AT+CGDCONT=1,"IP","wap.cingular","",0,0'

/var/log/messages

```
Apr 23 13:08:50 lapadon chat[7748]: abort on (BUSY)

Apr 23 13:08:50 lapadon chat[7748]: abort on (ERROR)

Apr 23 13:08:50 lapadon chat[7748]: abort on (NO ANSWER)

Apr 23 13:08:50 lapadon chat[7748]: abort on (NO CARRIER)

Apr 23 13:08:50 lapadon chat[7748]: abort on (NO DIALTONE)

Apr 23 13:08:50 lapadon chat[7748]: abort on (Invalid Login)

Apr 23 13:08:50 lapadon chat[7748]: abort on (Login Incorrect)

Apr 23 13:08:50 lapadon chat[7748]: timeout set to 5 seconds

Apr 23 13:08:50 lapadon chat[7748]: send (ATZ^M)

Apr 23 13:08:50 lapadon chat[7748]: expect (OK)

Apr 23 13:08:50 lapadon chat[7748]: ATZ^M^M

Apr 23 13:08:50 lapadon chat[7748]: OK

Apr 23 13:08:50 lapadon chat[7748]:  -- got it

Apr 23 13:08:50 lapadon chat[7748]: send (AT+CGDCONT=1,IP,wap.cingular,,0,0^M)

Apr 23 13:08:50 lapadon chat[7748]: expect (OK)

Apr 23 13:08:50 lapadon chat[7748]: ^M

Apr 23 13:08:50 lapadon chat[7748]: AT+CGDCONT=1,IP,wap.cingular,,0,0^M^M

Apr 23 13:08:50 lapadon chat[7748]: ERROR

Apr 23 13:08:50 lapadon chat[7748]:  -- failed

Apr 23 13:08:50 lapadon chat[7748]: Failed (ERROR)
```

----------

