wok-6.x view ocsreports/receipt @ rev 16231
Up fpc (2.6.4)
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Tue Apr 01 09:10:23 2014 +0000 (2014-04-01) |
parents | bb9d2f1d18bd |
children | 1067bb7f1e24 |
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 LICENSE="GPL2"
9 WANTED="ocsinventory"
10 SOURCE="OCSNG_UNIX_SERVER"
11 WEB_SITE="http://www.ocsinventory-ng.org/"
12 TAGS="system administration"
14 DEPENDS="php-apache php-mysql mysql"
16 # Rules to gen a SliTaz package suitable for Tazpkg.
17 genpkg_rules()
18 {
19 mkdir -p $fs/usr/share \
20 $fs/etc/ocsreports
22 cp -a $src/${PACKAGE} $fs/usr/share/
23 cat > $fs/etc/ocsreports/dbconfig.inc.php <<EOT
24 <?php
25 define("DB_NAME", "ocsweb");
26 define("SERVER_READ","localhost");
27 define("SERVER_WRITE","localhost");
28 define("COMPTE_BASE","ocs");
29 define("PSWD_BASE","ocs");
30 ?>
31 EOT
33 install -o root -g www -m 0755 $src/binutils/*.pl \
34 $fs/usr/share/ocsreports/
36 rm -f $fs/usr/share/${PACKAGE}/dbconfig.inc.php
37 cd $fs/usr/share/${PACKAGE} ; ln -s /etc/ocsreports/dbconfig.inc.php ; cd -
39 # Remove doc file.
40 rm -f $fs/usr/share/ocsreports/files/*.pdf
41 }
43 post_install()
44 {
45 # Configure apache server
46 if [ -f $1/etc/apache/httpd.conf ]; then
47 if [ ! -f $1/etc/apache/conf.d/$PACKAGE ]; then
48 cat > $1/etc/apache/conf.d/$PACKAGE <<EOT
49 <IfModule mod_alias.c>
50 Alias /$PACKAGE /usr/share/$PACKAGE/
51 </IfModule>
52 <Directory "/usr/share/$PACKAGE">
53 Options Indexes FollowSymLinks
54 AllowOverride None
55 Order deny,allow
56 Allow from all
57 </Directory>
59 EOT
60 if [ -z "$1" ]; then
61 # Start Web server.
62 test -f /var/run/apache/httpd.pid && \
63 ( kill -0 $(cat /var/run/apache/httpd.pid) && /etc/init.d/apache restart )
64 fi
65 fi
66 fi
68 # Configure every thing for ocsweb.
69 if [ -z $1 ]; then
70 if ( ! mysqladmin -s ping > /dev/null ); then
71 echo "Starting MySQL server"
72 ( /etc/init.d/mysql start ; status ) || exit
73 sleep 4 #let the mysql daemon start
74 fi
75 if ( ! mysql -Be 'show databases' | grep -q ocsweb ); then
76 echo -n "Create $PACKAGE database and schema"
77 mysql -Be "create database ocsweb CHARACTER SET utf8 COLLATE utf8_bin" ; status
78 mysql -s -u root ocsweb < /usr/share/$PACKAGE/files/ocsbase_new.sql > /dev/null 2>&1
79 # We suppose that ocs user does not exist.
80 # It may be false.
81 echo -n "Create user ocs with password ocs"
82 mysql -Be "grant all privileges on ocsweb.* to 'ocs'@'localhost'
83 identified by 'ocs'" ; status
84 fi
86 fi
87 }
89 post_remove()
90 {
92 if [ -z $1 ]; then
93 echo -n "Would you like to remove data and database files.(y/n) "
94 read answer
96 case $answer in
97 y|Y)
98 echo -n "Removing data directories..."
99 rm -rf /usr/share/ocsreports
100 if ( mysql -Be 'show databases' | grep -q ocsweb ); then
101 echo -n "Deleting ocsreports database;"
102 mysql -u root -Be "drop database ocsweb;" ; status
103 echo -n "Delete user ocs"
104 mysql -u root -Be "delete from mysql.db where user=ocs;" ; status
105 fi
106 unset $answer
107 ;;
108 *)
109 ;;
110 esac
111 fi
113 }