wok-current annotate dolibarr/receipt @ rev 24569

sokojs: add shrink.sh (again)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat Feb 26 18:46:53 2022 +0000 (2022-02-26)
parents c6a87148ec80
children
rev   line source
erjo@11794 1 # SliTaz package receipt.
erjo@11794 2
erjo@11794 3 PACKAGE="dolibarr"
Hans-G?nter@24494 4 VERSION="14.0.5"
erjo@11794 5 CATEGORY="office"
Hans-G?nter@24494 6 SHORT_DESC="ERP and CRM for small and medium companies."
erjo@11794 7 MAINTAINER="erjo@slitaz.org"
Hans-G?nter@20842 8 LICENSE="GPLv3"
Hans-G?nter@24494 9 WEB_SITE="https://www.dolibarr.org/"
Hans-G?nter@20842 10
erjo@11794 11 TARBALL="$PACKAGE-$VERSION.tgz"
Hans-G?nter@24494 12 WGET_URL="$SF_MIRROR/$PACKAGE/$TARBALL"
erjo@11794 13
Hans-G?nter@24494 14 DEPENDS="apache mysql php-apache php-gd php-mysqli"
erjo@11794 15 BUILD_DEPENDS=""
erjo@11794 16
pascal@24361 17 # What is the latest version available today?
pascal@24361 18 current_version()
pascal@24361 19 {
pascal@24361 20 wget -O - https://sourceforge.net/projects/dolibarr/files/Dolibarr%20ERP-CRM/ 2>/dev/null | \
pascal@24361 21 sed '/scope="row/!d;s|.*href="|"https://sourceforge.net|;q' | xargs wget -O - 2>/dev/null | \
pascal@24361 22 sed '/scope="row/!d;/tgz/!d;s|.*/dolibarr-||;s|.tgz.*||;q'
pascal@24361 23 }
pascal@24361 24
erjo@11794 25 # Rules to configure and make the package.
erjo@11794 26 compile_rules()
erjo@11794 27 {
Hans-G?nter@22737 28 # Fix attributes and permissions
erjo@11794 29 chown -R root.root *
Hans-G?nter@24495 30 chmod -x C* R*
erjo@11794 31 find . \( -name "*.php" \
erjo@11794 32 -o -name "*.png" \
erjo@11794 33 -o -name "*.jpg" \
erjo@11794 34 -o -name "*.gif" \
erjo@11794 35 -o -name "*.txt" \
erjo@11794 36 -o -name "*.ico" \
erjo@11794 37 -o -name "*.html" \) -exec chmod -x {} \;
erjo@11794 38 }
erjo@11794 39
erjo@11794 40 # Rules to gen a SliTaz package suitable for Tazpkg.
erjo@11794 41 genpkg_rules()
erjo@11794 42 {
Hans-G?nter@22737 43 mkdir -p $fs/etc/dolibarr
Hans-G?nter@22737 44 mkdir -p $fs/usr/share/dolibarr
Hans-G?nter@22737 45 mkdir -p $fs/var/lib/dolibarr/documents
Hans-G?nter@22737 46 mkdir -p $fs/usr/share/doc/$PACKAGE/schemas
Hans-G?nter@22737 47 mkdir -p $fs/usr/share/applications
Hans-G?nter@22737 48
Hans-G?nter@22737 49 cp -a $src/htdocs $fs/usr/share/dolibarr
Hans-G?nter@22737 50 cp -a $src/scripts $fs/usr/share/dolibarr
Hans-G?nter@22737 51
erjo@11794 52 # Remove install directory
erjo@11827 53 #rm -rf $fs/usr/share/dolibarr/htdocs/install
Hans-G?nter@22737 54
erjo@11794 55 # Populate documents directory
erjo@11794 56 for dir in facture users propale mycompany ficheinter produit rapport
Hans-G?nter@22737 57 do
erjo@11794 58 mkdir $fs/var/lib/dolibarr/documents/$dir
Hans-G?nter@22737 59 done
Hans-G?nter@22737 60
Hans-G?nter@22737 61 # Fix permissions
Hans-G?nter@22737 62 chown -R root.www $fs/var/lib/dolibarr/documents
Hans-G?nter@22737 63 chmod -R 770 $fs/var/lib/dolibarr/documents
Hans-G?nter@22737 64
Hans-G?nter@22737 65 cp $stuff/conf.php $fs/etc/dolibarr
Hans-G?nter@22737 66 cp $stuff/$PACKAGE-$VERSION-mysql.sql \
Hans-G?nter@22737 67 $fs/usr/share/doc/$PACKAGE/schemas
Hans-G?nter@22737 68 cp -a $stuff/pixmaps $fs/usr/share/
Hans-G?nter@22737 69
erjo@11794 70 ln -s /etc/dolibarr/conf.php $fs/usr/share/dolibarr/htdocs/conf
erjo@11794 71 }
erjo@11794 72
Hans-G?nter@24494 73 post_install()
Hans-G?nter@24494 74 {
erjo@11794 75 db_name=dolibarr
erjo@11794 76 db_user=dolibarr
erjo@11794 77 db_password=dolibarr
Hans-G?nter@24494 78
erjo@11794 79 # Configure apache server
Hans-G?nter@22737 80 if [ -f "$1/etc/apache/httpd.conf" ]
Hans-G?nter@22737 81 then
Hans-G?nter@22737 82 if [ ! -f "$1/etc/apache/conf.d/dolibarr.conf" ]
Hans-G?nter@22737 83 then
pascal@18730 84 cat > "$1/etc/apache/conf.d/dolibarr.conf" <<EOT
erjo@11794 85 <IfModule mod_alias.c>
erjo@11794 86 Alias /dolibarr /usr/share/dolibarr/htdocs
erjo@11794 87 </IfModule>
erjo@11794 88 <Directory "/usr/share/dolibarr/htdocs">
erjo@11794 89 Options Indexes FollowSymLinks
erjo@11794 90 AllowOverride None
erjo@11794 91 Order deny,allow
erjo@11794 92 Allow from all
erjo@11794 93 </Directory>
erjo@11794 94
erjo@11794 95 EOT
Hans-G?nter@22737 96 if [ -z "$1" ]
Hans-G?nter@22737 97 then
erjo@11794 98 # Start Web server.
Hans-G?nter@22737 99 test -f /var/run/apache/httpd.pid &&
Hans-G?nter@22737 100 ( kill -0 $(cat /var/run/apache/httpd.pid) && /etc/init.d/apache restart )
erjo@11794 101 fi
erjo@11794 102 fi
erjo@11794 103 fi
erjo@11794 104
Hans-G?nter@22737 105 # Configure everything.
Hans-G?nter@22737 106 if [ -z "$1" ]
Hans-G?nter@22737 107 then
Hans-G?nter@22737 108 if ( ! mysqladmin -s ping > /dev/null )
Hans-G?nter@22737 109 then
erjo@11794 110 echo "Starting MySQL server"
erjo@11794 111 ( /etc/init.d/mysql start ; status ) || exit
erjo@11794 112 sleep 4 #let the mysql daemon start
erjo@11794 113 fi
Hans-G?nter@22737 114 if ( ! mysql -u root -Be 'show databases' | grep -q $db_name )
Hans-G?nter@22737 115 then
erjo@11794 116 echo -n "Create $db_name database"
Hans-G?nter@22737 117 mysql -Be "create database $db_name"
Hans-G?nter@22737 118 status
Hans-G?nter@22737 119
erjo@11794 120 # We suppose that databse user does not exist.
erjo@11794 121 # It may be false.
erjo@11794 122 echo -n "Create user $db_user with password $db_password"
erjo@11794 123 mysql -Be "grant all privileges on ${db_name}.* to '$db_user'@'localhost'
Hans-G?nter@22737 124 identified by '$db_password'"
Hans-G?nter@22737 125 status
Hans-G?nter@22737 126
erjo@11794 127 # At last populate the database.
erjo@11794 128 echo -n "Create $db_name database schema."
Hans-G?nter@22737 129 mysql -u $db_user -p${db_password} -D $db_name < /usr/share/doc/dolibarr/schemas/$PACKAGE-$VERSION-mysql.sql
Hans-G?nter@22737 130 status
erjo@11794 131 fi
erjo@11794 132 fi
erjo@11794 133 }