#!/bin/bash
function check_rpm () {
  rpm -q $1 &> tmp
  result1=$(cat tmp | grep "ist nicht installiert" );
  result2=$(cat tmp | grep "is not installed" );
  if test -z "$result1" -a -z "$result2" ; then
    echo "ok";
  fi;
}

install_ok="y";

echo "* notes can be ignored";
if test "`check_rpm apache`" != "ok" -a "`check_rpm httpd`" != "ok"; then echo "apache or httpd is not installed"; install_ok='n'; fi;
if test "`check_rpm apache-contrib`" != "ok"; then echo "note: apache-contrib is not installed"; fi;
if test "`check_rpm apache-devel`" != "ok" -a "`check_rpm httpd-devel`" != "ok"; then echo "apache-devel or httpd-devel is not installed"; install_ok='n'; fi;
if test "`check_rpm bind8`" != "ok" -a "`check_rpm bind9`" != "ok" -a "`check_rpm bind`" != "ok" ; then echo "bind8 or bind9 is not installed"; install_ok='n'; fi;
if test "`check_rpm bindutil`" != "ok" -a "`check_rpm bind-utils`" != "ok"; then echo "bindutil or bind-utils is not installed"; install_ok='n'; fi;
if test "`check_rpm binutils`" != "ok"; then echo "binutils is not installed"; install_ok='n'; fi;
if test "`check_rpm bison`" != "ok"; then echo "bison is not installed"; install_ok='n'; fi;
if test "`check_rpm cpp`" != "ok"; then echo "cpp is not installed"; install_ok='n'; fi;
if test "`check_rpm curl`" != "ok"; then echo "curl is not installed"; install_ok='n'; fi;
if test "`check_rpm expect`" != "ok"; then echo "expect is not installed"; install_ok='n'; fi;
if test "`check_rpm flex`" != "ok"; then echo "flex is not installed"; install_ok='n'; fi;
if test "`check_rpm freetype`" != "ok"; then echo "freetype is not installed"; install_ok='n'; fi;
if test "`check_rpm freetype2`" != "ok"; then echo "note: freetype2 is not installed"; fi;
if test "`check_rpm gcc`" != "ok"; then echo "gcc is not installed"; install_ok='n'; fi;
if test "`check_rpm gd`" != "ok"; then echo "gd is not installed"; install_ok='n'; fi;
if test "`check_rpm glibc-devel`" != "ok"; then echo "glibc-devel is not installed"; install_ok='n'; fi;
if test "`check_rpm glibc-locale`" != "ok"; then echo "note: glibc-locale is not installed"; fi;
if test "`check_rpm libmcrypt`" != "ok"; then echo "libmcrypt is not installed"; install_ok='n'; fi;
if test "`check_rpm libpng`" != "ok"; then echo "libpng is not installed"; install_ok='n'; fi;
if test "`check_rpm libtool`" != "ok"; then echo "libtool is not installed"; install_ok='n'; fi;
if test "`check_rpm make`" != "ok"; then echo "make is not installed"; install_ok='n'; fi;
if test "`check_rpm m4`" != "ok"; then echo "note: m4 is not installed"; fi;
if test "`check_rpm mm`" != "ok"; then echo "mm is not installed"; install_ok='n'; fi;
if test "`check_rpm mod_frontpage`" != "ok" -a "`check_rpm frontpage`" != "ok"; then echo "mod_frontpage or frontpage is not installed"; install_ok='n'; fi;
if test "`check_rpm mod_php4`" != "ok" -a "`check_rpm php`" != "ok"; then echo "mod_php4 or php is not installed"; install_ok='n'; fi;
if test "`check_rpm mod_php4-core`" != "ok"; then echo "note: mod_php4-core is not installed"; fi;
if test "`check_rpm mod_ssl`" != "ok"; then echo "mod_ssl is not installed"; install_ok='n'; fi;
if test "`check_rpm mysql`" != "ok"; then echo "mysql is not installed"; install_ok='n'; fi;
if test "`check_rpm mysql-client`" != "ok" -a "`check_rpm mysqlclient`" != "ok"; then echo "mysql-client or mysqlclient is not installed"; install_ok='n'; fi;
if test "`check_rpm mysql-devel`" != "ok"; then echo "mysql-devel is not installed"; install_ok='n'; fi;
if test "`check_rpm mysql-server`" != "ok"; then echo "note: mysql-server is not installed"; fi;
if test "`check_rpm mysql-shared`" != "ok"; then echo "note: mysql-shared is not installed"; fi;
if test "`check_rpm openssl`" != "ok"; then echo "openssl is not installed"; install_ok='n'; fi;
if test "`check_rpm openssl-devel`" != "ok"; then echo "openssl-devel is not installed"; install_ok='n'; fi;
if test "`check_rpm patch`" != "ok"; then echo "patch is not installed"; install_ok='n'; fi;
if test "`check_rpm perl-Data-ShowTable`" != "ok"; then echo "note: perl-Data-ShowTable is not installed"; fi;
if test "`check_rpm perl-DBI`" != "ok"; then echo "perl-DBI is not installed"; install_ok='n'; fi;
if test "`check_rpm perl-Msql-Mysql-modules`" != "ok" -a "`check_rpm perl-DBD-MySQL`" != "ok"; then echo "perl-Msql-Mysql-modules or perl-DBD-MySQL is not installed"; install_ok='n'; fi;
if test "`check_rpm perl-SNMP`" != "ok"; then echo "note: perl-SNMP is not installed"; fi;
if test "`check_rpm php-mysql`" != "ok"; then echo "note: php-mysql is not installed"; fi;
if test "`check_rpm pico`" != "ok" -a "`check_rpm nano`" != "ok"; then echo "pico or nano is not installed"; install_ok='n'; fi;
if test "`check_rpm quota`" != "ok"; then echo "quota is not installed"; install_ok='n'; fi;
if test "`check_rpm t1lib`" != "ok"; then echo "t1lib is not installed"; install_ok='n'; fi;
if test "`check_rpm telnet-server`" != "ok"; then echo "telnet-server is not installed"; install_ok='n'; fi;
if test "`check_rpm tk`" != "ok"; then echo "note: tk is not installed"; fi;
if test "`check_rpm ucdsnmp`" != "ok" -a "`check_rpm ucd-snmp`" != "ok"; then echo "ucdsnmp or ucd-snmp is not installed"; install_ok='n'; fi;
if test "`check_rpm unixODBC`" != "ok"; then echo "note: unixODBC is not installed"; fi;
if test "`check_rpm webalizer`" != "ok"; then echo "webalizer is not installed"; install_ok='n'; fi;
if test "`check_rpm wget`" != "ok"; then echo "wget is not installed"; install_ok='n'; fi;
if test "`check_rpm whois`" != "ok" -a "`check_rpm jwhois`" != "ok"; then echo "whois or jwhois is not installed"; install_ok='n'; fi;

echo "$install_ok" > ./tmp
