wok-6.x view glpi/receipt @ rev 25022

expedite: fix build
author Pascal Bellard <pascal.bellard@slitaz.org>
date Wed May 18 12:49:53 2022 +0000 (2022-05-18)
parents 376c63dc731b
children
line source
1 # SliTaz package receipt.
3 PACKAGE="glpi"
4 VERSION="9.4.6"
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="apache logrotate mysql pam php-apache php-imap php-ldap php-mysql"
15 BUILD_DEPENDS=""
16 CONFIG_FILES="/etc/glpi/config_db.php"
18 current_version()
19 {
20 wget -O - ${WGET_URL%/down*} 2>/dev/null | \
21 sed '/archive.*tar/!d;s|.*/\(.*\).tar.*|\1|;q'
22 }
24 # Rules to gen a SliTaz package suitable for Tazpkg.
25 genpkg_rules()
26 {
27 mkdir -p $fs/usr/share/$PACKAGE
28 mkdir -p $fs/etc/$PACKAGE
29 mkdir -p $fs/var/log/$PACKAGE
30 mkdir -p $fs/var/lib/$PACKAGE
32 cp -a $src/* $fs/usr/share/$PACKAGE
33 [ -d $fs/usr/share/$PACKAGE/files ] &&
34 mv $fs/usr/share/$PACKAGE/files $fs/var/lib/$PACKAGE
36 # Copy configuration db as temporary file.
37 cp $stuff/config_db.php $fs/etc/glpi/
38 cp -a $stuff/logrotate.d $fs/etc
40 cd $fs/usr/share/glpi
41 [ -f config/config_db.php ] && rm -f config/config_db.php
42 [ -f config/config_db_slave.php ] && rm -f config/config_db_slave.php
43 ln -s /etc/glpi/config_db.php config/
44 [ -f $fs/etc/glpi/config_db_slave.php ] &&
45 ln -s /etc/glpi/config_db_slave.php config/
46 ln -s /var/lib/glpi/files
47 cd -
48 chown -R www.www $fs/var/lib/$PACKAGE/files \
49 $fs/etc/$PACKAGE/*
51 # Create the magic file config_path.php
52 cat <<EOF> $fs/usr/share/glpi/config/config_path.php
53 <?php
54 // for packaging defaults
56 define("GLPI_CONFIG_DIR", "/etc/glpi");
58 define("GLPI_DOC_DIR", "/var/lib/glpi/files");
59 define("GLPI_DUMP_DIR", "/var/lib/glpi/files/_dumps");
60 define("GLPI_CACHE_DIR", "/var/lib/glpi/files/_cache/");
61 define("GLPI_CRON_DIR", "/var/lib/glpi/files/_cron");
62 define("GLPI_SESSION_DIR", "/var/lib/glpi/files/_sessions");
63 define("GLPI_PLUGIN_DOC_DIR", "/var/lib/glpi/files/_plugins");
64 define("GLPI_LOCK_DIR", "/var/lib/glpi/files/_lock/");
66 define("GLPI_LOG_DIR", "/var/log/glpi");
67 ?>
69 EOF
70 }
72 post_install()
73 {
74 # Configure apache server
75 if [ -f "$1/etc/apache/httpd.conf" ]
76 then
77 if [ ! -f "$1/etc/apache/conf.d/glpi" ]
78 then
79 cat > "$1/etc/apache/conf.d/glpi" <<EOT
80 <IfModule mod_alias.c>
81 Alias /glpi /usr/share/glpi/
82 </IfModule>
83 <Directory "/usr/share/glpi">
84 Options Indexes FollowSymLinks
86 php_value memory_limit 64M
88 AllowOverride None
89 Order deny,allow
90 Allow from all
91 </Directory>
93 <Directory /usr/share/glpi/config>
94 Order Allow,Deny
95 Deny from all
96 </Directory>
98 <Directory /usr/share/glpi/locales>
99 Order Allow,Deny
100 Deny from all
101 </Directory>
103 <Directory /usr/share/glpi/install/mysql>
104 Order Allow,Deny
105 Deny from all
106 </Directory>
108 <Directory /usr/share/glpi/scripts>
109 Order Allow,Deny
110 Deny from all
111 </Directory>
114 EOT
115 if [ -z "$1" ]
116 then
117 # Start Web server.
118 test -f /var/run/apache/httpd.pid && \
119 ( kill -0 $(cat /var/run/apache/httpd.pid) && \
120 /etc/init.d/apache restart )
121 fi
122 fi
123 fi
125 # Configure every thing for glpi.
126 if [ -z "$1" ]
127 then
128 if ( ! mysqladmin -s ping > /dev/null )
129 then
130 echo "Starting MySQL server"
131 ( /etc/init.d/mysql start ; status ) || exit
132 sleep 4 #let the mysql daemon start
133 fi
134 if ( ! mysql -u root -Be 'show databases' | grep -q glpi )
135 then
136 echo -n "Create Glpi database"
137 mysql -Be "create database glpi" ; status
138 # We suppose that glpi user does not exist.
139 # It may be false.
140 echo -n "Create user glpi with password glpi"
141 mysql -Be "grant all privileges on glpi.* to 'glpi'@'localhost'
142 identified by 'glpi'" ; status
143 # At last create the database for glpi.
144 echo -n "Create glpi database schema."
145 mysql -u glpi -pglpi -D glpi < /usr/share/glpi/install/mysql/glpi-9.4-empty.sql ; status
147 fi
149 fi
150 true
151 }
153 post_remove()
154 {
155 echo -n "Would you like to remove data and database files.(y/n) "
156 read answer
158 case $answer in
159 y|Y)
160 echo -n "Removing data directories..."
161 rm -rf /var/lib/glpi ; status
162 if ( mysql -u root -Be 'show databases' | grep -q glpi )
163 then
164 echo -n "Deleting Glpi database"
165 mysql -Be "drop database glpi" ; status
166 # We suppose that glpi user does not exist.
167 # It may be false.
168 echo -n "Delete user glpi"
169 mysql -Be "delete from mysql.db where user='glpi'" ; status
170 fi
171 unset $answer
172 ;;
173 *)
174 ;;
175 esac
176 }