wok annotate ocsreports/receipt @ rev 23592

created recipe for python-pbr
author Hans-G?nter Theisgen
date Wed Apr 08 11:05:31 2020 +0100 (2020-04-08)
parents 9e01bc6321ea
children cea6e929d21e
rev   line source
erjo@3676 1 # SliTaz package receipt.
erjo@3676 2
erjo@3676 3 PACKAGE="ocsreports"
erjo@12234 4 VERSION="2.0.4"
erjo@3676 5 CATEGORY="network"
erjo@3676 6 SHORT_DESC="Inventory and package deployement system"
erjo@3676 7 MAINTAINER="pascal.bellard@slitaz.org"
pascal@15590 8 LICENSE="GPL2"
erjo@3676 9 WANTED="ocsinventory"
erjo@3676 10 SOURCE="OCSNG_UNIX_SERVER"
erjo@3676 11 WEB_SITE="http://www.ocsinventory-ng.org/"
jozee@4970 12 TAGS="system administration"
erjo@3676 13
pascal@15590 14 DEPENDS="php-apache php-mysql mysql"
pascal@15590 15
erjo@3676 16 # Rules to gen a SliTaz package suitable for Tazpkg.
erjo@3676 17 genpkg_rules()
erjo@3676 18 {
erjo@3676 19 mkdir -p $fs/usr/share \
erjo@3676 20 $fs/etc/ocsreports
erjo@3676 21
slaxemulator@8752 22 cp -a $src/${PACKAGE} $fs/usr/share/
erjo@3676 23 cat > $fs/etc/ocsreports/dbconfig.inc.php <<EOT
erjo@3676 24 <?php
erjo@12277 25 define("DB_NAME", "ocsweb");
erjo@12277 26 define("SERVER_READ","localhost");
erjo@12277 27 define("SERVER_WRITE","localhost");
erjo@12277 28 define("COMPTE_BASE","ocs");
erjo@12277 29 define("PSWD_BASE","ocs");
erjo@3676 30 ?>
erjo@3676 31 EOT
erjo@3676 32
erjo@8384 33 install -o root -g www -m 0755 $src/binutils/*.pl \
erjo@8384 34 $fs/usr/share/ocsreports/
erjo@8384 35
erjo@3676 36 rm -f $fs/usr/share/${PACKAGE}/dbconfig.inc.php
erjo@3676 37 cd $fs/usr/share/${PACKAGE} ; ln -s /etc/ocsreports/dbconfig.inc.php ; cd -
erjo@3676 38
erjo@3676 39 # Remove doc file.
erjo@3676 40 rm -f $fs/usr/share/ocsreports/files/*.pdf
erjo@3676 41 }
erjo@3676 42
erjo@3676 43 post_install()
erjo@3676 44 {
erjo@3676 45 # Configure apache server
pascal@18730 46 if [ -f "$1/etc/apache/httpd.conf" ]; then
pascal@18730 47 if [ ! -f "$1/etc/apache/conf.d/$PACKAGE" ]; then
pascal@18730 48 cat > "$1/etc/apache/conf.d/$PACKAGE" <<EOT
erjo@3676 49 <IfModule mod_alias.c>
erjo@3676 50 Alias /$PACKAGE /usr/share/$PACKAGE/
erjo@3676 51 </IfModule>
erjo@3676 52 <Directory "/usr/share/$PACKAGE">
erjo@3676 53 Options Indexes FollowSymLinks
erjo@3676 54 AllowOverride None
erjo@3676 55 Order deny,allow
erjo@3676 56 Allow from all
erjo@3676 57 </Directory>
erjo@3676 58
erjo@3676 59 EOT
erjo@3676 60 if [ -z "$1" ]; then
erjo@3676 61 # Start Web server.
erjo@3676 62 test -f /var/run/apache/httpd.pid && \
erjo@3676 63 ( kill -0 $(cat /var/run/apache/httpd.pid) && /etc/init.d/apache restart )
erjo@3676 64 fi
erjo@3676 65 fi
erjo@3676 66 fi
erjo@3676 67
erjo@3676 68 # Configure every thing for ocsweb.
pascal@18730 69 if [ -z "$1" ]; then
erjo@3676 70 if ( ! mysqladmin -s ping > /dev/null ); then
pascal@20319 71 echo
erjo@3676 72 echo "Starting MySQL server"
erjo@3676 73 ( /etc/init.d/mysql start ; status ) || exit
erjo@3676 74 sleep 4 #let the mysql daemon start
erjo@3676 75 fi
erjo@3676 76 if ( ! mysql -Be 'show databases' | grep -q ocsweb ); then
pascal@20319 77 echo
erjo@3676 78 echo -n "Create $PACKAGE database and schema"
erjo@12277 79 mysql -Be "create database ocsweb CHARACTER SET utf8 COLLATE utf8_bin" ; status
erjo@12277 80 mysql -s -u root ocsweb < /usr/share/$PACKAGE/files/ocsbase_new.sql > /dev/null 2>&1
erjo@3676 81 # We suppose that ocs user does not exist.
erjo@3676 82 # It may be false.
erjo@3676 83 echo -n "Create user ocs with password ocs"
erjo@3676 84 mysql -Be "grant all privileges on ocsweb.* to 'ocs'@'localhost'
erjo@3676 85 identified by 'ocs'" ; status
erjo@3676 86 fi
erjo@3676 87
erjo@3676 88 fi
pascal@18707 89 true
erjo@3676 90 }
erjo@3676 91
erjo@3676 92 post_remove()
erjo@3676 93 {
slaxemulator@8752 94
pascal@18730 95 if [ -z "$1" ]; then
erjo@3676 96 echo -n "Would you like to remove data and database files.(y/n) "
erjo@3676 97 read answer
erjo@3676 98
erjo@3676 99 case $answer in
erjo@3676 100 y|Y)
erjo@3676 101 echo -n "Removing data directories..."
erjo@3676 102 rm -rf /usr/share/ocsreports
erjo@3676 103 if ( mysql -Be 'show databases' | grep -q ocsweb ); then
erjo@3676 104 echo -n "Deleting ocsreports database;"
erjo@3676 105 mysql -u root -Be "drop database ocsweb;" ; status
erjo@3676 106 echo -n "Delete user ocs"
erjo@3676 107 mysql -u root -Be "delete from mysql.db where user=ocs;" ; status
erjo@3676 108 fi
erjo@3676 109 unset $answer
erjo@3676 110 ;;
erjo@3676 111 *)
erjo@3676 112 ;;
erjo@3676 113 esac
slaxemulator@8752 114 fi
erjo@3676 115
erjo@3676 116 }
erjo@3676 117