wok-6.x view ocsreports/receipt @ rev 20018

Add pixiewps
author Pascal Bellard <pascal.bellard@slitaz.org>
date Fri Aug 11 18:07:57 2017 +0200 (2017-08-11)
parents 1067bb7f1e24
children 970c5ec9a60a
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 true
88 }
90 post_remove()
91 {
93 if [ -z "$1" ]; then
94 echo -n "Would you like to remove data and database files.(y/n) "
95 read answer
97 case $answer in
98 y|Y)
99 echo -n "Removing data directories..."
100 rm -rf /usr/share/ocsreports
101 if ( mysql -Be 'show databases' | grep -q ocsweb ); then
102 echo -n "Deleting ocsreports database;"
103 mysql -u root -Be "drop database ocsweb;" ; status
104 echo -n "Delete user ocs"
105 mysql -u root -Be "delete from mysql.db where user=ocs;" ; status
106 fi
107 unset $answer
108 ;;
109 *)
110 ;;
111 esac
112 fi
114 }