wok-current view ocsreports/receipt @ rev 12234
Up:ocsreports (2.0.4)
author | Eric Joseph-Alexandre <erjo@slitaz.org> |
---|---|
date | Mon Apr 09 12:02:30 2012 +0200 (2012-04-09) |
parents | 129bb5b11a7e |
children | bb9d2f1d18bd |
line source
1 # SliTaz package receipt.
3 PACKAGE="ocsreports"
4 VERSION="2.0.4"
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 WEB_SITE="http://www.ocsinventory-ng.org/"
12 TAGS="system administration"
14 # Rules to gen a SliTaz package suitable for Tazpkg.
15 genpkg_rules()
16 {
17 mkdir -p $fs/usr/share \
18 $fs/etc/ocsreports
20 cp -a $src/${PACKAGE} $fs/usr/share/
21 cat > $fs/etc/ocsreports/dbconfig.inc.php <<EOT
22 <?php
23 \$_SESSION["SERVEUR_SQL"]="localhost";
24 \$_SESSION["COMPTE_BASE"]="ocs";
25 \$_SESSION["PSWD_BASE"]="ocs";
26 ?>
27 EOT
29 install -o root -g www -m 0755 $src/binutils/*.pl \
30 $fs/usr/share/ocsreports/
32 rm -f $fs/usr/share/${PACKAGE}/dbconfig.inc.php
33 cd $fs/usr/share/${PACKAGE} ; ln -s /etc/ocsreports/dbconfig.inc.php ; cd -
35 # Remove doc file.
36 rm -f $fs/usr/share/ocsreports/files/*.pdf
37 }
39 post_install()
40 {
41 # Configure apache server
42 if [ -f $1/etc/apache/httpd.conf ]; then
43 if [ ! -f $1/etc/apache/conf.d/$PACKAGE ]; then
44 cat > $1/etc/apache/conf.d/$PACKAGE <<EOT
45 <IfModule mod_alias.c>
46 Alias /$PACKAGE /usr/share/$PACKAGE/
47 </IfModule>
48 <Directory "/usr/share/$PACKAGE">
49 Options Indexes FollowSymLinks
50 AllowOverride None
51 Order deny,allow
52 Allow from all
53 </Directory>
55 EOT
56 if [ -z "$1" ]; then
57 # Start Web server.
58 test -f /var/run/apache/httpd.pid && \
59 ( kill -0 $(cat /var/run/apache/httpd.pid) && /etc/init.d/apache restart )
60 fi
61 fi
62 fi
64 # Configure every thing for ocsweb.
65 if [ -z $1 ]; then
66 if ( ! mysqladmin -s ping > /dev/null ); then
67 echo "Starting MySQL server"
68 ( /etc/init.d/mysql start ; status ) || exit
69 sleep 4 #let the mysql daemon start
70 fi
71 if ( ! mysql -Be 'show databases' | grep -q ocsweb ); then
72 echo -n "Create $PACKAGE database and schema"
73 # mysql -Be "create database ocsweb" ; status
74 mysql -f -s -u root < /usr/share/$PACKAGE/files/ocsbase.sql > /dev/null 2>&1
75 # We suppose that ocs user does not exist.
76 # It may be false.
77 echo -n "Create user ocs with password ocs"
78 mysql -Be "grant all privileges on ocsweb.* to 'ocs'@'localhost'
79 identified by 'ocs'" ; status
80 fi
82 fi
83 }
85 post_remove()
86 {
88 if [ -z $1 ]; then
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
107 fi
109 }