wok-6.x annotate glpi/receipt @ rev 5428
Up: 1ibgsf (1.14.16)
author | Christopher Rogers <slaxemulator@gmail.com> |
---|---|
date | Tue May 04 19:49:47 2010 +0000 (2010-05-04) |
parents | 2077fae2c4c3 |
children | 9ece8f68b694 |
rev | line source |
---|---|
erjo@2714 | 1 # SliTaz package receipt. |
erjo@2714 | 2 |
erjo@2714 | 3 PACKAGE="glpi" |
erjo@4439 | 4 VERSION="0.72.3" |
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 { |
erjo@2714 | 39 # Configure apache server |
erjo@2714 | 40 if [ -f $1/etc/apache/httpd.conf ]; then |
erjo@2714 | 41 if [ ! -f $1/etc/apache/conf.d/glpi ]; then |
erjo@2714 | 42 cat > $1/etc/apache/conf.d/glpi <<EOT |
erjo@2714 | 43 <IfModule mod_alias.c> |
erjo@2714 | 44 Alias /glpi /usr/share/glpi/ |
erjo@2714 | 45 </IfModule> |
erjo@2714 | 46 <Directory "/usr/share/glpi"> |
erjo@2714 | 47 Options Indexes FollowSymLinks |
erjo@2714 | 48 AllowOverride None |
erjo@2714 | 49 Order deny,allow |
erjo@2714 | 50 Allow from all |
erjo@2714 | 51 </Directory> |
erjo@2714 | 52 |
erjo@2714 | 53 EOT |
erjo@2714 | 54 if [ -z "$1" ]; then |
erjo@2714 | 55 # Start Web server. |
erjo@2714 | 56 test -f /var/run/apache/httpd.pid && \ |
erjo@2714 | 57 ( kill -0 $(cat /var/run/apache/httpd.pid) && /etc/init.d/apache restart ) |
erjo@2714 | 58 fi |
erjo@2714 | 59 fi |
erjo@2714 | 60 fi |
erjo@2714 | 61 |
erjo@2714 | 62 # Configure every thing for glpi. |
erjo@2714 | 63 if [ -z $1 ]; then |
erjo@2714 | 64 if ( ! mysqladmin -s ping > /dev/null ); then |
erjo@2714 | 65 echo "Starting MySQL server" |
erjo@2714 | 66 ( /etc/init.d/mysql start ; status ) || exit |
erjo@2714 | 67 sleep 4 #let the mysql daemon start |
erjo@2714 | 68 fi |
erjo@3672 | 69 if ( ! mysql -u root -Be 'show databases' | grep -q glpi ); then |
erjo@2714 | 70 echo -n "Create Glpi database" |
erjo@2714 | 71 mysql -Be "create database glpi" ; status |
erjo@2714 | 72 # We suppose that glpi user does not exist. |
erjo@2714 | 73 # It may be false. |
erjo@2714 | 74 echo -n "Create user glpi with password glpi" |
erjo@2714 | 75 mysql -Be "grant all privileges on glpi.* to 'glpi'@'localhost' |
erjo@2714 | 76 identified by 'glpi'" ; status |
erjo@2714 | 77 # At last create the database for glpi. |
erjo@2714 | 78 echo -n "Create glpi database schema." |
erjo@4439 | 79 mysql -u glpi -pglpi -D glpi < /usr/share/glpi/install/mysql/glpi-${VERSION}-empty.sql ; status |
erjo@2714 | 80 |
erjo@2714 | 81 fi |
erjo@2714 | 82 |
erjo@2714 | 83 fi |
erjo@2714 | 84 } |
erjo@2714 | 85 |
erjo@2714 | 86 post_remove() |
erjo@2714 | 87 { |
erjo@2714 | 88 echo -n "Would you like to remove data and database files.(y/n) " |
erjo@2714 | 89 read answer |
erjo@2714 | 90 |
erjo@2714 | 91 case $answer in |
erjo@2714 | 92 y|Y) |
erjo@2714 | 93 echo -n "Removing data directories..." |
erjo@2714 | 94 rm -rf /var/lib/glpi ; status |
erjo@3672 | 95 if ( mysql -u root -Be 'show databases' | grep -q glpi ); then |
erjo@2714 | 96 echo -n "Deleting Glpi database" |
erjo@2714 | 97 mysql -Be "drop database glpi" ; status |
erjo@2714 | 98 # We suppose that glpi user does not exist. |
erjo@2714 | 99 # It may be false. |
erjo@2714 | 100 echo -n "Delete user glpi" |
erjo@3672 | 101 mysql -Be "delete from mysql.db where user='glpi'" ; status |
erjo@2714 | 102 fi |
erjo@2714 | 103 unset $answer |
erjo@2714 | 104 ;; |
erjo@2714 | 105 *) |
erjo@2714 | 106 ;; |
erjo@2714 | 107 esac |
erjo@2714 | 108 |
erjo@2714 | 109 } |
erjo@2714 | 110 |