OutsideIT / FireMotD

:fire: Fire Framework Linux MoTD Generator :fire:
https://outsideit.net/firemotd
GNU General Public License v3.0
174 stars 45 forks source link

which yum #62

Closed willemdh closed 7 years ago

willemdh commented 7 years ago

Seems root uses /bin/yum not /usr/bin/yum..

willemdh commented 7 years ago

Gonna merge this, as I need it.

ThomDietrich commented 7 years ago

@willemdh @dimon222 I might be wrong here. What do you think? If which can resolve a command (a file name) to it's absolute path, it means that an executable with this name was found somewhere below PATH. That's also how the resolution of commands works in general. Therefore the first and second line of this PR could be reduced to

UpdateCount=$(($(yum -d 0 check-update 2>/dev/null | wc -l)-1))

Am I right?

willemdh commented 7 years ago

When I have some time I'll check your idea. Just needed a quick fix for the updatecount no longer updating somehow.

ThomDietrich commented 7 years ago

If I'm right, then the actual problem is, that this is not really the solution. Up to this point we were using absolute paths because depending on the system and the way of execution, the environment of the script execution can be pretty slim, only consisting of a minimal or no PATH. That's a problem we all know from cron. The chance to find an executable by which yum or yum should be the same, hence both ways are not good if we can't trust the environment. I'm not sure how serious the topic actually is :smiley_cat:

willemdh commented 7 years ago

For now which yum did the job, my updatecount seems working again. Also i'm not so serious about this project that I want to make it 200% os and tech independent. 😄