X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=modules%2Fdebian-org%2Flib%2Ffacter%2Fsoftware.rb;h=b8d8c7dfcce1a686e34e74b9f7d5aa3a15709b1d;hb=960c845a346722dc7bfc8de8732dd4745b866cce;hp=5c60dd4eb41c6ea7c6fc826dcf490af99a03c7ca;hpb=4d96b30960a5287d55f2df86eb366945efc10c7b;p=mirror%2Fdsa-puppet.git diff --git a/modules/debian-org/lib/facter/software.rb b/modules/debian-org/lib/facter/software.rb index 5c60dd4eb..b8d8c7dfc 100644 --- a/modules/debian-org/lib/facter/software.rb +++ b/modules/debian-org/lib/facter/software.rb @@ -7,63 +7,52 @@ Facter.add("apache2") do end end end -Facter.add("clamd") do +Facter.add("apache2deb9") do setcode do - if FileTest.exist?("/usr/sbin/clamd") + # jessie (deb8) has 2.4.10-.., stretch (deb9) will have 2.4.23 or later. + if FileTest.exist?("/usr/sbin/apache2") and system("dpkg --compare-versions $(dpkg-query -W -f='${Version}\n' apache2-bin) gt 2.4.15") true else '' end end end -Facter.add("exim4") do - setcode do - if FileTest.exist?("/usr/sbin/exim4") - true - else - '' - end - end -end -Facter.add("postfix") do - setcode do - if FileTest.exist?("/usr/sbin/postfix") - true - else - '' - end - end -end -Facter.add("postgres81") do +Facter.add("clamd") do setcode do - if FileTest.exist?("/usr/lib/postgresql/8.1/bin/postgres") + if FileTest.exist?("/usr/sbin/clamd") true else '' end end end -Facter.add("postgres83") do +Facter.add("exim4") do setcode do - if FileTest.exist?("/usr/lib/postgresql/8.3/bin/postgres") + if FileTest.exist?("/usr/sbin/exim4") true else '' end end end -Facter.add("postgres84") do +Facter.add("postfix") do setcode do - if FileTest.exist?("/usr/lib/postgresql/8.4/bin/postgres") + if FileTest.exist?("/usr/sbin/postfix") true else '' end end end -Facter.add("postgres90") do +Facter.add("postgres") do setcode do - if FileTest.exist?("/usr/lib/postgresql/9.0/bin/postgres") + pg = (FileTest.exist?("/usr/lib/postgresql/8.1/bin/postgres") or + FileTest.exist?("/usr/lib/postgresql/8.3/bin/postgres") or + FileTest.exist?("/usr/lib/postgresql/8.4/bin/postgres") or + FileTest.exist?("/usr/lib/postgresql/9.0/bin/postgres") or + FileTest.exist?("/usr/lib/postgresql/9.1/bin/postgres") or + FileTest.exist?("/usr/lib/postgresql/9.2/bin/postgres")) + if pg true else '' @@ -93,15 +82,6 @@ Facter.add("policydweight") do end end end -Facter.add("vsftpd") do - setcode do - if FileTest.exist?("/usr/sbin/vsftpd") - true - else - '' - end - end -end Facter.add("spamd") do setcode do if FileTest.exist?("/usr/sbin/spamd") @@ -112,10 +92,10 @@ Facter.add("spamd") do end end Facter.add("php5") do - php = FileTest.exist?("/usr/lib/apache2/modules/libphp5.so") or + php = (FileTest.exist?("/usr/lib/apache2/modules/libphp5.so") or FileTest.exist?("/usr/bin/php5") or FileTest.exist?("/usr/bin/php5-cgi") or - FileTest.exist?("/usr/lib/cgi-bin/php5") + FileTest.exist?("/usr/lib/cgi-bin/php5")) setcode do if php true @@ -125,8 +105,8 @@ Facter.add("php5") do end end Facter.add("php5suhosin") do - suhosin=FileTest.exist?("/usr/lib/php5/20060613/suhosin.so") or - FileTest.exist?("/usr/lib/php5/20060613+lfs/suhosin.so") + suhosin=(FileTest.exist?("/usr/lib/php5/20060613/suhosin.so") or + FileTest.exist?("/usr/lib/php5/20060613+lfs/suhosin.so")) setcode do if suhosin true @@ -140,23 +120,43 @@ Facter.add("syslogversion") do %x{dpkg-query -W -f='${Version}\n' syslog-ng | cut -b1-3}.chomp end end -Facter.add("rsyncd") do +Facter.add("unbound") do + unbound=(FileTest.exist?("/usr/sbin/unbound") and + FileTest.exist?("/var/lib/unbound/root.key")) setcode do - if FileTest.exist?("/etc/rsyncd.conf") + if unbound true else '' end end end -Facter.add("unbound") do - unbound=FileTest.exist?("/usr/sbin/unbound") and - FileTest.exist?("/var/lib/unbound/root.key") +Facter.add("munin_async") do setcode do - if unbound + FileTest.exist?("/usr/share/munin/munin-async") + end +end +Facter.add("samhain") do + setcode do + if FileTest.exist?("/usr/sbin/samhain") + true + else + '' + end + end +end +Facter.add("systemd") do + setcode do + init = '/sbin/init' + if File.symlink?(init) and File.readlink(init) == "/lib/systemd/systemd" true else '' end end end +Facter.add("tor_ge_0_2_9") do + setcode do + system(%{dpkg -l tor 2>/dev/null && dpkg --compare-versions $(dpkg-query -W -f='${Version}' tor) ge 0.2.9}) + end +end