wok-current view glpi/receipt @ rev 23361

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