wok-6.x view ocsreports/receipt @ rev 8885
Fix bdeps: parole needs intltool to compile
author | Antoine Bodin <gokhlayeh@slitaz.org> |
---|---|
date | Sun Feb 27 05:00:19 2011 +0100 (2011-02-27) |
parents | 93d0091756cf |
children | 129bb5b11a7e |
line source
1 # SliTaz package receipt.
3 PACKAGE="ocsreports"
4 VERSION="1.3.3"
5 CATEGORY="network"
6 SHORT_DESC="Inventory and package deployement system"
7 MAINTAINER="pascal.bellard@slitaz.org"
8 DEPENDS="php-apache php-mysql mysql"
9 WANTED="ocsinventory"
10 SOURCE="OCSNG_UNIX_SERVER"
11 TARBALL="${SOURCE}_${VERSION}.tar.gz"
12 WEB_SITE="http://www.ocsinventory-ng.org/"
13 TAGS="system administration"
15 # Rules to gen a SliTaz package suitable for Tazpkg.
16 genpkg_rules()
17 {
18 mkdir -p $fs/usr/share \
19 $fs/etc/ocsreports
21 cp -a $src/${PACKAGE} $fs/usr/share/
22 cat > $fs/etc/ocsreports/dbconfig.inc.php <<EOT
23 <?php
24 \$_SESSION["SERVEUR_SQL"]="localhost";
25 \$_SESSION["COMPTE_BASE"]="ocs";
26 \$_SESSION["PSWD_BASE"]="ocs";
27 ?>
28 EOT
30 install -o root -g www -m 0755 $src/binutils/*.pl \
31 $fs/usr/share/ocsreports/
33 rm -f $fs/usr/share/${PACKAGE}/dbconfig.inc.php
34 cd $fs/usr/share/${PACKAGE} ; ln -s /etc/ocsreports/dbconfig.inc.php ; cd -
36 # Remove doc file.
37 rm -f $fs/usr/share/ocsreports/files/*.pdf
38 }
40 post_install()
41 {
42 # Configure apache server
43 if [ -f $1/etc/apache/httpd.conf ]; then
44 if [ ! -f $1/etc/apache/conf.d/$PACKAGE ]; then
45 cat > $1/etc/apache/conf.d/$PACKAGE <<EOT
46 <IfModule mod_alias.c>
47 Alias /$PACKAGE /usr/share/$PACKAGE/
48 </IfModule>
49 <Directory "/usr/share/$PACKAGE">
50 Options Indexes FollowSymLinks
51 AllowOverride None
52 Order deny,allow
53 Allow from all
54 </Directory>
56 EOT
57 if [ -z "$1" ]; then
58 # Start Web server.
59 test -f /var/run/apache/httpd.pid && \
60 ( kill -0 $(cat /var/run/apache/httpd.pid) && /etc/init.d/apache restart )
61 fi
62 fi
63 fi
65 # Configure every thing for ocsweb.
66 if [ -z $1 ]; then
67 if ( ! mysqladmin -s ping > /dev/null ); then
68 echo "Starting MySQL server"
69 ( /etc/init.d/mysql start ; status ) || exit
70 sleep 4 #let the mysql daemon start
71 fi
72 if ( ! mysql -Be 'show databases' | grep -q ocsweb ); then
73 echo -n "Create $PACKAGE database and schema"
74 # mysql -Be "create database ocsweb" ; status
75 mysql -f -s -u root < /usr/share/$PACKAGE/files/ocsbase.sql > /dev/null 2>&1
76 # We suppose that ocs user does not exist.
77 # It may be false.
78 echo -n "Create user ocs with password ocs"
79 mysql -Be "grant all privileges on ocsweb.* to 'ocs'@'localhost'
80 identified by 'ocs'" ; status
81 fi
83 fi
84 }
86 post_remove()
87 {
89 if [ -z $1 ]; then
90 echo -n "Would you like to remove data and database files.(y/n) "
91 read answer
93 case $answer in
94 y|Y)
95 echo -n "Removing data directories..."
96 rm -rf /usr/share/ocsreports
97 if ( mysql -Be 'show databases' | grep -q ocsweb ); then
98 echo -n "Deleting ocsreports database;"
99 mysql -u root -Be "drop database ocsweb;" ; status
100 echo -n "Delete user ocs"
101 mysql -u root -Be "delete from mysql.db where user=ocs;" ; status
102 fi
103 unset $answer
104 ;;
105 *)
106 ;;
107 esac
108 fi
110 }