wok-current view ocsreports/receipt @ rev 3862

added ipv6 support in xchat-plugin
author Richard Sellam <lenios@slitaz.org>
date Fri Aug 07 22:32:34 2009 +0200 (2009-08-07)
parents
children 6ec17b55b59a
line source
1 # SliTaz package receipt.
3 PACKAGE="ocsreports"
4 VERSION="1.02.1"
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/"
14 # Rules to gen a SliTaz package suitable for Tazpkg.
15 genpkg_rules()
16 {
17 src=$WOK/$WANTED/$SOURCE-$VERSION
19 mkdir -p $fs/usr/share \
20 $fs/etc/ocsreports
22 cp -a $WOK/$WANTED/${SOURCE}-${VERSION}/${PACKAGE} $fs/usr/share/
23 cat > $fs/etc/ocsreports/dbconfig.inc.php <<EOT
24 <?php
25 \$_SESSION["SERVEUR_SQL"]="localhost";
26 \$_SESSION["COMPTE_BASE"]="ocs";
27 \$_SESSION["PSWD_BASE"]="ocs";
28 ?>
29 EOT
31 install -o root -g www -m 0755 $src/Apache/binutils/ipdiscover-util.pl \
32 $fs/usr/share/ocsreports/ipdiscover-util.pl
34 rm -f $fs/usr/share/${PACKAGE}/dbconfig.inc.php
35 cd $fs/usr/share/${PACKAGE} ; ln -s /etc/ocsreports/dbconfig.inc.php ; cd -
37 # Remove doc file.
38 rm -f $fs/usr/share/ocsreports/files/*.pdf
39 }
41 post_install()
42 {
43 # Configure apache server
44 if [ -f $1/etc/apache/httpd.conf ]; then
45 if [ ! -f $1/etc/apache/conf.d/$PACKAGE ]; then
46 cat > $1/etc/apache/conf.d/$PACKAGE <<EOT
47 <IfModule mod_alias.c>
48 Alias /$PACKAGE /usr/share/$PACKAGE/
49 </IfModule>
50 <Directory "/usr/share/$PACKAGE">
51 Options Indexes FollowSymLinks
52 AllowOverride None
53 Order deny,allow
54 Allow from all
55 </Directory>
57 EOT
58 if [ -z "$1" ]; then
59 # Start Web server.
60 test -f /var/run/apache/httpd.pid && \
61 ( kill -0 $(cat /var/run/apache/httpd.pid) && /etc/init.d/apache restart )
62 fi
63 fi
64 fi
66 # Configure every thing for ocsweb.
67 if [ -z $1 ]; then
68 if ( ! mysqladmin -s ping > /dev/null ); then
69 echo "Starting MySQL server"
70 ( /etc/init.d/mysql start ; status ) || exit
71 sleep 4 #let the mysql daemon start
72 fi
73 if ( ! mysql -Be 'show databases' | grep -q ocsweb ); then
74 echo -n "Create $PACKAGE database and schema"
75 # mysql -Be "create database ocsweb" ; status
76 mysql -f -s -u root < /usr/share/$PACKAGE/files/ocsbase.sql > /dev/null 2>&1
77 # We suppose that ocs user does not exist.
78 # It may be false.
79 echo -n "Create user ocs with password ocs"
80 mysql -Be "grant all privileges on ocsweb.* to 'ocs'@'localhost'
81 identified by 'ocs'" ; status
82 fi
84 fi
85 }
87 post_remove()
88 {
89 echo -n "Would you like to remove data and database files.(y/n) "
90 read answer
92 case $answer in
93 y|Y)
94 echo -n "Removing data directories..."
95 rm -rf /usr/share/ocsreports
96 if ( mysql -Be 'show databases' | grep -q ocsweb ); then
97 echo -n "Deleting ocsreports database;"
98 mysql -u root -Be "drop database ocsweb;" ; status
99 echo -n "Delete user ocs"
100 mysql -u root -Be "delete from mysql.db where user=ocs;" ; status
101 fi
102 unset $answer
103 ;;
104 *)
105 ;;
106 esac
108 }