wok-6.x annotate php-snmp/receipt @ rev 3230

Add php-snmp
author Pascal Bellard <pascal.bellard@slitaz.org>
date Fri May 29 16:44:01 2009 +0200 (2009-05-29)
parents
children 6e3fc22e770a
rev   line source
pascal@3230 1 # SliTaz package receipt.
pascal@3230 2
pascal@3230 3 PACKAGE="php-snmp"
pascal@3230 4 VERSION="5.2.9"
pascal@3230 5 CATEGORY="development"
pascal@3230 6 SHORT_DESC="snmp module for PHP web programming language."
pascal@3230 7 MAINTAINER="pascal.bellard@slitaz.org"
pascal@3230 8 DEPENDS="net-snmp php libcrypto"
pascal@3230 9 WEB_SITE="http://www.php.net/"
pascal@3230 10 WANTED="php"
pascal@3230 11
pascal@3230 12 # Rules to gen a SliTaz package suitable for Tazpkg.
pascal@3230 13 genpkg_rules()
pascal@3230 14 {
pascal@3230 15 mkdir -p $fs/usr/share/php
pascal@3230 16 cp $(find $_pkg | grep snmp.so) $fs/usr/share/php/
pascal@3230 17 }
pascal@3230 18
pascal@3230 19 # Post and pre install commans to stop
pascal@3230 20 # and restart Web server if needed.
pascal@3230 21 pre_install()
pascal@3230 22 {
pascal@3230 23 while read daemon file; do
pascal@3230 24 if [ -z "$1" -a -f "/var/run/$file" ]; then
pascal@3230 25 /etc/init.d/$daemon stop
pascal@3230 26 fi
pascal@3230 27 done <<EOT
pascal@3230 28 apache apache/httpd.pid
pascal@3230 29 lighttpd lighttpd.pid
pascal@3230 30 EOT
pascal@3230 31 }
pascal@3230 32
pascal@3230 33 post_install()
pascal@3230 34 {
pascal@3230 35 grep -q ^extension=snmp.so $1/etc/php.ini || \
pascal@3230 36 sed -e 's|;.*extension=msql.so|; extension=msql.so\nextension=snmp.so|' -i $1/etc/php.ini
pascal@3230 37 # Start Web server.
pascal@3230 38 while read daemon file; do
pascal@3230 39 [ -z "$1" ] || continue
pascal@3230 40 if [ -f "/var/run/$file" ]; then
pascal@3230 41 /etc/init.d/$daemon stop
pascal@3230 42 sleep 2
pascal@3230 43 fi
pascal@3230 44 if [ -f /etc/init.d/$daemon ]; then
pascal@3230 45 /etc/init.d/$daemon start
pascal@3230 46 fi
pascal@3230 47 done <<EOT
pascal@3230 48 apache apache/httpd.pid
pascal@3230 49 lighttpd lighttpd.pid
pascal@3230 50 EOT
pascal@3230 51 }
pascal@3230 52
pascal@3230 53 # Pre and post remove commands for Tazpkg.
pascal@3230 54 pre_remove()
pascal@3230 55 {
pascal@3230 56 sed -i '/.*=snmp.so.*/d' /etc/php.ini
pascal@3230 57
pascal@3230 58 # Start Web server.
pascal@3230 59 while read daemon file; do
pascal@3230 60 if [ -f /etc/init.d/$daemon -a -f "/var/run/$file" ]; then
pascal@3230 61 /etc/init.d/$daemon stop
pascal@3230 62 sleep 2
pascal@3230 63 /etc/init.d/$daemon start
pascal@3230 64 fi
pascal@3230 65 done <<EOT
pascal@3230 66 apache apache/httpd.pid
pascal@3230 67 lighttpd lighttpd.pid
pascal@3230 68 EOT
pascal@3230 69 }