wok annotate glpi/receipt @ rev 23402

updated perl-test-requires (0.09 -> 0.10)
author Hans-G?nter Theisgen
date Tue Mar 31 17:47:09 2020 +0100 (2020-03-31)
parents 3c4984210f2b
children 376c63dc731b
rev   line source
erjo@2714 1 # SliTaz package receipt.
erjo@2714 2
erjo@2714 3 PACKAGE="glpi"
Hans-G?nter@22855 4 VERSION="9.4.5"
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
Hans-G?nter@22855 14 DEPENDS="apache logrotate mysql pam php-apache php-imap php-ldap php-mysql"
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 {
Hans-G?nter@22855 21 mkdir -p $fs/usr/share/$PACKAGE
Hans-G?nter@22855 22 mkdir -p $fs/etc/$PACKAGE
Hans-G?nter@22855 23 mkdir -p $fs/var/log/$PACKAGE
Hans-G?nter@22855 24 mkdir -p $fs/var/lib/$PACKAGE
erjo@2714 25
Hans-G?nter@22855 26 cp -a $src/* $fs/usr/share/$PACKAGE
Hans-G?nter@22855 27 [ -d $fs/usr/share/$PACKAGE/files ] &&
Hans-G?nter@22855 28 mv $fs/usr/share/$PACKAGE/files $fs/var/lib/$PACKAGE
Hans-G?nter@22855 29
Hans-G?nter@22855 30 # Copy configuration db as temporary file.
Hans-G?nter@22855 31 cp $stuff/config_db.php $fs/etc/glpi/
Hans-G?nter@22855 32 cp -a $stuff/logrotate.d $fs/etc
Hans-G?nter@22855 33
erjo@2714 34 cd $fs/usr/share/glpi
erjo@8353 35 [ -f config/config_db.php ] && rm -f config/config_db.php
erjo@8353 36 [ -f config/config_db_slave.php ] && rm -f config/config_db_slave.php
erjo@8353 37 ln -s /etc/glpi/config_db.php config/
Hans-G?nter@22855 38 [ -f $fs/etc/glpi/config_db_slave.php ] &&
Hans-G?nter@22855 39 ln -s /etc/glpi/config_db_slave.php config/
erjo@8353 40 ln -s /var/lib/glpi/files
erjo@2714 41 cd -
Hans-G?nter@22855 42 chown -R www.www $fs/var/lib/$PACKAGE/files \
Hans-G?nter@22855 43 $fs/etc/$PACKAGE/*
erjo@8353 44
erjo@8353 45 # Create the magic file config_path.php
erjo@8353 46 cat <<EOF> $fs/usr/share/glpi/config/config_path.php
erjo@8353 47 <?php
erjo@8353 48 // for packaging defaults
erjo@8353 49
erjo@8353 50 define("GLPI_CONFIG_DIR", "/etc/glpi");
erjo@8353 51
erjo@8353 52 define("GLPI_DOC_DIR", "/var/lib/glpi/files");
erjo@8353 53 define("GLPI_DUMP_DIR", "/var/lib/glpi/files/_dumps");
erjo@8353 54 define("GLPI_CACHE_DIR", "/var/lib/glpi/files/_cache/");
erjo@8353 55 define("GLPI_CRON_DIR", "/var/lib/glpi/files/_cron");
erjo@8353 56 define("GLPI_SESSION_DIR", "/var/lib/glpi/files/_sessions");
erjo@8353 57 define("GLPI_PLUGIN_DOC_DIR", "/var/lib/glpi/files/_plugins");
erjo@8353 58 define("GLPI_LOCK_DIR", "/var/lib/glpi/files/_lock/");
erjo@8353 59
erjo@8353 60 define("GLPI_LOG_DIR", "/var/log/glpi");
erjo@8353 61 ?>
erjo@8353 62
erjo@8353 63 EOF
pascal@2715 64 }
pascal@2715 65
pascal@2715 66 post_install()
pascal@2715 67 {
erjo@2714 68 # Configure apache server
Hans-G?nter@22855 69 if [ -f "$1/etc/apache/httpd.conf" ]
Hans-G?nter@22855 70 then
Hans-G?nter@22855 71 if [ ! -f "$1/etc/apache/conf.d/glpi" ]
Hans-G?nter@22855 72 then
pascal@18730 73 cat > "$1/etc/apache/conf.d/glpi" <<EOT
erjo@2714 74 <IfModule mod_alias.c>
erjo@2714 75 Alias /glpi /usr/share/glpi/
erjo@2714 76 </IfModule>
erjo@2714 77 <Directory "/usr/share/glpi">
erjo@2714 78 Options Indexes FollowSymLinks
erjo@8353 79
erjo@8353 80 php_value memory_limit 64M
erjo@8353 81
erjo@2714 82 AllowOverride None
erjo@2714 83 Order deny,allow
erjo@2714 84 Allow from all
erjo@2714 85 </Directory>
erjo@2714 86
erjo@8353 87 <Directory /usr/share/glpi/config>
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/locales>
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/install/mysql>
erjo@8353 98 Order Allow,Deny
erjo@8353 99 Deny from all
erjo@8353 100 </Directory>
erjo@8353 101
erjo@8353 102 <Directory /usr/share/glpi/scripts>
erjo@8353 103 Order Allow,Deny
erjo@8353 104 Deny from all
erjo@8353 105 </Directory>
erjo@8353 106
erjo@8353 107
erjo@2714 108 EOT
Hans-G?nter@22855 109 if [ -z "$1" ]
Hans-G?nter@22855 110 then
erjo@2714 111 # Start Web server.
erjo@2714 112 test -f /var/run/apache/httpd.pid && \
Hans-G?nter@22855 113 ( kill -0 $(cat /var/run/apache/httpd.pid) && \
Hans-G?nter@22855 114 /etc/init.d/apache restart )
erjo@2714 115 fi
erjo@2714 116 fi
erjo@2714 117 fi
erjo@2714 118
erjo@2714 119 # Configure every thing for glpi.
Hans-G?nter@22855 120 if [ -z "$1" ]
Hans-G?nter@22855 121 then
Hans-G?nter@22855 122 if ( ! mysqladmin -s ping > /dev/null )
Hans-G?nter@22855 123 then
erjo@2714 124 echo "Starting MySQL server"
erjo@2714 125 ( /etc/init.d/mysql start ; status ) || exit
erjo@2714 126 sleep 4 #let the mysql daemon start
erjo@2714 127 fi
Hans-G?nter@22855 128 if ( ! mysql -u root -Be 'show databases' | grep -q glpi )
Hans-G?nter@22855 129 then
erjo@2714 130 echo -n "Create Glpi database"
erjo@2714 131 mysql -Be "create database glpi" ; status
erjo@2714 132 # We suppose that glpi user does not exist.
erjo@2714 133 # It may be false.
erjo@2714 134 echo -n "Create user glpi with password glpi"
erjo@2714 135 mysql -Be "grant all privileges on glpi.* to 'glpi'@'localhost'
erjo@2714 136 identified by 'glpi'" ; status
erjo@2714 137 # At last create the database for glpi.
erjo@2714 138 echo -n "Create glpi database schema."
Hans-G?nter@20976 139 mysql -u glpi -pglpi -D glpi < /usr/share/glpi/install/mysql/glpi-9.4-empty.sql ; status
erjo@2714 140
erjo@2714 141 fi
erjo@2714 142
erjo@2714 143 fi
pascal@18707 144 true
erjo@2714 145 }
erjo@2714 146
erjo@2714 147 post_remove()
erjo@2714 148 {
erjo@2714 149 echo -n "Would you like to remove data and database files.(y/n) "
erjo@2714 150 read answer
erjo@2714 151
erjo@2714 152 case $answer in
erjo@2714 153 y|Y)
erjo@2714 154 echo -n "Removing data directories..."
erjo@2714 155 rm -rf /var/lib/glpi ; status
Hans-G?nter@22855 156 if ( mysql -u root -Be 'show databases' | grep -q glpi )
Hans-G?nter@22855 157 then
erjo@2714 158 echo -n "Deleting Glpi database"
erjo@2714 159 mysql -Be "drop database glpi" ; status
erjo@2714 160 # We suppose that glpi user does not exist.
erjo@2714 161 # It may be false.
erjo@2714 162 echo -n "Delete user glpi"
erjo@3672 163 mysql -Be "delete from mysql.db where user='glpi'" ; status
erjo@2714 164 fi
erjo@2714 165 unset $answer
erjo@2714 166 ;;
erjo@2714 167 *)
erjo@2714 168 ;;
erjo@2714 169 esac
erjo@2714 170 }