wok rev 1805

php-*: restart web server during reconfigure
author Pascal Bellard <pascal.bellard@slitaz.org>
date Tue Dec 02 14:48:36 2008 +0000 (2008-12-02)
parents 6b8241a302f7
children f00979b9a2ba
files php-apache/receipt php-cups/receipt php-gd/receipt php-imap/receipt php-ldap/receipt php-mhash/receipt php-mysql/receipt php-pear/receipt php-pgsql/receipt
line diff
     1.1 --- a/php-apache/receipt	Tue Dec 02 12:32:00 2008 +0000
     1.2 +++ b/php-apache/receipt	Tue Dec 02 14:48:36 2008 +0000
     1.3 @@ -47,8 +47,12 @@
     1.4      Allow from all
     1.5  </DirectoryMatch>
     1.6  EOT
     1.7 -	# Start Web server.
     1.8 -	if [ -z "$1" -a ! -f "/var/run/apache/httpd.pid" ]; then
     1.9 +	# Restart Web server.
    1.10 +	if [ -z "$1" -a -f "/var/run/apache/httpd.pid" ]; then
    1.11 +		/etc/init.d/apache stop
    1.12 +		sleep 2
    1.13 +	fi
    1.14 +	if [ -z "$1" ]; then
    1.15  		/etc/init.d/apache start
    1.16  	fi
    1.17  }
     2.1 --- a/php-cups/receipt	Tue Dec 02 12:32:00 2008 +0000
     2.2 +++ b/php-cups/receipt	Tue Dec 02 14:48:36 2008 +0000
     2.3 @@ -36,8 +36,12 @@
     2.4  	    sed -e 's|;.*extension=msql.so|;   extension=msql.so\nextension=cups.so|' -i $1/etc/php.ini
     2.5  	# Start Web server.
     2.6  	while read daemon file; do
     2.7 -		if [ -z "$1" -a -f /etc/init.d/$daemon \
     2.8 -			     -a ! -f "/var/run/$file" ]; then
     2.9 +		[ -z "$1" ] || continue
    2.10 +		if [ -z "$1" -a -f "/var/run/$file" ]; then
    2.11 +			/etc/init.d/$daemon stop
    2.12 +			sleep 2
    2.13 +		fi
    2.14 +		if [ -z "$1" -a -f /etc/init.d/$daemon ]; then
    2.15  			/etc/init.d/$daemon start
    2.16  		fi
    2.17  	done <<EOT
    2.18 @@ -53,7 +57,10 @@
    2.19  
    2.20  	# Start Web server.
    2.21  	while read daemon file; do
    2.22 -		if [ -f /etc/init.d/$daemon -a ! -f "/var/run/$file" ]; then
    2.23 +		[ -f "/var/run/$file" ] || continue
    2.24 +		if [ -f /etc/init.d/$daemon  ]; then
    2.25 +			/etc/init.d/$daemon stop
    2.26 +			sleep 2
    2.27  			/etc/init.d/$daemon start
    2.28  		fi
    2.29  	done <<EOT
     3.1 --- a/php-gd/receipt	Tue Dec 02 12:32:00 2008 +0000
     3.2 +++ b/php-gd/receipt	Tue Dec 02 14:48:36 2008 +0000
     3.3 @@ -36,8 +36,12 @@
     3.4  	    sed -e 's|;.*extension=msql.so|;   extension=msql.so\nextension=gd.so|' -i $1/etc/php.ini
     3.5  	# Start Web server.
     3.6  	while read daemon file; do
     3.7 -		if [ -z "$1" -a -f /etc/init.d/$daemon \
     3.8 -			     -a ! -f "/var/run/$file" ]; then
     3.9 +		[ -z "$1" ] || continue
    3.10 +		if [ -z "$1" -a -f "/var/run/$file" ]; then
    3.11 +			/etc/init.d/$daemon stop
    3.12 +			sleep 2
    3.13 +		fi
    3.14 +		if [ -z "$1" -a -f /etc/init.d/$daemon ]; then
    3.15  			/etc/init.d/$daemon start
    3.16  		fi
    3.17  	done <<EOT
    3.18 @@ -53,7 +57,9 @@
    3.19  
    3.20  	# Start Web server.
    3.21  	while read daemon file; do
    3.22 -		if [ -f /etc/init.d/$daemon -a ! -f "/var/run/$file" ]; then
    3.23 +		if [ -f /etc/init.d/$daemon -a -f "/var/run/$file" ]; then
    3.24 +			/etc/init.d/$daemon stop
    3.25 +			sleep 2
    3.26  			/etc/init.d/$daemon start
    3.27  		fi
    3.28  	done <<EOT
     4.1 --- a/php-imap/receipt	Tue Dec 02 12:32:00 2008 +0000
     4.2 +++ b/php-imap/receipt	Tue Dec 02 14:48:36 2008 +0000
     4.3 @@ -36,8 +36,12 @@
     4.4  	    sed -e 's|;.*extension=msql.so|;   extension=msql.so\nextension=imap.so|' -i $1/etc/php.ini
     4.5  	# Start Web server.
     4.6  	while read daemon file; do
     4.7 -		if [ -z "$1" -a -f /etc/init.d/$daemon \
     4.8 -			     -a ! -f "/var/run/$file" ]; then
     4.9 +		[ -z "$1" ] || continue
    4.10 +		if [ -f "/var/run/$file" ]; then
    4.11 +			/etc/init.d/$daemon stop
    4.12 +			sleep 2
    4.13 +		fi
    4.14 +		if [ -f /etc/init.d/$daemon ]; then
    4.15  			/etc/init.d/$daemon start
    4.16  		fi
    4.17  	done <<EOT
    4.18 @@ -53,7 +57,9 @@
    4.19  
    4.20  	# Start Web server.
    4.21  	while read daemon file; do
    4.22 -		if [ -f /etc/init.d/$daemon -a ! -f "/var/run/$file" ]; then
    4.23 +		if [ -f /etc/init.d/$daemon -a -f "/var/run/$file" ]; then
    4.24 +			/etc/init.d/$daemon stop
    4.25 +			sleep 2
    4.26  			/etc/init.d/$daemon start
    4.27  		fi
    4.28  	done <<EOT
     5.1 --- a/php-ldap/receipt	Tue Dec 02 12:32:00 2008 +0000
     5.2 +++ b/php-ldap/receipt	Tue Dec 02 14:48:36 2008 +0000
     5.3 @@ -36,8 +36,12 @@
     5.4  	    sed -e 's|;.*extension=msql.so|;   extension=msql.so\nextension=ldap.so|' -i $1/etc/php.ini
     5.5  	# Start Web server.
     5.6  	while read daemon file; do
     5.7 -		if [ -z "$1" -a -f /etc/init.d/$daemon \
     5.8 -			     -a ! -f "/var/run/$file" ]; then
     5.9 +		[ -z "$1" ] || continue
    5.10 +		if [ -f "/var/run/$file" ]; then
    5.11 +			/etc/init.d/$daemon stop
    5.12 +			sleep 2
    5.13 +		fi
    5.14 +		if [ -f /etc/init.d/$daemon ]; then
    5.15  			/etc/init.d/$daemon start
    5.16  		fi
    5.17  	done <<EOT
    5.18 @@ -53,7 +57,9 @@
    5.19  
    5.20  	# Start Web server.
    5.21  	while read daemon file; do
    5.22 -		if [ -f /etc/init.d/$daemon -a ! -f "/var/run/$file" ]; then
    5.23 +		if [ -f /etc/init.d/$daemon -a -f "/var/run/$file" ]; then
    5.24 +			/etc/init.d/$daemon stop
    5.25 +			sleep 2
    5.26  			/etc/init.d/$daemon start
    5.27  		fi
    5.28  	done <<EOT
     6.1 --- a/php-mhash/receipt	Tue Dec 02 12:32:00 2008 +0000
     6.2 +++ b/php-mhash/receipt	Tue Dec 02 14:48:36 2008 +0000
     6.3 @@ -36,8 +36,12 @@
     6.4  	    sed -e 's|;.*extension=msql.so|;   extension=msql.so\nextension=mhash.so|' -i $1/etc/php.ini
     6.5  	# Start Web server.
     6.6  	while read daemon file; do
     6.7 -		if [ -z "$1" -a -f /etc/init.d/$daemon \
     6.8 -			     -a ! -f "/var/run/$file" ]; then
     6.9 +		[ -z "$1" ] || continue
    6.10 +		if [ -f "/var/run/$file" ]; then
    6.11 +			/etc/init.d/$daemon stop
    6.12 +			sleep 2
    6.13 +		fi
    6.14 +		if [ -f /etc/init.d/$daemon ]; then
    6.15  			/etc/init.d/$daemon start
    6.16  		fi
    6.17  	done <<EOT
    6.18 @@ -53,7 +57,9 @@
    6.19  
    6.20  	# Start Web server.
    6.21  	while read daemon file; do
    6.22 -		if [ -f /etc/init.d/$daemon -a ! -f "/var/run/$file" ]; then
    6.23 +		if [ -f /etc/init.d/$daemon -a -f "/var/run/$file" ]; then
    6.24 +			/etc/init.d/$daemon stop
    6.25 +			sleep 2
    6.26  			/etc/init.d/$daemon start
    6.27  		fi
    6.28  	done <<EOT
     7.1 --- a/php-mysql/receipt	Tue Dec 02 12:32:00 2008 +0000
     7.2 +++ b/php-mysql/receipt	Tue Dec 02 14:48:36 2008 +0000
     7.3 @@ -36,8 +36,12 @@
     7.4  	    sed -e 's|;.*extension=msql.so|;   extension=msql.so\nextension=mysql.so|' -i $1/etc/php.ini
     7.5  	# Start Web server.
     7.6  	while read daemon file; do
     7.7 -		if [ -z "$1" -a -f /etc/init.d/$daemon \
     7.8 -			     -a ! -f "/var/run/$file" ]; then
     7.9 +		[ -z "$1" ] || continue
    7.10 +		if [ -f "/var/run/$file" ]; then
    7.11 +			/etc/init.d/$daemon stop
    7.12 +			sleep 2
    7.13 +		fi
    7.14 +		if [ -f /etc/init.d/$daemon ]; then
    7.15  			/etc/init.d/$daemon start
    7.16  		fi
    7.17  	done <<EOT
    7.18 @@ -53,7 +57,9 @@
    7.19  
    7.20  	# Start Web server.
    7.21  	while read daemon file; do
    7.22 -		if [ -f /etc/init.d/$daemon -a ! -f "/var/run/$file" ]; then
    7.23 +		if [ -f /etc/init.d/$daemon -a -f "/var/run/$file" ]; then
    7.24 +			/etc/init.d/$daemon stop
    7.25 +			sleep 2
    7.26  			/etc/init.d/$daemon start
    7.27  		fi
    7.28  	done <<EOT
     8.1 --- a/php-pear/receipt	Tue Dec 02 12:32:00 2008 +0000
     8.2 +++ b/php-pear/receipt	Tue Dec 02 14:48:36 2008 +0000
     8.3 @@ -19,15 +19,34 @@
     8.4  }
     8.5  
     8.6  # Pre and post install commands for Tazpkg.
     8.7 +pre_install()
     8.8 +{
     8.9 +	while read daemon file; do
    8.10 +		if [ -z "$1" -a -f "/var/run/$file" ]; then
    8.11 +			/etc/init.d/$daemon stop
    8.12 +		fi
    8.13 +	done <<EOT
    8.14 +apache apache/httpd.pid
    8.15 +lighttpd lighttpd.pid
    8.16 +EOT
    8.17 +}
    8.18 +
    8.19  post_install()
    8.20  {
    8.21  	grep ^include_path $1/etc/php.ini
    8.22  	sed -i 's|/php/includes"|/php/includes"\ninclude_path = ".:/usr/share/php"|' $1/etc/php.ini
    8.23  	# Restart Web server.
    8.24 -	for daemon in apache lighttpd ; do
    8.25 +	while read daemon file; do
    8.26 +		[ -z "$1" ] || continue
    8.27 +		if [ -f "/var/run/$file" ]; then
    8.28 +			/etc/init.d/$daemon stop
    8.29 +			sleep 2
    8.30 +		fi
    8.31  		if [ -f /etc/init.d/$daemon ]; then
    8.32 -			/etc/init.d/$daemon stop
    8.33  			/etc/init.d/$daemon start
    8.34  		fi
    8.35 -	done
    8.36 +	done <<EOT
    8.37 +apache apache/httpd.pid
    8.38 +lighttpd lighttpd.pid
    8.39 +EOT
    8.40  }
     9.1 --- a/php-pgsql/receipt	Tue Dec 02 12:32:00 2008 +0000
     9.2 +++ b/php-pgsql/receipt	Tue Dec 02 14:48:36 2008 +0000
     9.3 @@ -36,8 +36,12 @@
     9.4  	    sed -e 's|;.*extension=msql.so|;   extension=msql.so\nextension=pgsql.so|' -i $1/etc/php.ini
     9.5  	# Start Web server.
     9.6  	while read daemon file; do
     9.7 -		if [ -z "$1" -a -f /etc/init.d/$daemon \
     9.8 -			     -a ! -f "/var/run/$file" ]; then
     9.9 +		[ -z "$1" ] || continue
    9.10 +		if [ -f "/var/run/$file" ]; then
    9.11 +			/etc/init.d/$daemon stop
    9.12 +			sleep 2
    9.13 +		fi
    9.14 +		if [ -f /etc/init.d/$daemon ]; then
    9.15  			/etc/init.d/$daemon start
    9.16  		fi
    9.17  	done <<EOT
    9.18 @@ -53,7 +57,9 @@
    9.19  
    9.20  	# Start Web server.
    9.21  	while read daemon file; do
    9.22 -		if [ -f /etc/init.d/$daemon -a ! -f "/var/run/$file" ]; then
    9.23 +		if [ -f /etc/init.d/$daemon -a -f "/var/run/$file" ]; then
    9.24 +			/etc/init.d/$daemon stop
    9.25 +			sleep 2
    9.26  			/etc/init.d/$daemon start
    9.27  		fi
    9.28  	done <<EOT