wok-next diff glpi/receipt @ rev 21150

All the sorts of Lua 5
author Aleksej Bobylev <al.bobylev@gmail.com>
date Wed Jan 30 23:34:32 2019 +0200 (2019-01-30)
parents d43bf7aae921
children 91e00e1a57ba
line diff
     1.1 --- a/glpi/receipt	Wed Mar 21 15:58:17 2018 +0200
     1.2 +++ b/glpi/receipt	Wed Jan 30 23:34:32 2019 +0200
     1.3 @@ -3,31 +3,27 @@
     1.4  PACKAGE="glpi"
     1.5  VERSION="0.80.7"
     1.6  CATEGORY="network"
     1.7 -SHORT_DESC="IT and Asset Management."
     1.8 -MAINTAINER="erjo@slitaz.org"
     1.9 +SHORT_DESC="IT and Asset Management"
    1.10 +MAINTAINER="devel@slitaz.org"
    1.11  LICENSE="GPL2"
    1.12 +WEB_SITE="http://glpi-project.org/"
    1.13 +
    1.14  TARBALL="$PACKAGE-$VERSION.tar.gz"
    1.15 -WEB_SITE="http://glpi-project.org/"
    1.16  WGET_URL="https://forge.indepnet.net/attachments/download/1054/$TARBALL"
    1.17 -CONFIG_FILES="/etc/glpi/config_db.php"
    1.18  
    1.19 -DEPENDS="mysql apache php-apache php-ldap php-imap php-mysql pam logrotate"
    1.20 -
    1.21 -# Rules to gen a SliTaz package suitable for Tazpkg.
    1.22 -genpkg_rules()
    1.23 -{
    1.24 +genpkg_rules() {
    1.25  	mkdir -p $fs/usr/share/$PACKAGE \
    1.26  		$fs/etc/$PACKAGE \
    1.27  		$fs/var/log/$PACKAGE \
    1.28  		$fs/var/lib/$PACKAGE
    1.29 -		 
    1.30 +
    1.31  	cp -a $src/* $fs/usr/share/$PACKAGE
    1.32  	[ -d $fs/usr/share/$PACKAGE/files ] &&  mv $fs/usr/share/$PACKAGE/files $fs/var/lib/$PACKAGE
    1.33  
    1.34  	# Copy config db as temporary file.
    1.35  	cp $stuff/config_db.php $fs/etc/glpi/
    1.36  	cp -a $stuff/logrotate.d $fs/etc
    1.37 -	
    1.38 +
    1.39  	cd $fs/usr/share/glpi
    1.40  	[ -f config/config_db.php ] && rm -f config/config_db.php
    1.41  	[ -f config/config_db_slave.php ] && rm -f config/config_db_slave.php
    1.42 @@ -38,7 +34,7 @@
    1.43  	chown -R www.www $fs/var/lib/$PACKAGE/files $fs/etc/$PACKAGE/*
    1.44  
    1.45  	# Create the magic file config_path.php
    1.46 -	cat <<EOF> $fs/usr/share/glpi/config/config_path.php
    1.47 +	cat > $fs/usr/share/glpi/config/config_path.php <<EOF
    1.48  <?php
    1.49  // for packaging defaults
    1.50  
    1.51 @@ -56,10 +52,11 @@
    1.52  ?>
    1.53  
    1.54  EOF
    1.55 +	DEPENDS="mysql apache php-apache php-ldap php-imap php-mysql pam logrotate"
    1.56 +	CONFIG_FILES="/etc/glpi/config_db.php"
    1.57  }
    1.58  
    1.59 -post_install()
    1.60 -{
    1.61 +post_install() {
    1.62  	# Configure apache server
    1.63  	if [ -f "$1/etc/apache/httpd.conf" ]; then
    1.64  		if [ ! -f "$1/etc/apache/conf.d/glpi" ]; then
    1.65 @@ -101,8 +98,10 @@
    1.66  EOT
    1.67  			if [ -z "$1" ]; then
    1.68  				# Start Web server.
    1.69 -				test -f /var/run/apache/httpd.pid && \
    1.70 -					( kill -0 $(cat /var/run/apache/httpd.pid) && /etc/init.d/apache restart )
    1.71 +				if [ -f /var/run/apache/httpd.pid ]; then
    1.72 +					kill -0 $(cat /var/run/apache/httpd.pid) &&
    1.73 +					/etc/init.d/apache restart
    1.74 +				fi
    1.75  			fi
    1.76  		fi
    1.77  	fi
    1.78 @@ -111,48 +110,53 @@
    1.79  	if [ -z "$1" ]; then
    1.80  		if ( ! mysqladmin -s ping > /dev/null ); then
    1.81  			echo "Starting MySQL server"
    1.82 -			( /etc/init.d/mysql start ; status  ) || exit 
    1.83 +			( /etc/init.d/mysql start; status  ) || exit
    1.84  			sleep 4 #let the mysql daemon start
    1.85  		fi
    1.86 +
    1.87  		if ( ! mysql -u root -Be 'show databases' | grep -q glpi ); then
    1.88 -			echo -n "Create Glpi database"
    1.89 -			mysql -Be "create database glpi" ; status
    1.90 +			action "Create Glpi database"
    1.91 +			mysql -Be "create database glpi"
    1.92 +			status
    1.93 +
    1.94  			# We suppose that glpi user does not exist.
    1.95  			# It may be false.
    1.96 -			echo  -n "Create user glpi with password glpi"
    1.97 -			mysql -Be "grant all privileges on glpi.* to 'glpi'@'localhost' 
    1.98 -				identified by 'glpi'" ; status
    1.99 +			action "Create user glpi with password glpi"
   1.100 +			mysql -Be "grant all privileges on glpi.* to 'glpi'@'localhost'
   1.101 +				identified by 'glpi'"
   1.102 +			status
   1.103 +
   1.104  			# At last create the database for glpi.
   1.105 -			echo -n "Create glpi database schema."
   1.106 -			mysql -u glpi -pglpi -D glpi < /usr/share/glpi/install/mysql/glpi-0.80.3-empty.sql ; status
   1.107 -			
   1.108 +			action "Create glpi database schema"
   1.109 +			mysql -u glpi -pglpi -D glpi < /usr/share/glpi/install/mysql/glpi-0.80.3-empty.sql
   1.110 +			status
   1.111 +			fi
   1.112  		fi
   1.113 -			
   1.114 -	fi
   1.115  	true
   1.116  }
   1.117  
   1.118 -post_remove()
   1.119 -{
   1.120 -		echo -n "Would you like to remove data and database files.(y/n) "
   1.121 -		read answer
   1.122 +post_remove() {
   1.123 +	echo -n "Would you like to remove data and database files.(y/n) "
   1.124 +	read answer
   1.125  
   1.126 -		case $answer in 
   1.127 +	case $answer in
   1.128  		y|Y)
   1.129 -			echo -n "Removing data directories..."
   1.130 -			rm -rf /var/lib/glpi ; status
   1.131 +			action "Removing data directories..."
   1.132 +			rm -rf /var/lib/glpi
   1.133 +			status
   1.134 +
   1.135  			if ( mysql -u root -Be 'show databases' | grep -q glpi ); then
   1.136 -				echo -n "Deleting Glpi database"
   1.137 -				mysql -Be "drop database glpi" ; status
   1.138 +				action "Deleting Glpi database"
   1.139 +				mysql -Be "drop database glpi"
   1.140 +				 status
   1.141 +
   1.142  				# We suppose that glpi user does not exist.
   1.143  				# It may be false.
   1.144 -				echo  -n "Delete user glpi"
   1.145 -				mysql -Be "delete from mysql.db where user='glpi'" ; status
   1.146 +				action "Delete user glpi"
   1.147 +				mysql -Be "delete from mysql.db where user='glpi'"
   1.148 +				status
   1.149  			fi
   1.150 -			unset $answer
   1.151  			;;
   1.152 -		*)
   1.153 -			;;
   1.154 -		esac
   1.155 -	
   1.156 +	esac
   1.157 +	unset $answer
   1.158  }