Skip to content

fix: illegal option hostname on macos#179

Merged
szbr9486 merged 1 commit intoCurvineIO:mainfrom
201341:swj/fix4
Aug 12, 2025
Merged

fix: illegal option hostname on macos#179
szbr9486 merged 1 commit intoCurvineIO:mainfrom
201341:swj/fix4

Conversation

@201341
Copy link
Copy Markdown
Contributor

@201341 201341 commented Aug 12, 2025

No description provided.

Signed-off-by: swj <1186093704@qq.com>
# Get the IP address from ifconfig, taking the last network interface address
LOCAL_HOSTNAME="localhost"
LOCAL_IP=$(hostname -I | awk '{print $NF}')
LOCAL_IP=$(ifconfig | grep "inet " | awk '{print $2}' | grep -v 127.0.0.1 | tail -n 1)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it more concise replaced as
hostname -i | awk 'print $NF'

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on macos, hostname doen't have the -i option.

@szbr9486 szbr9486 merged commit 25ae423 into CurvineIO:main Aug 12, 2025
3 checks passed
@lzjqsdd
Copy link
Copy Markdown
Member

lzjqsdd commented Aug 12, 2025

This may disrupt the checks of other systems or distributions. For example, Ubuntu no longer provides the ifconfig tool by default.AThis fix can be made according to different systems.

LOCAL_IP=$(hostname -I | awk '{print $NF}')
LOCAL_IP=$(ifconfig | grep "inet " | awk '{print $2}' | grep -v 127.0.0.1 | tail -n 1)

# master bound host name
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be better to check the system version to select the detection method according to different systems.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

get, I will improve this in next pr.

@lzjqsdd lzjqsdd added the bug Something isn't working label Sep 22, 2025
Coderlxl pushed a commit to Coderlxl/curvine that referenced this pull request Dec 25, 2025
Signed-off-by: swj <1186093704@qq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants