wok view glpi/receipt @ rev 25794
created recipe for exo-lang
author | Hans-G?nter Theisgen |
---|---|
date | Wed Oct 23 16:19:52 2024 +0100 (4 weeks ago) |
parents | 20ad21d5532c |
children |
line source
1 # SliTaz package receipt.
3 PACKAGE="glpi"
4 VERSION="10.0.12"
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 # What is the latest version available today?
19 current_version()
20 {
21 wget -O - ${WGET_URL%/down*} 2>/dev/null | \
22 sed '/tag\//!d;s|.*tag/v*||;s|".*||;q'
23 }
25 # Rules to gen a SliTaz package suitable for Tazpkg.
26 genpkg_rules()
27 {
28 mkdir -p $fs/usr/share/$PACKAGE
29 mkdir -p $fs/etc/$PACKAGE
30 mkdir -p $fs/var/log/$PACKAGE
31 mkdir -p $fs/var/lib/$PACKAGE
33 cp -a $src/* $fs/usr/share/$PACKAGE
34 [ -d $fs/usr/share/$PACKAGE/files ] &&
35 mv $fs/usr/share/$PACKAGE/files $fs/var/lib/$PACKAGE
37 # Copy configuration db as temporary file.
38 cp $stuff/config_db.php $fs/etc/glpi/
39 cp -a $stuff/logrotate.d $fs/etc
41 cd $fs/usr/share/glpi
42 [ -f config/config_db.php ] && rm -f config/config_db.php
43 [ -f config/config_db_slave.php ] && rm -f config/config_db_slave.php
44 ln -s /etc/glpi/config_db.php config/
45 [ -f $fs/etc/glpi/config_db_slave.php ] &&
46 ln -s /etc/glpi/config_db_slave.php config/
47 ln -s /var/lib/glpi/files
48 cd -
49 chown -R www.www $fs/var/lib/$PACKAGE/files \
50 $fs/etc/$PACKAGE/*
52 # Create the magic file config_path.php
53 cat <<EOF> $fs/usr/share/glpi/config/config_path.php
54 <?php
55 // for packaging defaults
57 define("GLPI_CONFIG_DIR", "/etc/glpi");
59 define("GLPI_DOC_DIR", "/var/lib/glpi/files");
60 define("GLPI_DUMP_DIR", "/var/lib/glpi/files/_dumps");
61 define("GLPI_CACHE_DIR", "/var/lib/glpi/files/_cache/");
62 define("GLPI_CRON_DIR", "/var/lib/glpi/files/_cron");
63 define("GLPI_SESSION_DIR", "/var/lib/glpi/files/_sessions");
64 define("GLPI_PLUGIN_DOC_DIR", "/var/lib/glpi/files/_plugins");
65 define("GLPI_LOCK_DIR", "/var/lib/glpi/files/_lock/");
67 define("GLPI_LOG_DIR", "/var/log/glpi");
68 ?>
70 EOF
71 }
73 post_install()
74 {
75 # Configure apache server
76 if [ -f "$1/etc/apache/httpd.conf" ]
77 then
78 if [ ! -f "$1/etc/apache/conf.d/glpi" ]
79 then
80 cat > "$1/etc/apache/conf.d/glpi" <<EOT
81 <IfModule mod_alias.c>
82 Alias /glpi /usr/share/glpi/
83 </IfModule>
84 <Directory "/usr/share/glpi">
85 Options Indexes FollowSymLinks
87 php_value memory_limit 64M
89 AllowOverride None
90 Order deny,allow
91 Allow from all
92 </Directory>
94 <Directory /usr/share/glpi/config>
95 Order Allow,Deny
96 Deny from all
97 </Directory>
99 <Directory /usr/share/glpi/locales>
100 Order Allow,Deny
101 Deny from all
102 </Directory>
104 <Directory /usr/share/glpi/install/mysql>
105 Order Allow,Deny
106 Deny from all
107 </Directory>
109 <Directory /usr/share/glpi/scripts>
110 Order Allow,Deny
111 Deny from all
112 </Directory>
115 EOT
116 if [ -z "$1" ]
117 then
118 # Start Web server.
119 test -f /var/run/apache/httpd.pid && \
120 ( kill -0 $(cat /var/run/apache/httpd.pid) && \
121 /etc/init.d/apache restart )
122 fi
123 fi
124 fi
126 # Configure every thing for glpi.
127 if [ -z "$1" ]
128 then
129 if ( ! mysqladmin -s ping > /dev/null )
130 then
131 echo "Starting MySQL server"
132 ( /etc/init.d/mysql start ; status ) || exit
133 sleep 4 #let the mysql daemon start
134 fi
135 if ( ! mysql -u root -Be 'show databases' | grep -q glpi )
136 then
137 echo -n "Create Glpi database"
138 mysql -Be "create database glpi" ; status
139 # We suppose that glpi user does not exist.
140 # It may be false.
141 echo -n "Create user glpi with password glpi"
142 mysql -Be "grant all privileges on glpi.* to 'glpi'@'localhost'
143 identified by 'glpi'" ; status
144 # At last create the database for glpi.
145 echo -n "Create glpi database schema."
146 mysql -u glpi -pglpi -D glpi < /usr/share/glpi/install/mysql/glpi-9.4-empty.sql ; status
148 fi
150 fi
151 true
152 }
154 post_remove()
155 {
156 echo -n "Would you like to remove data and database files.(y/n) "
157 read answer
159 case $answer in
160 y|Y)
161 echo -n "Removing data directories..."
162 rm -rf /var/lib/glpi ; status
163 if ( mysql -u root -Be 'show databases' | grep -q glpi )
164 then
165 echo -n "Deleting Glpi database"
166 mysql -Be "drop database glpi" ; status
167 # We suppose that glpi user does not exist.
168 # It may be false.
169 echo -n "Delete user glpi"
170 mysql -Be "delete from mysql.db where user='glpi'" ; status
171 fi
172 unset $answer
173 ;;
174 *)
175 ;;
176 esac
177 }