Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds macOS support so
ipregion.shruns on Darwin without modification.What's included
/opt/homebrew/bin/bashon Apple Silicon,/usr/local/bin/bashon Intel), or prints install instructions and exits if neither is present.grep -Preplacement — BSD grep has no PCRE support.grep_wrapper --perlnow shells out toperlinstead, which is present on every macOS install.Darwinmaps tomacos→brew install.ipcommand;check_ip_interfacesparsesifconfigoutput on Darwin, skipping loopback (127.) and link-local (fe80:,::1) addresses.head -n -1/tail -n +3replacement — BSDheaddoes not accept negative line counts. Replaced with Bash parameter expansion, which behaves identically on both platforms.columndirectly (theutil-linux/bsdmainutilspackage names are Linux-specific; the actual dependency is thecolumnbinary).Testing
Verified on macOS 15 (Darwin 24.6.0, Apple Silicon) with Bash 5.3:
bash -n ipregion.sh— clean./ipregion.sh --help./ipregion.sh -g primary -4— full run, all GeoIP services resolved correctlyNo Linux behaviour is changed: every new branch is gated on
$OS_NAME == "Darwin", except the--perlwrapper and thehead/tailreplacements, which are portable and produce identical output on both platforms.