Skip to content

Instantly share code, notes, and snippets.

@GregSutcliffe
Created January 21, 2016 17:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GregSutcliffe/7c61a6d22de3ab5ab6ce to your computer and use it in GitHub Desktop.
Save GregSutcliffe/7c61a6d22de3ab5ab6ce to your computer and use it in GitHub Desktop.
# These facts don't update pkg database (apt-get update, pacman -Sy, etc)
# Make sure that executing it is handled by cron, as it can take a while
# Archlinux
Facter.add('pkg_updates') do
confine :operatingsystem => 'Archlinux'
setcode do
Facter::Core::Execution.exec('/usr/bin/pacman -Qu|/usr/bin/wc -l')
end
end
# Debian
Facter.add('pkg_updates') do
confine :operatingsystem => 'Debian'
setcode do
Facter::Core::Execution.exec('/usr/bin/aptitude search \'~U\' | /usr/bin/wc -l')
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment