wok-next view glpi/receipt @ rev 21687
updated glpi (0.80.7 -> 9.4.6)
author | Hans-G?nter Theisgen |
---|---|
date | Mon Jun 29 17:11:21 2020 +0100 (2020-06-29) |
parents | d5aab818505e |
children |
line source
1 # SliTaz package receipt v2.
3 PACKAGE="glpi"
4 VERSION="9.4.6"
5 CATEGORY="network"
6 SHORT_DESC="IT and Asset Management"
7 MAINTAINER="maintainer@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 genpkg_rules()
15 {
16 mkdir -p $fs/usr/share/$PACKAGE \
17 $fs/etc/$PACKAGE \
18 $fs/var/log/$PACKAGE \
19 $fs/var/lib/$PACKAGE
21 cp -a $src/* $fs/usr/share/$PACKAGE
22 [ -d $fs/usr/share/$PACKAGE/files ] &&
23 mv $fs/usr/share/$PACKAGE/files $fs/var/lib/$PACKAGE
25 # Copy configuration db as temporary file.
26 cp $stuff/config_db.php $fs/etc/glpi/
27 cp -a $stuff/logrotate.d $fs/etc
29 cd $fs/usr/share/glpi
30 [ -f config/config_db.php ] && rm -f config/config_db.php
31 [ -f config/config_db_slave.php ] && rm -f config/config_db_slave.php
33 ln -s /etc/glpi/config_db.php config/
34 [ -f $fs/etc/glpi/config_db_slave.php ] && ln -s /etc/glpi/config_db_slave.php config/
35 ln -s /var/lib/glpi/files
36 cd -
37 chown -R www.www $fs/var/lib/$PACKAGE/files
38 chown -R www.www $fs/etc/$PACKAGE/*
40 # Create the magic file config_path.php
41 cat > $fs/usr/share/glpi/config/config_path.php <<EOF
42 <?php
43 // for packaging defaults
45 define("GLPI_CONFIG_DIR", "/etc/glpi");
47 define("GLPI_DOC_DIR", "/var/lib/glpi/files");
48 define("GLPI_DUMP_DIR", "/var/lib/glpi/files/_dumps");
49 define("GLPI_CACHE_DIR", "/var/lib/glpi/files/_cache/");
50 define("GLPI_CRON_DIR", "/var/lib/glpi/files/_cron");
51 define("GLPI_SESSION_DIR", "/var/lib/glpi/files/_sessions");
52 define("GLPI_PLUGIN_DOC_DIR", "/var/lib/glpi/files/_plugins");
53 define("GLPI_LOCK_DIR", "/var/lib/glpi/files/_lock/");
55 define("GLPI_LOG_DIR", "/var/log/glpi");
56 ?>
58 EOF
59 DEPENDS="apache logrotate mysql pam php-apache php-imap php-ldap php-mysql"
60 CONFIG_FILES="/etc/glpi/config_db.php"
61 }
63 post_install()
64 {
65 # Configure apache server
66 if [ -f "$1/etc/apache/httpd.conf" ]
67 then
68 if [ ! -f "$1/etc/apache/conf.d/glpi" ]
69 then
70 cat > "$1/etc/apache/conf.d/glpi" <<EOT
71 <IfModule mod_alias.c>
72 Alias /glpi /usr/share/glpi/
73 </IfModule>
74 <Directory "/usr/share/glpi">
75 Options Indexes FollowSymLinks
77 php_value memory_limit 64M
79 AllowOverride None
80 Order deny,allow
81 Allow from all
82 </Directory>
84 <Directory /usr/share/glpi/config>
85 Order Allow,Deny
86 Deny from all
87 </Directory>
89 <Directory /usr/share/glpi/locales>
90 Order Allow,Deny
91 Deny from all
92 </Directory>
94 <Directory /usr/share/glpi/install/mysql>
95 Order Allow,Deny
96 Deny from all
97 </Directory>
99 <Directory /usr/share/glpi/scripts>
100 Order Allow,Deny
101 Deny from all
102 </Directory>
105 EOT
106 if [ -z "$1" ]
107 then
108 # Start Web server.
109 if [ -f /var/run/apache/httpd.pid ]
110 then
111 kill -0 $(cat /var/run/apache/httpd.pid) &&
112 /etc/init.d/apache restart
113 fi
114 fi
115 fi
116 fi
118 # Configure every thing for glpi.
119 if [ -z "$1" ]
120 then
121 if ( ! mysqladmin -s ping > /dev/null )
122 then
123 echo "Starting MySQL server"
124 ( /etc/init.d/mysql start; status ) || exit
125 sleep 4 #let the mysql daemon start
126 fi
128 if ( ! mysql -u root -Be 'show databases' | grep -q glpi )
129 then
130 action "Create Glpi database"
131 mysql -Be "create database glpi"
132 status
134 # We suppose that glpi user does not exist.
135 # It may be false.
136 action "Create user glpi with password glpi"
137 mysql -Be "grant all privileges on glpi.* to 'glpi'@'localhost'
138 identified by 'glpi'"
139 status
141 # At last create the database for glpi.
142 action "Create glpi database schema"
143 mysql -u glpi -pglpi -D glpi < /usr/share/glpi/install/mysql/glpi-0.80.3-empty.sql
144 status
145 fi
146 fi
147 true
148 }
150 post_remove()
151 {
152 echo -n "Would you like to remove data and database files.(y/n) "
153 read answer
155 case $answer in
156 y|Y)
157 action "Removing data directories..."
158 rm -rf /var/lib/glpi
159 status
161 if ( mysql -u root -Be 'show databases' | grep -q glpi )
162 then
163 action "Deleting Glpi database"
164 mysql -Be "drop database glpi"
165 status
167 # We suppose that glpi user does not exist.
168 # It may be false.
169 action "Delete user glpi"
170 mysql -Be "delete from mysql.db where user='glpi'"
171 status
172 fi
173 ;;
174 esac
175 unset $answer
176 }