wok-6.x view ocsreports/receipt @ rev 22953
updated inxi (3.0.32.1 -> 3.0.37)
author | Hans-G?nter Theisgen |
---|---|
date | Fri Feb 28 14:51:15 2020 +0100 (2020-02-28) |
parents | 9e01bc6321ea |
children | cea6e929d21e |
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
72 echo "Starting MySQL server"
73 ( /etc/init.d/mysql start ; status ) || exit
74 sleep 4 #let the mysql daemon start
75 fi
76 if ( ! mysql -Be 'show databases' | grep -q ocsweb ); then
77 echo
78 echo -n "Create $PACKAGE database and schema"
79 mysql -Be "create database ocsweb CHARACTER SET utf8 COLLATE utf8_bin" ; status
80 mysql -s -u root ocsweb < /usr/share/$PACKAGE/files/ocsbase_new.sql > /dev/null 2>&1
81 # We suppose that ocs user does not exist.
82 # It may be false.
83 echo -n "Create user ocs with password ocs"
84 mysql -Be "grant all privileges on ocsweb.* to 'ocs'@'localhost'
85 identified by 'ocs'" ; status
86 fi
88 fi
89 true
90 }
92 post_remove()
93 {
95 if [ -z "$1" ]; then
96 echo -n "Would you like to remove data and database files.(y/n) "
97 read answer
99 case $answer in
100 y|Y)
101 echo -n "Removing data directories..."
102 rm -rf /usr/share/ocsreports
103 if ( mysql -Be 'show databases' | grep -q ocsweb ); then
104 echo -n "Deleting ocsreports database;"
105 mysql -u root -Be "drop database ocsweb;" ; status
106 echo -n "Delete user ocs"
107 mysql -u root -Be "delete from mysql.db where user=ocs;" ; status
108 fi
109 unset $answer
110 ;;
111 *)
112 ;;
113 esac
114 fi
116 }