n8henrie / homebridge-rcswitch-gpiomem

Integrate your 433 remote switches into homebridge
MIT License
11 stars 3 forks source link

Added wiringPi as preinstall-dependency #8

Closed gismo141 closed 7 years ago

gismo141 commented 7 years ago

This automatically installs the needed library and installs the plugin afterwards.

n8henrie commented 7 years ago

Sweet, thanks! Let me give it a shot, likely merge soon.

n8henrie commented 7 years ago

Hmmm, I'm having second thoughts about merging, but open to discussion.

There may be a reasonable workaround -- evaluating if wiringPi is already installed. If not, then attempting to install it is reasonable, since it is a dependency. But if we can reliably detect if it is already installed, then there will be no request for root privileges.

For example, sudo ldconfig -p | grep libwiringPi.so || (install wiringPi here) would probably be a fairly robust way to do this, but then it defeats the purpose by requiring sudo.

I suppose something like if ! command -v /usr/lib/libwiringPi.so; then (install wiringPi here); fi may work, but obviously would make things difficult if people had somehow installed the shared library somewhere else (is that possible?).

My inclination is to keep things simple and just tell people "you have to install wiringPi" -- which lets them do that however they like, is how several similar projects have handled this situation, and if the wiringPi install process changes, I won't have to change anything here to reflect that.

Does my reasoning make sense?

n8henrie commented 7 years ago

Closing due to inactivity

gismo141 commented 7 years ago

Sorry for being late, few days ago I started to write a response but somehow I missed to send it.

The thing with the root-rights seems to have something do to where you store the node_modules. During the next days I'll try to reproduce if this happens.

Otherwise I haven't thought about putting it directly into the base-repo - this might be indeed a much better way to do it. As well I'm not quite sure if you could be able to have a different library of wiringpi somewhere else. Normally the linker looks at specific places so it should be possible to narrow down with your hint of looking up the library.

n8henrie commented 7 years ago

No worries. I think the root rights has more to do with the wiringPi installation, which requires root rights (e.g. to install the gpio binary to /usr/local/bin). If you find a way to avoid the root rights requirement, let me know and we could merge into rcswitch-gpiomem.