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