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