wok-current view ocsreports/receipt @ rev 13793

assaultcube: update bdeps
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat Jan 05 13:16:33 2013 +0100 (2013-01-05)
parents 52fe6a429a51
children 600aaedb561d
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 define("DB_NAME", "ocsweb");
24 define("SERVER_READ","localhost");
25 define("SERVER_WRITE","localhost");
26 define("COMPTE_BASE","ocs");
27 define("PSWD_BASE","ocs");
28 ?>
29 EOT
31 install -o root -g www -m 0755 $src/binutils/*.pl \
32 $fs/usr/share/ocsreports/
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 CHARACTER SET utf8 COLLATE utf8_bin" ; status
76 mysql -s -u root ocsweb < /usr/share/$PACKAGE/files/ocsbase_new.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 {
90 if [ -z $1 ]; then
91 echo -n "Would you like to remove data and database files.(y/n) "
92 read answer
94 case $answer in
95 y|Y)
96 echo -n "Removing data directories..."
97 rm -rf /usr/share/ocsreports
98 if ( mysql -Be 'show databases' | grep -q ocsweb ); then
99 echo -n "Deleting ocsreports database;"
100 mysql -u root -Be "drop database ocsweb;" ; status
101 echo -n "Delete user ocs"
102 mysql -u root -Be "delete from mysql.db where user=ocs;" ; status
103 fi
104 unset $answer
105 ;;
106 *)
107 ;;
108 esac
109 fi
111 }