Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors running ipfilter.sh on macOS #1

Closed
joosth9n opened this issue Dec 21, 2019 · 13 comments
Closed

Errors running ipfilter.sh on macOS #1

joosth9n opened this issue Dec 21, 2019 · 13 comments

Comments

@joosth9n
Copy link

Hi, I'm getting the following errors, on macOS:

./ipfilter.sh: line 33: declare: -A: invalid option
declare: usage: declare [-afFirtx] [-p] [name[=value] ...]
(..)/ipfilter/ipfilter.conf: line 20: level1: unbound variable

@fonic
Copy link
Owner

fonic commented Dec 21, 2019

That's the shell not being able to deal with declare -A <var> which is used to declare variables of type dict. I'd guess bash --version outputs something like GNU bash, version 3.x.xx-release on your system, correct? As stated in the README, Bash >= 4.0 is required for this script to work.

You can try upgrading Bash, e.g. by following these instructions.

I pushed commit fc064e3 to make life easier for macOS users.

@fonic fonic changed the title Errors running ipfilter.sh Errors running ipfilter.sh on macOS Dec 21, 2019
@fonic
Copy link
Owner

fonic commented Jan 1, 2020

Have you had any success? I'd really like to know if it works on macOS.

@rcollie
Copy link

rcollie commented Jan 17, 2020

Running Bash 5. I get:

bash-5.0$ /Users/macmini/ipfilter/ipfilter.sh

--== IP Filter Updater & Generator ==--

Creating temporary folder...
mktemp: illegal option -- -
usage: mktemp [-d] [-q] [-t prefix] [-u] template ...
mktemp [-d] [-q] [-u] -t prefix
An error occured, aborting.

bash-5.0$

@fonic
Copy link
Owner

fonic commented Jan 17, 2020

It would seem macOS doesn't like long options. Let me check this, I'll get back to you.

@fonic
Copy link
Owner

fonic commented Jan 17, 2020

@rcollie: would you please download and test this version of ipfilter.sh: link

@rcollie: I applied and committed all necessary changes for macOS. See 497237d.

Tested successfully on macOS Catalina 10.15.
I also added support for native notifications (option -n/--notify).

@SethWilliamson
Copy link

SethWilliamson commented Jan 17, 2020

Same result as rcollie

Versions

  • ipfilter.sh commit 497237d
  • FreeNAS 11.2-STABLE
  • Bash 4.4.19(0)-release

Output

--== IP Filter Updater & Generator ==--

Creating temporary folder...
mktemp: illegal option -- -
usage: mktemp [-d] [-q] [-t prefix] [-u] template ...
mktemp [-d] [-q] [-u] -t prefix
An error occured, aborting.

@fonic
Copy link
Owner

fonic commented Jan 17, 2020

@SethWilliamson: try this version. If it works, let me know what echo $OSTYPE outputs on your system.

@SethWilliamson: I applied and committed all necessary changes for FreeBSD. See 582bb12.

Tested successfully on FreeNAS 11.2-U7.

@fonic
Copy link
Owner

fonic commented Jan 19, 2020

@rcollie: Working for you now on macOS?
@SethWilliamson: Working for you now on FreeNAS?

@rcollie
Copy link

rcollie commented Jan 19, 2020

% ~/Downloads/ipfilter-497237ddb16b68f73e598f058f06adc5395d882e/ipfilter.sh
~/Downloads/ipfilter-497237ddb16b68f73e598f058f06adc5395d882e/ipfilter.sh: line 33: declare: -A: invalid option
declare: usage: declare [-afFirtx] [-p] [name[=value] ...]

--== IP Filter Updater & Generator ==--

Creating temporary folder...
Downloading I-BlockList blocklists...
Downloading I-BlockList blocklist '0'...
Decompressing I-BlockList blocklists...
Decompressing I-BlockList blocklist '0'...
Merging I-BlockList blocklists...
~/Downloads/ipfilter-497237ddb16b68f73e598f058f06adc5395d882e/ipfilter.sh: line 326: readarray: command not found
An error occured, aborting.
Removing temporary folder...

@fonic
Copy link
Owner

fonic commented Jan 19, 2020

@rcollie: please run again using Bash 5 as you did before. You either used Zsh or macOS' outdated stock Bash this time.

@rcollie
Copy link

rcollie commented Jan 19, 2020

Sorry ran it on a different system running older bash. After installing wget it works like a champ. Well done sir.

@fonic
Copy link
Owner

fonic commented Jan 19, 2020

@rcollie: great, my pleasure ;)

@fonic
Copy link
Owner

fonic commented Jan 20, 2020

Closing this now as the matter is resolved for macOS. Created a separate issue for FreeBSD.

@fonic fonic closed this as completed Jan 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants