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

UpdateCount apt integration #18

Closed ThomDietrich closed 7 years ago

ThomDietrich commented 7 years ago

Hello, first an addition for your README to trigger the CountUpdates() function after an apt upgrade/install/.. was executed:

echo "DPkg::Post-Invoke { \"if [ -x /opt/FireMotD/FireMotD ]; then echo -n 'Updating FireMotD available updates count... '; /opt/FireMotD/FireMotD -S; echo 'OK'; fi\"; };" > /etc/apt/apt.conf.d/15firemotd

And now a request regarding https://github.com/willemdh/FireMotD/blob/master/FireMotD#L83

UpdateCount=$(apt-get update > /dev/null; apt-get upgrade -u -s | grep -P "^Inst" | wc -l)

Could you please provide a parameter which will not execute apt update? It's (most probably) pointless after an apt upgrade and does take needlessly long in the above integration... My suggestion: -S with, -s without apt update

willemdh commented 7 years ago

Happy to accept a pr. I'm a bit busy atm (and I'm not using apt myself).

ThomDietrich commented 7 years ago

Maybe, I'll have to find the time. Are you okay with the README addition and the suggestion?

willemdh commented 7 years ago

As I have 0 experience with "DPkg::Post-Invoke" I'm not sure, but I suggest you give it a shot. :)

ThomDietrich commented 7 years ago

That part is working! I've been using it for weeks on multiple machines. I was more interested in the change to the parameters but okay let's just give it a try.

dimon222 commented 7 years ago

Should be covered #69