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