wok annotate glpi/receipt @ rev 3668

Upgrade: cpio (2.9 to 2.10)
author Matthew Sheets <rcx@zoominternet.net>
date Fri Jul 10 10:41:43 2009 +0000 (2009-07-10)
parents e08653819ea5
children 90b9bfd8dfb0
rev   line source
erjo@2714 1 # SliTaz package receipt.
erjo@2714 2
erjo@2714 3 PACKAGE="glpi"
erjo@2714 4 VERSION="0.71.5"
erjo@2714 5 CATEGORY="network"
erjo@2714 6 SHORT_DESC="IT and Asset Management."
erjo@2714 7 MAINTAINER="erjo@slitaz.org"
erjo@2714 8 DEPENDS="mysql apache php-apache php-ldap php-imap php-mysql pam"
erjo@2714 9 TARBALL="$PACKAGE-$VERSION.tar.gz"
erjo@2714 10 WEB_SITE="http://glpi-project.org/"
erjo@2714 11 WGET_URL="http://glpi-project.org/IMG/gz/$TARBALL"
erjo@2714 12 CONFIG_FILES="/etc/glpi/config/config_db.php"
erjo@2714 13
erjo@2714 14 # Rules to gen a SliTaz package suitable for Tazpkg.
erjo@2714 15 genpkg_rules()
erjo@2714 16 {
erjo@2714 17 test -d $PACKAGE && mv $PACKAGE $PACKAGE-$VERSION
erjo@2714 18
erjo@2714 19 _pkg=$src
erjo@2714 20
erjo@2714 21 mkdir -p $fs/usr/share/$PACKAGE \
erjo@2714 22 $fs/etc/$PACKAGE \
erjo@2714 23 $fs/var/lib/$PACKAGE
erjo@2714 24
erjo@2714 25 cp -a $_pkg/* $fs/usr/share/$PACKAGE
erjo@2714 26 [ -d $fs/usr/share/$PACKAGE/files ] && mv $fs/usr/share/$PACKAGE/files $fs/var/lib/$PACKAGE
erjo@2714 27 [ -d $fs/usr/share/$PACKAGE/config ] && mv $fs/usr/share/$PACKAGE/config $fs/etc/$PACKAGE
erjo@2714 28
erjo@2714 29 cd $fs/usr/share/glpi
erjo@2714 30 ln -s /etc/glpi/config ; ln -s /var/lib/glpi/files
erjo@2714 31 cd -
erjo@2714 32 chown -R www.www $fs/var/lib/$PACKAGE/files $fs/etc/$PACKAGE/config
erjo@2714 33 # Copy config db as temporary file.
erjo@2714 34 cp stuff/config_db.php $fs/etc/glpi/config/
pascal@2715 35 }
pascal@2715 36
pascal@2715 37 post_install()
pascal@2715 38 {
pascal@2715 39 # Configure lighttpd server
pascal@2715 40 if [ -f $1/etc/lighttpd/lighttpd.conf ]; then
pascal@2715 41 if ! grep -q /usr/share/glpi/ $1/etc/lighttpd/lighttpd.conf; then
pascal@2715 42 sed -e 's|.*"/examples/" => "/usr/share/examples/",| "/examples/" => "/usr/share/examples/",\n "/glpi/" => "/usr/share/glpi/",|g' -i $1/etc/lighttpd/lighttpd.conf
pascal@2715 43 if [ -z "$1" ]; then
pascal@2715 44 # Start Web server.
pascal@2715 45 /etc/init.d/lighttpd stop
pascal@2715 46 /etc/init.d/lighttpd start
pascal@2715 47 fi
pascal@2715 48 fi
pascal@2715 49 fi
erjo@2714 50 # Configure apache server
erjo@2714 51 if [ -f $1/etc/apache/httpd.conf ]; then
erjo@2714 52 if [ ! -f $1/etc/apache/conf.d/glpi ]; then
erjo@2714 53 cat > $1/etc/apache/conf.d/glpi <<EOT
erjo@2714 54 <IfModule mod_alias.c>
erjo@2714 55 Alias /glpi /usr/share/glpi/
erjo@2714 56 </IfModule>
erjo@2714 57 <Directory "/usr/share/glpi">
erjo@2714 58 Options Indexes FollowSymLinks
erjo@2714 59 AllowOverride None
erjo@2714 60 Order deny,allow
erjo@2714 61 Allow from all
erjo@2714 62 </Directory>
erjo@2714 63
erjo@2714 64 EOT
erjo@2714 65 if [ -z "$1" ]; then
erjo@2714 66 # Start Web server.
erjo@2714 67 test -f /var/run/apache/httpd.pid && \
erjo@2714 68 ( kill -0 $(cat /var/run/apache/httpd.pid) && /etc/init.d/apache restart )
erjo@2714 69 fi
erjo@2714 70 fi
erjo@2714 71 fi
erjo@2714 72
erjo@2714 73 # Configure every thing for glpi.
erjo@2714 74 if [ -z $1 ]; then
erjo@2714 75 if ( ! mysqladmin -s ping > /dev/null ); then
erjo@2714 76 echo "Starting MySQL server"
erjo@2714 77 ( /etc/init.d/mysql start ; status ) || exit
erjo@2714 78 sleep 4 #let the mysql daemon start
erjo@2714 79 fi
erjo@2714 80 if ( ! mysql -Be 'show databases' | grep -q glpi ); then
erjo@2714 81 echo -n "Create Glpi database"
erjo@2714 82 mysql -Be "create database glpi" ; status
erjo@2714 83 # We suppose that glpi user does not exist.
erjo@2714 84 # It may be false.
erjo@2714 85 echo -n "Create user glpi with password glpi"
erjo@2714 86 mysql -Be "grant all privileges on glpi.* to 'glpi'@'localhost'
erjo@2714 87 identified by 'glpi'" ; status
erjo@2714 88 # At last create the database for glpi.
erjo@2714 89 echo -n "Create glpi database schema."
erjo@2714 90 mysql -u glpi -pglpi -D glpi < /usr/share/glpi/install/mysql/glpi-0.71.3-empty.sql ; status
erjo@2714 91
erjo@2714 92 fi
erjo@2714 93
erjo@2714 94 fi
erjo@2714 95 }
erjo@2714 96
erjo@2714 97 post_remove()
erjo@2714 98 {
erjo@2714 99 echo -n "Would you like to remove data and database files.(y/n) "
erjo@2714 100 read answer
erjo@2714 101
erjo@2714 102 case $answer in
erjo@2714 103 y|Y)
erjo@2714 104 echo -n "Removing data directories..."
erjo@2714 105 rm -rf /var/lib/glpi ; status
erjo@2714 106 if ( ! mysql -Be 'show databases' | grep -q glpi ); then
erjo@2714 107 echo -n "Deleting Glpi database"
erjo@2714 108 mysql -Be "drop database glpi" ; status
erjo@2714 109 # We suppose that glpi user does not exist.
erjo@2714 110 # It may be false.
erjo@2714 111 echo -n "Delete user glpi"
erjo@2714 112 mysql -Be "delete from mysql.db where user=glpi" ; status
erjo@2714 113 fi
erjo@2714 114 unset $answer
erjo@2714 115 ;;
erjo@2714 116 *)
erjo@2714 117 ;;
erjo@2714 118 esac
erjo@2714 119
erjo@2714 120 }
erjo@2714 121