wok annotate glpi/receipt @ rev 22337

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