wok-4.x annotate glpi/receipt @ rev 2714
Add: glpi
author | Eric Joseph-Alexandre <erjo@slitaz.org> |
---|---|
date | Thu Apr 23 16:13:34 2009 +0200 (2009-04-23) |
parents | |
children | 8b97e8e73827 |
rev | line source |
---|---|
erjo@2714 | 1 # SliTaz package receipt. |
erjo@2714 | 2 |
erjo@2714 | 3 PACKED_SIZE="2.0M" |
erjo@2714 | 4 UNPACKED_SIZE="11.5M" |
erjo@2714 | 5 PACKAGE="glpi" |
erjo@2714 | 6 VERSION="0.71.5" |
erjo@2714 | 7 CATEGORY="network" |
erjo@2714 | 8 SHORT_DESC="IT and Asset Management." |
erjo@2714 | 9 MAINTAINER="erjo@slitaz.org" |
erjo@2714 | 10 DEPENDS="mysql apache php-apache php-ldap php-imap php-mysql pam" |
erjo@2714 | 11 TARBALL="$PACKAGE-$VERSION.tar.gz" |
erjo@2714 | 12 WEB_SITE="http://glpi-project.org/" |
erjo@2714 | 13 WGET_URL="http://glpi-project.org/IMG/gz/$TARBALL" |
erjo@2714 | 14 CONFIG_FILES="/etc/glpi/config/config_db.php" |
erjo@2714 | 15 |
erjo@2714 | 16 |
erjo@2714 | 17 |
erjo@2714 | 18 # Rules to gen a SliTaz package suitable for Tazpkg. |
erjo@2714 | 19 genpkg_rules() |
erjo@2714 | 20 { |
erjo@2714 | 21 test -d $PACKAGE && mv $PACKAGE $PACKAGE-$VERSION |
erjo@2714 | 22 |
erjo@2714 | 23 _pkg=$src |
erjo@2714 | 24 |
erjo@2714 | 25 mkdir -p $fs/usr/share/$PACKAGE \ |
erjo@2714 | 26 $fs/etc/$PACKAGE \ |
erjo@2714 | 27 $fs/var/lib/$PACKAGE |
erjo@2714 | 28 |
erjo@2714 | 29 cp -a $_pkg/* $fs/usr/share/$PACKAGE |
erjo@2714 | 30 [ -d $fs/usr/share/$PACKAGE/files ] && mv $fs/usr/share/$PACKAGE/files $fs/var/lib/$PACKAGE |
erjo@2714 | 31 [ -d $fs/usr/share/$PACKAGE/config ] && mv $fs/usr/share/$PACKAGE/config $fs/etc/$PACKAGE |
erjo@2714 | 32 |
erjo@2714 | 33 cd $fs/usr/share/glpi |
erjo@2714 | 34 ln -s /etc/glpi/config ; ln -s /var/lib/glpi/files |
erjo@2714 | 35 cd - |
erjo@2714 | 36 chown -R www.www $fs/var/lib/$PACKAGE/files $fs/etc/$PACKAGE/config |
erjo@2714 | 37 # Copy config db as temporary file. |
erjo@2714 | 38 cp stuff/config_db.php $fs/etc/glpi/config/ |
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 |
erjo@2714 | 63 post_install() |
erjo@2714 | 64 { |
erjo@2714 | 65 # Configure every thing for glpi. |
erjo@2714 | 66 if [ -z $1 ]; then |
erjo@2714 | 67 if ( ! mysqladmin -s ping > /dev/null ); then |
erjo@2714 | 68 echo "Starting MySQL server" |
erjo@2714 | 69 ( /etc/init.d/mysql start ; status ) || exit |
erjo@2714 | 70 sleep 4 #let the mysql daemon start |
erjo@2714 | 71 fi |
erjo@2714 | 72 if ( ! mysql -Be 'show databases' | grep -q glpi ); then |
erjo@2714 | 73 echo -n "Create Glpi database" |
erjo@2714 | 74 mysql -Be "create database glpi" ; status |
erjo@2714 | 75 # We suppose that glpi user does not exist. |
erjo@2714 | 76 # It may be false. |
erjo@2714 | 77 echo -n "Create user glpi with password glpi" |
erjo@2714 | 78 mysql -Be "grant all privileges on glpi.* to 'glpi'@'localhost' |
erjo@2714 | 79 identified by 'glpi'" ; status |
erjo@2714 | 80 # At last create the database for glpi. |
erjo@2714 | 81 echo -n "Create glpi database schema." |
erjo@2714 | 82 mysql -u glpi -pglpi -D glpi < /usr/share/glpi/install/mysql/glpi-0.71.3-empty.sql ; status |
erjo@2714 | 83 |
erjo@2714 | 84 fi |
erjo@2714 | 85 |
erjo@2714 | 86 fi |
erjo@2714 | 87 } |
erjo@2714 | 88 |
erjo@2714 | 89 post_remove() |
erjo@2714 | 90 { |
erjo@2714 | 91 echo -n "Would you like to remove data and database files.(y/n) " |
erjo@2714 | 92 read answer |
erjo@2714 | 93 |
erjo@2714 | 94 case $answer in |
erjo@2714 | 95 y|Y) |
erjo@2714 | 96 echo -n "Removing data directories..." |
erjo@2714 | 97 rm -rf /var/lib/glpi ; status |
erjo@2714 | 98 if ( ! mysql -Be 'show databases' | grep -q glpi ); then |
erjo@2714 | 99 echo -n "Deleting Glpi database" |
erjo@2714 | 100 mysql -Be "drop database glpi" ; status |
erjo@2714 | 101 # We suppose that glpi user does not exist. |
erjo@2714 | 102 # It may be false. |
erjo@2714 | 103 echo -n "Delete user glpi" |
erjo@2714 | 104 mysql -Be "delete from mysql.db where user=glpi" ; status |
erjo@2714 | 105 fi |
erjo@2714 | 106 unset $answer |
erjo@2714 | 107 ;; |
erjo@2714 | 108 *) |
erjo@2714 | 109 ;; |
erjo@2714 | 110 esac |
erjo@2714 | 111 |
erjo@2714 | 112 } |
erjo@2714 | 113 |