#!/usr/bin/sh

[ -d /usr/lib/apache/libexec ] && {
	ityp="install"
	pear info SOAP | grep Package | grep SOAP > /dev/null 2>&1
	if [ $? -eq 0 ]; then
		vers="`pear info SOAP | grep Version | cut -d'|' -f3 | sed -e 's/^ *//g' -e 's/ *$//g'`"
		if [ "$vers" != "0.7.3a" ]; then
			ityp="upgrade"
		else
			ityp="equal"
		fi
	fi
	if [ "$ityp" != "equal" ]; then
        	/usr/bin/pear $ityp /tmp/pearsoap/SOAP-0.7.3a.tgz
		if [ $? -ne 0 ]; then
			echo "Error installing SOAP-0.7.3a.tgz!"
			echo "Installation failed!"
			exit 1
		fi
	fi
}

# installf directories
echo "installf..\c"
installf pearsoap /usr/lib/php/SOAP d 0755 root sys
installf pearsoap /usr/lib/php/SOAP/Server d 0755 root sys
installf pearsoap /usr/lib/php/SOAP/Transport d 0755 root sys
installf pearsoap /usr/lib/php/SOAP/Type d 0755 root sys
installf pearsoap /usr/lib/php/SOAP/tools d 0755 root sys
installf pearsoap /usr/lib/php/docs/SOAP d 0755 root sys
installf pearsoap /usr/lib/php/docs/SOAP/example d 0755 root sys
installf pearsoap /usr/lib/php/.registry/soap.reg f 0644 root sys
installf pearsoap /usr/lib/php/SOAP/Base.php f 0666 root sys
echo " 30%\c"
installf pearsoap /usr/lib/php/SOAP/Client.php f 0666 root sys
installf pearsoap /usr/lib/php/SOAP/Disco.php f 0666 root sys
installf pearsoap /usr/lib/php/SOAP/Fault.php f 0666 root sys
installf pearsoap /usr/lib/php/SOAP/Parser.php f 0666 root sys
installf pearsoap /usr/lib/php/SOAP/Server.php f 0666 root sys
installf pearsoap /usr/lib/php/SOAP/Server/Email.php f 0666 root sys
installf pearsoap /usr/lib/php/SOAP/Server/Email_Gateway.php f 0666 root sys
installf pearsoap /usr/lib/php/SOAP/Server/TCP.php f 0666 root sys
installf pearsoap /usr/lib/php/SOAP/Transport.php f 0666 root sys
installf pearsoap /usr/lib/php/SOAP/Transport/HTTP.php f 0666 root sys
installf pearsoap /usr/lib/php/SOAP/Transport/SMTP.php f 0666 root sys
installf pearsoap /usr/lib/php/SOAP/Transport/TCP.php f 0666 root sys
installf pearsoap /usr/lib/php/SOAP/Type/dateTime.php f 0666 root sys
installf pearsoap /usr/lib/php/SOAP/Type/duration.php f 0666 root sys
installf pearsoap /usr/lib/php/SOAP/Type/hexBinary.php f 0666 root sys
installf pearsoap /usr/lib/php/SOAP/Value.php f 0666 root sys
echo " 70%\c"
installf pearsoap /usr/lib/php/SOAP/WSDL.php f 0666 root sys
installf pearsoap /usr/lib/php/SOAP/tools/genproxy.php f 0666 root sys
installf pearsoap /usr/lib/php/docs/SOAP/example/amazon/amazon.php f 0666 root sys
installf pearsoap /usr/lib/php/docs/SOAP/example/amazon/amazon_modes.php f 0666 root sys
installf pearsoap /usr/lib/php/docs/SOAP/example/amazon/amazon_soap.php f 0666 root sys
installf pearsoap /usr/lib/php/docs/SOAP/example/amazon/amazon_types.php f 0666 root sys
installf pearsoap /usr/lib/php/docs/SOAP/example/amazon/config.php.dist f 0666 root sys
installf pearsoap /usr/lib/php/docs/SOAP/example/amazon/index.php f 0666 root sys
installf pearsoap /usr/lib/php/docs/SOAP/example/amazon/modes.php f 0666 root sys
installf pearsoap /usr/lib/php/docs/SOAP/example/attachment.php f 0666 root sys
installf pearsoap /usr/lib/php/docs/SOAP/example/client.php f 0666 root sys
installf pearsoap /usr/lib/php/docs/SOAP/example/com_client.php f 0666 root sys
installf pearsoap /usr/lib/php/docs/SOAP/example/disco_server.php f 0666 root sys
installf pearsoap /usr/lib/php/docs/SOAP/example/email_client.php f 0666 root sys
installf pearsoap /usr/lib/php/docs/SOAP/example/email_gateway.php f 0666 root sys
installf pearsoap /usr/lib/php/docs/SOAP/example/email_pop_gateway.php f 0666 root sys
installf pearsoap /usr/lib/php/docs/SOAP/example/email_pop_server.php f 0666 root sys
installf pearsoap /usr/lib/php/docs/SOAP/example/email_server.php f 0666 root sys
installf pearsoap /usr/lib/php/docs/SOAP/example/example_types.php f 0666 root sys
installf pearsoap /usr/lib/php/docs/SOAP/example/server.php f 0666 root sys
installf pearsoap /usr/lib/php/docs/SOAP/example/server2.php f 0666 root sys
installf pearsoap /usr/lib/php/docs/SOAP/example/smtp.php f 0666 root sys
installf pearsoap /usr/lib/php/docs/SOAP/example/stockquote.php f 0666 root sys
installf pearsoap /usr/lib/php/docs/SOAP/example/tcp_client.php f 0666 root sys
installf pearsoap /usr/lib/php/docs/SOAP/example/tcp_daemon.pl f 0766 root sys
installf pearsoap /usr/lib/php/docs/SOAP/example/tcp_server.php f 0666 root sys
installf pearsoap /usr/lib/php/docs/SOAP/example/wsdl_client.php f 0666 root sys
installf -f pearsoap
echo " 100%"
removef pearsoap /tmp/pearsoap/SOAP-0.7.3a.tgz
removef pearsoap /tmp/pearsoap
removef pearsoap /tmp
removef -f pearsoap
rm -rf /tmp/pearsoap/SOAP-0.7.3a.tgz
rmdir /tmp/pearsoap >/dev/null 2>&1

exit 0
