wok-current view ocsreports/receipt @ rev 8339

Fix: screen need -j1 to install
author Antoine Bodin <gokhlayeh@slitaz.org>
date Wed Feb 02 05:18:27 2011 +0100 (2011-02-02)
parents 6cf13fdfcede
children 93d0091756cf
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/"
13 TAGS="system administration"
15 # Rules to gen a SliTaz package suitable for Tazpkg.
16 genpkg_rules()
17 {
18 src=$WOK/$WANTED/$SOURCE-$VERSION
20 mkdir -p $fs/usr/share \
21 $fs/etc/ocsreports
23 cp -a $WOK/$WANTED/${SOURCE}-${VERSION}/${PACKAGE} $fs/usr/share/
24 cat > $fs/etc/ocsreports/dbconfig.inc.php <<EOT
25 <?php
26 \$_SESSION["SERVEUR_SQL"]="localhost";
27 \$_SESSION["COMPTE_BASE"]="ocs";
28 \$_SESSION["PSWD_BASE"]="ocs";
29 ?>
30 EOT
32 install -o root -g www -m 0755 $src/Apache/binutils/ipdiscover-util.pl \
33 $fs/usr/share/ocsreports/ipdiscover-util.pl
35 rm -f $fs/usr/share/${PACKAGE}/dbconfig.inc.php
36 cd $fs/usr/share/${PACKAGE} ; ln -s /etc/ocsreports/dbconfig.inc.php ; cd -
38 # Remove doc file.
39 rm -f $fs/usr/share/ocsreports/files/*.pdf
40 }
42 post_install()
43 {
44 # Configure apache server
45 if [ -f $1/etc/apache/httpd.conf ]; then
46 if [ ! -f $1/etc/apache/conf.d/$PACKAGE ]; then
47 cat > $1/etc/apache/conf.d/$PACKAGE <<EOT
48 <IfModule mod_alias.c>
49 Alias /$PACKAGE /usr/share/$PACKAGE/
50 </IfModule>
51 <Directory "/usr/share/$PACKAGE">
52 Options Indexes FollowSymLinks
53 AllowOverride None
54 Order deny,allow
55 Allow from all
56 </Directory>
58 EOT
59 if [ -z "$1" ]; then
60 # Start Web server.
61 test -f /var/run/apache/httpd.pid && \
62 ( kill -0 $(cat /var/run/apache/httpd.pid) && /etc/init.d/apache restart )
63 fi
64 fi
65 fi
67 # Configure every thing for ocsweb.
68 if [ -z $1 ]; then
69 if ( ! mysqladmin -s ping > /dev/null ); then
70 echo "Starting MySQL server"
71 ( /etc/init.d/mysql start ; status ) || exit
72 sleep 4 #let the mysql daemon start
73 fi
74 if ( ! mysql -Be 'show databases' | grep -q ocsweb ); then
75 echo -n "Create $PACKAGE database and schema"
76 # mysql -Be "create database ocsweb" ; status
77 mysql -f -s -u root < /usr/share/$PACKAGE/files/ocsbase.sql > /dev/null 2>&1
78 # We suppose that ocs user does not exist.
79 # It may be false.
80 echo -n "Create user ocs with password ocs"
81 mysql -Be "grant all privileges on ocsweb.* to 'ocs'@'localhost'
82 identified by 'ocs'" ; status
83 fi
85 fi
86 }
88 post_remove()
89 {
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
109 }