SliTaz Packages

Community Doc Forum Pro Shop Bugs Hg
.

Receipt for package "dolibarr"

# SliTaz package receipt.

PACKAGE="dolibarr"
VERSION="3.1.0"
CATEGORY="office"
SHORT_DESC="ERP/CRM"
MAINTAINER="erjo@slitaz.org"
WEB_SITE="http://www.dolibarr.fr/"
TARBALL="$PACKAGE-$VERSION.tgz"
WGET_URL="$SF_MIRROR/$PACKAGE/$TARBALL"

DEPENDS="apache php-apache php-gd php-mysqli"
BUILD_DEPENDS=""

# Rules to configure and make the package.
compile_rules()
{
    cd $src
    
    # Fix attributs and perms
    chown -R root.root *
    chmod -x C* I* R* 
    find . \( -name "*.php" \
        -o -name "*.png" \
        -o -name "*.jpg" \
        -o -name "*.gif" \
        -o -name "*.txt" \
        -o -name "*.ico" \
        -o -name "*.html" \) -exec chmod -x {} \;
}

# Rules to gen a SliTaz package suitable for Tazpkg.
genpkg_rules()
{
    
    mkdir -p $fs/etc/dolibarr \
        $fs/usr/share/dolibarr \
        $fs/var/lib/dolibarr/documents \
        $fs/usr/share/doc/$PACKAGE/schemas \
        $fs/usr/share/applications 
        
    
    cp -a $src/htdocs $fs/usr/share/dolibarr
    cp -a $src/scripts $fs/usr/share/dolibarr
    
    # Remove install directory
    #rm -rf $fs/usr/share/dolibarr/htdocs/install
    
    # Populate documents directory
    for dir in facture users propale mycompany ficheinter produit rapport
    do
        mkdir $fs/var/lib/dolibarr/documents/$dir
    done
    
    # Fix perms
    chown -R root.www $fs/var/lib/dolibarr/documents
    chmod -R 770 $fs/var/lib/dolibarr/documents
    
    cp $stuff/conf.php $fs/etc/dolibarr
    cp $stuff/$PACKAGE-$VERSION-mysql.sql $fs/usr/share/doc/$PACKAGE/schemas
    cp -a $stuff/pixmaps $fs/usr/share/
    
    ln -s /etc/dolibarr/conf.php $fs/usr/share/dolibarr/htdocs/conf

}

post_install(){
    
    db_name=dolibarr
    db_user=dolibarr
    db_password=dolibarr
    
    # Configure apache server
    if [ -f $1/etc/apache/httpd.conf ]; then
        if [ ! -f $1/etc/apache/conf.d/dolibarr.conf ]; then
            cat > $1/etc/apache/conf.d/dolibarr.conf <<EOT
<IfModule mod_alias.c>
    Alias /dolibarr /usr/share/dolibarr/htdocs
</IfModule>
<Directory "/usr/share/dolibarr/htdocs">
    Options Indexes FollowSymLinks
    AllowOverride None
    Order deny,allow
    Allow from all
</Directory>

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.
    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 -u root -Be 'show databases' | grep -q $db_name ); then
            echo -n "Create $db_name database"
            mysql -Be "create database $db_name" ; status
            # We suppose that databse user does not exist.
            # It may be false.
            echo  -n "Create user $db_user with password $db_password"
            mysql -Be "grant all privileges on ${db_name}.* to '$db_user'@'localhost' 
                identified by '$db_password'" ; status
            # At last populate the database.
            echo -n "Create $db_name database schema."
            mysql -u $db_user -p${db_password} -D $db_name < /usr/share/doc/dolibarr/schemas/$PACKAGE-$VERSION-mysql.sql ; status
            
        fi
            
    fi
}
3382 packages and 430813 files in stable database (Mon Mar 4 17:53:49 2019)