doctorfree / MusicPlayerPlus

Featureful ncurses based MPD client inspired by ncmpc with integration for Beets, spectrum visualization,Bandcamp/Soundcloud, asciimatics, cantata, and more
https://musicplayerplus.dev
MIT License
72 stars 1 forks source link

[BUG] IP address detection fails on Manjaro Linux with hostname -I #19

Closed doctorfree closed 1 year ago

doctorfree commented 1 year ago

The mppinit and mpplus commands attempt to detect the IP address of the system using hostname -I but this option to hostname is not supported on some Linux distributions, e.g. Manjaro Linux. Use the ip command instead.

Currently, this is the code snippet that attempts to detect the IP address:

      have_hostname=`type -p hostname`
      if [ "${have_hostname}" ]
      then
        IP=`hostname -I | awk '{print $1}'`
      else
        have_ip=`type -p ip`
        if [ "${have_ip}" ]
        then
          IP=`ip route get 1.2.3.4 | head -1 | awk '{print $7}'`
        else
          IP="<ip address>"
        fi
      fi

Perhaps it would be sufficient to simply reverse the order, trying ip first then hostname if ip is not available.

doctorfree commented 1 year ago

Fixed in v3.0.1r2

https://github.com/doctorfree/MusicPlayerPlus/releases/tag/v3.0.1r2