# SliTaz package receipt. PACKAGE="ocsreports" VERSION="2.0.4" CATEGORY="network" SHORT_DESC="Inventory and package deployement system" MAINTAINER="pascal.bellard@slitaz.org" DEPENDS="php-apache php-mysql mysql" WANTED="ocsinventory" SOURCE="OCSNG_UNIX_SERVER" WEB_SITE="http://www.ocsinventory-ng.org/" TAGS="system administration" # Rules to gen a SliTaz package suitable for Tazpkg. genpkg_rules() { mkdir -p $fs/usr/share \ $fs/etc/ocsreports cp -a $src/${PACKAGE} $fs/usr/share/ cat > $fs/etc/ocsreports/dbconfig.inc.php < EOT install -o root -g www -m 0755 $src/binutils/*.pl \ $fs/usr/share/ocsreports/ rm -f $fs/usr/share/${PACKAGE}/dbconfig.inc.php cd $fs/usr/share/${PACKAGE} ; ln -s /etc/ocsreports/dbconfig.inc.php ; cd - # Remove doc file. rm -f $fs/usr/share/ocsreports/files/*.pdf } post_install() { # Configure apache server if [ -f $1/etc/apache/httpd.conf ]; then if [ ! -f $1/etc/apache/conf.d/$PACKAGE ]; then cat > $1/etc/apache/conf.d/$PACKAGE < Alias /$PACKAGE /usr/share/$PACKAGE/ Options Indexes FollowSymLinks AllowOverride None Order deny,allow Allow from all EOT if [ -z "$1" ]; then # Start Web server. test -f /var/run/apache/httpd.pid && \ ( kill -0 $(cat /var/run/apache/httpd.pid) && /etc/init.d/apache restart ) fi fi fi # Configure every thing for ocsweb. if [ -z $1 ]; then if ( ! mysqladmin -s ping > /dev/null ); then echo "Starting MySQL server" ( /etc/init.d/mysql start ; status ) || exit sleep 4 #let the mysql daemon start fi if ( ! mysql -Be 'show databases' | grep -q ocsweb ); then echo -n "Create $PACKAGE database and schema" mysql -Be "create database ocsweb CHARACTER SET utf8 COLLATE utf8_bin" ; status mysql -s -u root ocsweb < /usr/share/$PACKAGE/files/ocsbase_new.sql > /dev/null 2>&1 # We suppose that ocs user does not exist. # It may be false. echo -n "Create user ocs with password ocs" mysql -Be "grant all privileges on ocsweb.* to 'ocs'@'localhost' identified by 'ocs'" ; status fi fi } post_remove() { if [ -z $1 ]; then echo -n "Would you like to remove data and database files.(y/n) " read answer case $answer in y|Y) echo -n "Removing data directories..." rm -rf /usr/share/ocsreports if ( mysql -Be 'show databases' | grep -q ocsweb ); then echo -n "Deleting ocsreports database;" mysql -u root -Be "drop database ocsweb;" ; status echo -n "Delete user ocs" mysql -u root -Be "delete from mysql.db where user=ocs;" ; status fi unset $answer ;; *) ;; esac fi }