Mailcow-dockerized: MacOS: ./generate_config.sh: line 27: read: -i: invalid option

Created on 12 Jul 2018  路  11Comments  路  Source: mailcow/mailcow-dockerized

I'm trying to run the generate_config.sh on my Mac but it is failing as the following :

./generate_config.sh: line 27: read: -i: invalid option
read: usage: read [-ers] [-u fd] [-t timeout] [-p prompt] [-a array] [-n nchars] [-d delim] [name ...]
./generate_config.sh: line 39: read: -i: invalid option
read: usage: read [-ers] [-u fd] [-t timeout] [-p prompt] [-a array] [-n nchars] [-d delim] [name ...]
tr: Illegal byte sequence
tr: Illegal byte sequence
bug

All 11 comments

Hi @zedtux,

the really short version is: Nearly all (shell-)tools on MacOS are basically the same like on Linux. But like between distributions, there can be big differences within the tools and the feature sets. MacOS is based on BSD, not on Linux. Therefor many scripts build for Linux won't ever run on MacOS. Sorry.

Tim

The -i flag was added in Bash 4 and provides a default value. You can easily rewrite the script to check for an empty value instead. I don't think this is a POSIX-compliant flag, so we might as well fix it. Please submit a pull request. You need to replace read -i "$DEFAULT" VAR with

read VAR
if [ -z "$VAR" ]; then
   VAR="$DEFAULT"
fi

Of course, there is not much use to Mailcow on MacOS as Docker always needs Linux (on MacOS and Windows, it runs it in a virtual machine), but I understand that there can be cases where it makes sense to create the config on your desktop machine and copy it to the server.

Thank you @mkuron !!!! 馃憤

@tkorves and @mkuron PR created, can you please review it and let me know if I can do anything else?

Please guys, the PR is waiting for you 馃槂

@zedtux I believe you are going to run into problems running Mailcow-dockerized under Docker for macOS. I've just shut mine down for the following reason:

Docker for macOS uses userland-proxy, not IPTables. So everything coming into all the services appears to be from the IPV4_NETWORK setup by the configuration script, and thereby making Mailcow an open relay (postfix accepts all connections from IPV4_NETWORK).

This is an issue with Docker for Mac which requires userland proxy.

I'd LOVE to find a workaround for this. I've turned off Mailcow and now have to determine if I move it to real Linux docker host or if I can find a workaround to get all of the services for Mailcow seeing the correct external address.

@bplein thank you for your message, but I'm not gonna run mailcow via d4m. I'm using docker-machine on my Mac, to orchestrate my containers (since shamelessly Docker cloud closed).

I needed to run the initial step from my Mac to build the config file.

@zedtux What I did as a workaround was to run it on a random Linux host I had. If you inspect the script, from a certain line ("cat << EOF > mailcow.conf") onward, it's just the file with variables that get substituted. If you are confident that you have those values (and you probably should be so!), then just copy that whole section (down to but not including EOF) into the mailcow.conf file and edit up the variables.

MAILCOW_HOSTNAME=${MAILCOW_HOSTNAME}
DBPASS=$(LC_ALL=C DBROOT=$(LC_ALL=C TZ=${MAILCOW_TZ}

That's it. You can choose to modify other variables (I shortened the COMPOSE_PROJECT_NAME to "mc" for example).

I am running it on a Ubuntu 18.04 system now. I wish I could run it on Docker for Mac but the networking is a challenge for this application stack.

Thank you @bplein for this, I guessed it but now that the PR has been merged, running the script it working on macOS like it does on Linux.

I'm thankful for the work that the developers do on mailcow, but this .env file is so simple, they really shouldn't try and automate it. They should simply put all of the stuff you SHOULD check and edit in the top, then a line that says "Don't edit anything below this unless you know what you are doing or have been told to by the Mailcow developers".

Putting into a script makes it like "you don't need to know what's in here". Sure, it helps reduce typos, I guess it's an attempt to reduce the number of issues opened and I get that.

Fully agree with you @bplein

Was this page helpful?
0 / 5 - 0 ratings

Related issues

poldixd picture poldixd  路  3Comments

zkryakgul picture zkryakgul  路  3Comments

schoebelh picture schoebelh  路  3Comments

a3li picture a3li  路  3Comments

patrick7 picture patrick7  路  3Comments