wok-next annotate glpi/receipt @ rev 21020

Cleaning is almost finished... I should proceed to upgrades.
author Aleksej Bobylev <al.bobylev@gmail.com>
date Fri Nov 02 14:15:08 2018 +0200 (2018-11-02)
parents d43bf7aae921
children 91e00e1a57ba
rev   line source
erjo@2714 1 # SliTaz package receipt.
erjo@2714 2
erjo@2714 3 PACKAGE="glpi"
erjo@11790 4 VERSION="0.80.7"
erjo@2714 5 CATEGORY="network"
al@21020 6 SHORT_DESC="IT and Asset Management"
al@21020 7 MAINTAINER="devel@slitaz.org"
pascal@15589 8 LICENSE="GPL2"
al@21020 9 WEB_SITE="http://glpi-project.org/"
al@21020 10
erjo@2714 11 TARBALL="$PACKAGE-$VERSION.tar.gz"
erjo@11790 12 WGET_URL="https://forge.indepnet.net/attachments/download/1054/$TARBALL"
erjo@2714 13
al@21020 14 genpkg_rules() {
erjo@2714 15 mkdir -p $fs/usr/share/$PACKAGE \
erjo@2714 16 $fs/etc/$PACKAGE \
erjo@8353 17 $fs/var/log/$PACKAGE \
erjo@2714 18 $fs/var/lib/$PACKAGE
al@21020 19
slaxemulator@8751 20 cp -a $src/* $fs/usr/share/$PACKAGE
erjo@2714 21 [ -d $fs/usr/share/$PACKAGE/files ] && mv $fs/usr/share/$PACKAGE/files $fs/var/lib/$PACKAGE
erjo@2714 22
erjo@8353 23 # Copy config db as temporary file.
erjo@11790 24 cp $stuff/config_db.php $fs/etc/glpi/
erjo@11790 25 cp -a $stuff/logrotate.d $fs/etc
al@21020 26
erjo@2714 27 cd $fs/usr/share/glpi
erjo@8353 28 [ -f config/config_db.php ] && rm -f config/config_db.php
erjo@8353 29 [ -f config/config_db_slave.php ] && rm -f config/config_db_slave.php
erjo@8353 30 ln -s /etc/glpi/config_db.php config/
erjo@8353 31 [ -f $fs/etc/glpi/config_db_slave.php ] && ln -s /etc/glpi/config_db_slave.php config/
erjo@8353 32 ln -s /var/lib/glpi/files
erjo@2714 33 cd -
erjo@8353 34 chown -R www.www $fs/var/lib/$PACKAGE/files $fs/etc/$PACKAGE/*
erjo@8353 35
erjo@8353 36 # Create the magic file config_path.php
al@21020 37 cat > $fs/usr/share/glpi/config/config_path.php <<EOF
erjo@8353 38 <?php
erjo@8353 39 // for packaging defaults
erjo@8353 40
erjo@8353 41 define("GLPI_CONFIG_DIR", "/etc/glpi");
erjo@8353 42
erjo@8353 43 define("GLPI_DOC_DIR", "/var/lib/glpi/files");
erjo@8353 44 define("GLPI_DUMP_DIR", "/var/lib/glpi/files/_dumps");
erjo@8353 45 define("GLPI_CACHE_DIR", "/var/lib/glpi/files/_cache/");
erjo@8353 46 define("GLPI_CRON_DIR", "/var/lib/glpi/files/_cron");
erjo@8353 47 define("GLPI_SESSION_DIR", "/var/lib/glpi/files/_sessions");
erjo@8353 48 define("GLPI_PLUGIN_DOC_DIR", "/var/lib/glpi/files/_plugins");
erjo@8353 49 define("GLPI_LOCK_DIR", "/var/lib/glpi/files/_lock/");
erjo@8353 50
erjo@8353 51 define("GLPI_LOG_DIR", "/var/log/glpi");
erjo@8353 52 ?>
erjo@8353 53
erjo@8353 54 EOF
al@21020 55 DEPENDS="mysql apache php-apache php-ldap php-imap php-mysql pam logrotate"
al@21020 56 CONFIG_FILES="/etc/glpi/config_db.php"
pascal@2715 57 }
pascal@2715 58
al@21020 59 post_install() {
erjo@2714 60 # Configure apache server
pascal@18730 61 if [ -f "$1/etc/apache/httpd.conf" ]; then
pascal@18730 62 if [ ! -f "$1/etc/apache/conf.d/glpi" ]; then
pascal@18730 63 cat > "$1/etc/apache/conf.d/glpi" <<EOT
erjo@2714 64 <IfModule mod_alias.c>
erjo@2714 65 Alias /glpi /usr/share/glpi/
erjo@2714 66 </IfModule>
erjo@2714 67 <Directory "/usr/share/glpi">
erjo@2714 68 Options Indexes FollowSymLinks
erjo@8353 69
erjo@8353 70 php_value memory_limit 64M
erjo@8353 71
erjo@2714 72 AllowOverride None
erjo@2714 73 Order deny,allow
erjo@2714 74 Allow from all
erjo@2714 75 </Directory>
erjo@2714 76
erjo@8353 77 <Directory /usr/share/glpi/config>
erjo@8353 78 Order Allow,Deny
erjo@8353 79 Deny from all
erjo@8353 80 </Directory>
erjo@8353 81
erjo@8353 82 <Directory /usr/share/glpi/locales>
erjo@8353 83 Order Allow,Deny
erjo@8353 84 Deny from all
erjo@8353 85 </Directory>
erjo@8353 86
erjo@8353 87 <Directory /usr/share/glpi/install/mysql>
erjo@8353 88 Order Allow,Deny
erjo@8353 89 Deny from all
erjo@8353 90 </Directory>
erjo@8353 91
erjo@8353 92 <Directory /usr/share/glpi/scripts>
erjo@8353 93 Order Allow,Deny
erjo@8353 94 Deny from all
erjo@8353 95 </Directory>
erjo@8353 96
erjo@8353 97
erjo@2714 98 EOT
erjo@2714 99 if [ -z "$1" ]; then
erjo@2714 100 # Start Web server.
al@21020 101 if [ -f /var/run/apache/httpd.pid ]; then
al@21020 102 kill -0 $(cat /var/run/apache/httpd.pid) &&
al@21020 103 /etc/init.d/apache restart
al@21020 104 fi
erjo@2714 105 fi
erjo@2714 106 fi
erjo@2714 107 fi
erjo@2714 108
erjo@2714 109 # Configure every thing for glpi.
pascal@18730 110 if [ -z "$1" ]; then
erjo@2714 111 if ( ! mysqladmin -s ping > /dev/null ); then
erjo@2714 112 echo "Starting MySQL server"
al@21020 113 ( /etc/init.d/mysql start; status ) || exit
erjo@2714 114 sleep 4 #let the mysql daemon start
erjo@2714 115 fi
al@21020 116
erjo@3672 117 if ( ! mysql -u root -Be 'show databases' | grep -q glpi ); then
al@21020 118 action "Create Glpi database"
al@21020 119 mysql -Be "create database glpi"
al@21020 120 status
al@21020 121
erjo@2714 122 # We suppose that glpi user does not exist.
erjo@2714 123 # It may be false.
al@21020 124 action "Create user glpi with password glpi"
al@21020 125 mysql -Be "grant all privileges on glpi.* to 'glpi'@'localhost'
al@21020 126 identified by 'glpi'"
al@21020 127 status
al@21020 128
erjo@2714 129 # At last create the database for glpi.
al@21020 130 action "Create glpi database schema"
al@21020 131 mysql -u glpi -pglpi -D glpi < /usr/share/glpi/install/mysql/glpi-0.80.3-empty.sql
al@21020 132 status
al@21020 133 fi
erjo@2714 134 fi
pascal@18707 135 true
erjo@2714 136 }
erjo@2714 137
al@21020 138 post_remove() {
al@21020 139 echo -n "Would you like to remove data and database files.(y/n) "
al@21020 140 read answer
erjo@2714 141
al@21020 142 case $answer in
erjo@2714 143 y|Y)
al@21020 144 action "Removing data directories..."
al@21020 145 rm -rf /var/lib/glpi
al@21020 146 status
al@21020 147
erjo@3672 148 if ( mysql -u root -Be 'show databases' | grep -q glpi ); then
al@21020 149 action "Deleting Glpi database"
al@21020 150 mysql -Be "drop database glpi"
al@21020 151 status
al@21020 152
erjo@2714 153 # We suppose that glpi user does not exist.
erjo@2714 154 # It may be false.
al@21020 155 action "Delete user glpi"
al@21020 156 mysql -Be "delete from mysql.db where user='glpi'"
al@21020 157 status
erjo@2714 158 fi
erjo@2714 159 ;;
al@21020 160 esac
al@21020 161 unset $answer
erjo@2714 162 }