wok-next annotate dolibarr/receipt @ rev 21020

Cleaning is almost finished... I should proceed to upgrades.
author Aleksej Bobylev <al.bobylev@gmail.com>
date Fri Nov 02 14:15:08 2018 +0200 (2018-11-02)
parents a3c581bf52b8
children 0cbe4b1f2230
rev   line source
erjo@11794 1 # SliTaz package receipt.
erjo@11794 2
erjo@11794 3 PACKAGE="dolibarr"
erjo@11794 4 VERSION="3.1.0"
erjo@11794 5 CATEGORY="office"
erjo@11794 6 SHORT_DESC="ERP/CRM"
al@21020 7 MAINTAINER="devel@slitaz.org"
pascal@15004 8 LICENSE="LGPL2"
al@20906 9 WEB_SITE="https://www.dolibarr.fr/"
al@21020 10
erjo@11794 11 TARBALL="$PACKAGE-$VERSION.tgz"
erjo@11794 12 WGET_URL="$SF_MIRROR/$PACKAGE/$TARBALL"
erjo@11794 13
erjo@11794 14
al@21020 15 compile_rules() {
al@21020 16 # Fix attributes and perms
erjo@11794 17 chown -R root.root *
erjo@11794 18 chmod -x C* I* R*
erjo@11794 19 find . \( -name "*.php" \
erjo@11794 20 -o -name "*.png" \
erjo@11794 21 -o -name "*.jpg" \
erjo@11794 22 -o -name "*.gif" \
erjo@11794 23 -o -name "*.txt" \
erjo@11794 24 -o -name "*.ico" \
erjo@11794 25 -o -name "*.html" \) -exec chmod -x {} \;
erjo@11794 26 }
erjo@11794 27
al@21020 28 genpkg_rules() {
erjo@11794 29 mkdir -p $fs/etc/dolibarr \
erjo@11794 30 $fs/usr/share/dolibarr \
erjo@11794 31 $fs/var/lib/dolibarr/documents \
erjo@11794 32 $fs/usr/share/doc/$PACKAGE/schemas \
al@21020 33 $fs/usr/share/applications
al@21020 34
erjo@11794 35 cp -a $src/htdocs $fs/usr/share/dolibarr
erjo@11794 36 cp -a $src/scripts $fs/usr/share/dolibarr
al@21020 37
erjo@11794 38 # Remove install directory
erjo@11827 39 #rm -rf $fs/usr/share/dolibarr/htdocs/install
al@21020 40
erjo@11794 41 # Populate documents directory
al@21020 42 for dir in facture users propale mycompany ficheinter produit rapport; do
erjo@11794 43 mkdir $fs/var/lib/dolibarr/documents/$dir
erjo@11794 44 done
al@21020 45
erjo@11794 46 # Fix perms
erjo@11794 47 chown -R root.www $fs/var/lib/dolibarr/documents
erjo@11794 48 chmod -R 770 $fs/var/lib/dolibarr/documents
al@21020 49
erjo@11794 50 cp $stuff/conf.php $fs/etc/dolibarr
erjo@11794 51 cp $stuff/$PACKAGE-$VERSION-mysql.sql $fs/usr/share/doc/$PACKAGE/schemas
erjo@11794 52 cp -a $stuff/pixmaps $fs/usr/share/
al@21020 53
erjo@11794 54 ln -s /etc/dolibarr/conf.php $fs/usr/share/dolibarr/htdocs/conf
al@21020 55 DEPENDS="apache php-apache php-gd php-mysqli"
erjo@11794 56 }
erjo@11794 57
erjo@11794 58 post_install(){
al@21020 59
erjo@11794 60 db_name=dolibarr
erjo@11794 61 db_user=dolibarr
erjo@11794 62 db_password=dolibarr
al@21020 63
erjo@11794 64 # Configure apache server
pascal@18730 65 if [ -f "$1/etc/apache/httpd.conf" ]; then
pascal@18730 66 if [ ! -f "$1/etc/apache/conf.d/dolibarr.conf" ]; then
pascal@18730 67 cat > "$1/etc/apache/conf.d/dolibarr.conf" <<EOT
erjo@11794 68 <IfModule mod_alias.c>
erjo@11794 69 Alias /dolibarr /usr/share/dolibarr/htdocs
erjo@11794 70 </IfModule>
erjo@11794 71 <Directory "/usr/share/dolibarr/htdocs">
erjo@11794 72 Options Indexes FollowSymLinks
erjo@11794 73 AllowOverride None
erjo@11794 74 Order deny,allow
erjo@11794 75 Allow from all
erjo@11794 76 </Directory>
erjo@11794 77
erjo@11794 78 EOT
erjo@11794 79 if [ -z "$1" ]; then
erjo@11794 80 # Start Web server.
al@21020 81 test -f /var/run/apache/httpd.pid &&
erjo@11794 82 ( kill -0 $(cat /var/run/apache/httpd.pid) && /etc/init.d/apache restart )
erjo@11794 83 fi
erjo@11794 84 fi
erjo@11794 85 fi
al@21020 86
erjo@11794 87 # Configure every thing.
pascal@18730 88 if [ -z "$1" ]; then
erjo@11794 89 if ( ! mysqladmin -s ping > /dev/null ); then
erjo@11794 90 echo "Starting MySQL server"
al@21020 91 ( /etc/init.d/mysql start; status ) || exit
al@21020 92 sleep 4 # let the mysql daemon start
erjo@11794 93 fi
erjo@11794 94 if ( ! mysql -u root -Be 'show databases' | grep -q $db_name ); then
al@21020 95 action "Create $db_name database"
al@21020 96 mysql -Be "create database $db_name"
al@21020 97 status
al@21020 98
erjo@11794 99 # We suppose that databse user does not exist.
erjo@11794 100 # It may be false.
al@21020 101 action "Create user $db_user with password $db_password"
al@21020 102 mysql -Be "grant all privileges on ${db_name}.* to '$db_user'@'localhost'
al@21020 103 identified by '$db_password'"
al@21020 104 status
al@21020 105
erjo@11794 106 # At last populate the database.
al@21020 107 action "Create $db_name database schema."
al@21020 108 mysql -u $db_user -p${db_password} -D $db_name < /usr/share/doc/dolibarr/schemas/$PACKAGE-$VERSION-mysql.sql
al@21020 109 status
erjo@11794 110 fi
erjo@11794 111 fi
erjo@11794 112 }