Skip to content
Snippets Groups Projects
Commit 32dfb934 authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Update package for debian

parent 65406e03
No related branches found
No related tags found
No related merge requests found
Alias /dolibarr /usr/share/dolibarr
Alias /dolibarr /usr/share/dolibarr/htdocs
<DirectoryMatch /usr/share/dolibarr/>
<DirectoryMatch /usr/share/dolibarr/htdocs>
Options +FollowSymLinks +Indexes
ErrorDocument 401 /public/error-401.html
ErrorDocument 401 /public/error-401.php
ErrorDocument 404 /public/error-404.php
<IfModule mod_php4.c>
php_flag magic_quotes_gpc Off
php_flag track_vars On
php_flag register_globals On
php_flag register_globals Off
</IfModule>
</DirectoryMatch>
<DirectoryMatch /usr/share/dolibarr/public/>
<DirectoryMatch /usr/share/dolibarr/htdocs/public/>
AllowOverride All
Order deny,allow
Allow from all
</DirectoryMatch>
<DirectoryMatch /usr/share/dolibarr/theme/>
AllowOverride All
Order deny,allow
Allow from all
</DirectoryMatch>
#<DirectoryMatch /usr/share/dolibarr/public/adherents/priv_*>
#<DirectoryMatch /usr/share/dolibarr/htdocs/public/adherents/priv_*>
# Options Indexes FollowSymLinks
# AllowOverride All
# Order deny,allow
......@@ -42,6 +36,4 @@ Alias /dolibarr /usr/share/dolibarr
#
# require valid-user
# satisfy any
#</DirectoryMatch>
#
#</DirectoryMatch>
\ No newline at end of file
#!/bin/sh
# Debian install package run: config, preinst, prerm, postinst, postrm
#
# dpkg -b is to build package
# dpkg -c package.deb list content of package
# dpkg -I package.deb give informations on package
# dpkg -i package.deb install a package
#
# dpkg -L packagename list content of installed package
# dpkg --purge remove interactive saved answers
#
set -e
. /usr/share/debconf/confmodule
db_version 2.0
echo Run the configuration script
# Rotate old configuration
if [ "$1" = "reconfigure" ] ; then
config="/etc/dolibarr/apache.conf"
for i in $(seq 8 -1 0) ; do
if [ -f ${config}.$i ]
then mv ${config}.$i ${config}.$(($i +1))
fi
done
mv ${config} ${config}.0
fi
db_capb backup
# Ask for web server type.
db_input critical "dolibarr/webserver" || true
db_title "dolibarr" || true
if db_go ; then
okcancel="1"
else
okcancel="0"
fi
# Ask on wich host the DBMS is installed.
#db_input critical "dolibarr/db/host" || true
# Get the database administrator name and password.
#db_beginblock
# db_input critical "dolibarr/db/admin/name" || true
# db_input critical "dolibarr/db/admin/password" || true
#db_endblock
# Ask for DB name.
#db_input critical "dolibarr/db/name" || true
# Get the DBMS account username
#db_input critical "dolibarr/db/user/name" || true
# Get the DBMS account password
#db_input critical "dolibarr/db/user/password" || true
# Ask for deleting all the database on package purge.
#db_input medium "dolibarr/postrm" || true
#onsuccess='finished="true"'
db_stop
exit 0
......@@ -7,9 +7,10 @@ Package: dolibarr
Section: web
Architecture: all
Essential: no
Depends: apache2, httpd, libapache2-mod-php5, libapache-mod-php5, php5, php5-cgi, libapache2-mod-php4, libapache-mod-php4, php4-cgi, php4, perl
Depends: wwwconfig-common, apache2, httpd, libapache2-mod-php5, php5, php5-cgi, php5-curl, php5-gd, php5-imagick, php5-ldap, php5-mcrypt, php5-mysql, perl
Recommends: mozilla | netscape
Installed-Size: 30000000
Homepage: http://www.dolibarr.org
Description: Company or foundation management software.
Dolibarr is a small and simple Web interface with ERP and CRM
capabilities. It is designed for small companies freelancers, or
......
File moved
#!/bin/sh -e
. /usr/share/debconf/confmodule
db_version 2.0
if [ "$1" = "reconfigure" ] ; then
# Rotate old configuration
config="/etc/dolibarr/apache.conf"
for i in $(seq 8 -1 0) ; do
if [ -f ${config}.$i ]
then mv ${config}.$i ${config}.$(($i +1))
fi
done
mv ${config} ${config}.0
fi
step=0
finished="false"
db_capb backup
while ! $finished ; do
skip="false"
forward=1
backward=1
password=""
confirm=""
case $step in
0) # Prompt user for notes.
db_beginblock
db_input low "dolibarr/configuration/note" || true
db_endblock
backward=0
;;
1) # Ask for web server type.
db_input medium "dolibarr/webserver" || true
;;
2) # Ask on wich host the DBMS is installed.
db_input critical "dolibarr/db/host" || true
# Skip previous step.
backward=1
;;
3) # Get the database administrator name and password.
db_beginblock
db_input critical "dolibarr/db/admin/name" || true
db_input critical "dolibarr/db/admin/password" || true
db_endblock
# Skip previous step.
backward=1
;;
4) # Ask for DB name.
db_input critical "dolibarr/db/name" || true
;;
5) # Get the DBMS account username
db_input critical "dolibarr/db/user/name" || true
;;
6) # Get the DBMS account password
db_fset "dolibarr/db/user/password/mismatch" "seen" "false" || true
db_beginblock
db_input critical "dolibarr/db/user/password" || true
db_input critical "dolibarr/db/user/password/confirm" || true
db_endblock
;;
7) # Check if passwords match.
db_get "dolibarr/db/user/password"
password="$RET"
db_get "dolibarr/db/user/password/confirm"
confirm="$RET"
if [ "$password" != "$confirm" ] ; then
# Reset the template used
db_reset "dolibarr/db/user/password" || true
db_fset "dolibarr/db/user/password" "seen" "false" || true
db_reset "dolibarr/db/user/password/confirm" || true
db_fset "dolibarr/db/user/password/confirm" "seen" "false" || true
# Promt the user
db_input critical "dolibarr/header/password/mismatch" || true
# Do one step back anyway.
forward=-1
else
# Do not prompt, go to the next step.
skip="true"
fi
;;
8) # Ask for deleting all the database on package purge.
db_input medium "dolibarr/postrm" || true
onsuccess='finished="true"'
# Skip previous step
backward=2
;;
*)
skip="true"
message="Unknown step #$tep."
if [ $step -lt 0 ] ; then
step=-1
elif [ $step -gt 11 ] ; then
finished="true"
fi
;;
esac
if $skip ; then
next=$(($step + 1))
eval $onsuccess
onsuccess=''
else
db_title "dolibarr" || true
if db_go ; then
next=$(($step + $forward))
eval $onsuccess
onsuccess=''
else
next=$(($step - $backward))
onsuccess=''
fi
fi
step=$next
done
db_stop
exit 0
File moved
#! /bin/sh
#!/bin/sh
# postinst script for dolibarr
#
# see: dh_installdeb(1)
......@@ -42,27 +42,32 @@ env_enable()
fi
}
set -x
echo Run the postinst script
case "$1" in
configure)
config="/etc/dolibarr/apache.conf"
#db_reset "dolibarr/webserver"
# Get the web server type.
db_get "dolibarr/webserver"
webserver="$RET"
db_get "dolibarr/webserver" # Ask/read value for webserver.
# webserver="$RET"
webserver="Both"
case $webserver in
Apache) webservers="apache" ;;
Apache-SSL) webservers="apache-ssl" ;;
Both) webservers="apache apache-ssl" ;;
Apache) webservers="apache2" ;;
Apache-SSL) webservers="apache2-ssl" ;;
Both) webservers="apache2 apache2-ssl" ;;
*) webservers="" ;;
esac
. /usr/share/wwwconfig-common/php.get
# Set up web server.
for server in $webservers ; do
echo Complete config of server $server
env_enable
typestr='application/x-httpd-php'
extension='.php3'
extension='.php'
. /usr/share/wwwconfig-common/apache-addtype_all.sh
. /usr/share/wwwconfig-common/apache-php.sh
. /usr/share/wwwconfig-common/apache-run.get
......@@ -72,7 +77,10 @@ case "$1" in
# not have the same user/group.
#
chown -R $webuser.$webgroup /usr/share/dolibarr
# TODO This add alias into http.conf but it should go into apache2.conf
includefile="/etc/dolibarr/apache.conf"
#echo "$includefile $server"
. /usr/share/wwwconfig-common/apache-include_all.sh
test "$status" = "uncomment" -o "$status" = "include" && restart="$server $restart"
for index in index.php; do
......@@ -81,86 +89,18 @@ case "$1" in
done
done
#
# Pear
#
if [ ! -f /usr/bin/php ] ; then ln -s /usr/bin/php4 /usr/bin/php ; fi
pear install Archive_Tar || true
pear install Console_Getopt || true
pear install PEAR || true
pear install Auth || true
pear install DB || true
#
# Database
#
db_get "dolibarr/db/setup/skip"
if [ "$RET" = "false" ] ; then
db_get "dolibarr/db/host"
dbserver="$RET"
db_get "dolibarr/db/name"
dbname="$RET"
db_get "dolibarr/db/admin/name"
dbadmin="$RET"
db_get "dolibarr/db/admin/password"
dbadmpass="$RET"
db_get "dolibarr/db/user/name"
dbuser="$RET"
db_get "dolibarr/db/user/password"
dbpass="$RET"
dbtype="mysql"
status=''
# User may have choosen to continue anyway
# with the configuration, so:
if [ "$dbtype" = "mysql" ] ; then
. /usr/share/wwwconfig-common/${dbtype}-createuser.sh
test "$error" && echo $error
. /usr/share/wwwconfig-common/${dbtype}-createdb.sh
test "$error" && echo $error
fi
if [ "$status" = "create" ] ; then
sqlfile=/usr/lib/dolibarr/${dbtype}.sql
perl -pi -e "s/'admin','admin'/'$dbuser','$dbpass'/" $sqlfile
. /usr/share/wwwconfig-common/${dbtype}-exec.sh
if [ -z "$error" ] ; then
echo "Visit http://localhost/dolibarr/install.php to complete the installation"
else
echo $error
fi
else
#
# This dangerous file should be removed
# after the user visits install.php but this
# is beyond the control of the script. By
# removing it at this point we ensure that
# it does not survive an upgrade of dolibarr.
#
rm -f /usr/share/dolibarr/install.php
fi
fi
perl -pi -e "s/Auth_MySQL_DB.*/Auth_MySQL_DB '$dbname'/" /etc/dolibarr/apache.conf
perl -pi -e "s/Auth_MySQL_Username_Field.*/Auth_MySQL_Username_Field '$dbuser'/" /etc/dolibarr/apache.conf
perl -pi -e "s/Auth_MySQL_Password_Field.*/Auth_MySQL_Password_Field '$dbpass'/" /etc/dolibarr/apache.conf
perl -pi -e "s/DBNAME.*/DBNAME $dbname/" /etc/dolibarr/apache.conf
perl -pi -e "s/DBUSER.*/DBUSER $dbuser/" /etc/dolibarr/apache.conf
perl -pi -e "s/DBPASS.*/DBPASS $dbpass/" /etc/dolibarr/apache.conf
if grep DBHOST /usr/share/dolibarr/conf/conf.php > /dev/null
then
perl -pi -e "s/DBHOST/$dbserver/" /usr/share/dolibarr/conf/conf.php
perl -pi -e "s/DBNAME/$dbname/" /usr/share/dolibarr/conf/conf.php
perl -pi -e "s/DBUSER/$dbuser/" /usr/share/dolibarr/conf/conf.php
perl -pi -e "s/DBPASS/$dbpass/" /usr/share/dolibarr/conf/conf.php
fi
# Reset passwords
db_reset "dolibarr/db/user/password"
servers="apache-ssl apache mysql"
echo "Go on page http://localhost/dolibarr/ to complete the installation and use Dolibarr."
# TODO Create the file to force parameters in Web installer
#if grep DBHOST /usr/share/dolibarr/htdocs/conf/conf.php > /dev/null
#then
# perl -pi -e "s/DBHOST/$dbserver/" /usr/share/dolibarr/htdocs/conf/conf.php
# perl -pi -e "s/DBNAME/$dbname/" /usr/share/dolibarr/htdocs/conf/conf.php
# perl -pi -e "s/DBUSER/$dbuser/" /usr/share/dolibarr/htdocs/conf/conf.php
# perl -pi -e "s/DBPASS/$dbpass/" /usr/share/dolibarr/htdocs/conf/conf.php
#fi
servers="apache2-ssl apache2 mysql"
. /usr/share/wwwconfig-common/restart.sh
;;
......@@ -179,4 +119,4 @@ db_stop
#DEBHELPER#
exit 0
exit 0
\ No newline at end of file
......@@ -23,9 +23,9 @@ webserver="$RET"
# Allows us to loop and substitute in one pass
case $webserver in
Apache) webservers="apache" ;;
Apache-SSL) webservers="apache-ssl" ;;
Both) webservers="apache apache-ssl" ;;
Apache) webservers="apache2" ;;
Apache-SSL) webservers="apache2-ssl" ;;
Both) webservers="apache2 apache2-ssl" ;;
*) webservers="" ;;
esac
includefile=/etc/dolibarr/apache.conf
......@@ -35,12 +35,7 @@ case "$1" in
db_get "dolibarr/postrm"
if [ "$RET" = "true" ] ; then
# Get database configuration
db_get "dolibarr/db/user/name"
dbuser="$RET"
db_get "dolibarr/db/user/password"
dbpass="$RET"
db_get "dolibarr/db/host"
dbserver="$RET"
dbserver="localhost"
db_get "dolibarr/db/name"
dbname="$RET"
db_get "dolibarr/db/admin/name"
......@@ -63,7 +58,7 @@ case "$1" in
fi
done
servers="apache-ssl apache mysql"
servers="apache2-ssl apache2 mysql"
. /usr/share/wwwconfig-common/restart.sh
for dir in /usr/share/dolibarr ; do
......
......@@ -38,26 +38,23 @@ install: build
dh_clean -k
dh_installdirs
@# Add here commands to install the package into debian/tmp
@# Add here commands to install the package into debian/dolibarr
install --mode=644 -D --group=www-data --owner=www-data \
debian/apache.conf \
DEBIAN/apache.conf \
debian/dolibarr/etc/dolibarr/apache.conf
mkdir -p debian/dolibarr/usr/share/dolibarr
cp -rp htdocs/* debian/dolibarr/usr/share/dolibarr
mkdir -p debian/dolibarr/usr/share/dolibarr/document
install --mode 644 --group=www-data --owner=www-data debian/conf.php debian/dolibarr/usr/share/dolibarr/conf/conf.php
cp -rp htdocs/* debian/dolibarr/usr/share/dolibarr/htdocs
mkdir -p debian/dolibarr/usr/share/dolibarr/documents
chmod -R 644 debian/dolibarr/usr/share/dolibarr
find debian/dolibarr/usr/share/dolibarr -type d | xargs chmod 755
find debian/dolibarr \( -name CVS -o -name .cvsignore \) | xargs rm -fr
mkdir -p debian/dolibarr/usr/lib/dolibarr
install --mode=444 mysql/mysql.sql debian/dolibarr/usr/lib/dolibarr/mysql.sql
for i in count-dons.pl file-dons.pl ; do \
install --mode=755 scripts/$$i debian/dolibarr/usr/lib/dolibarr/$$i ; \
done
cp -rp scripts/* debian/dolibarr/usr/lib/dolibarr
# Build architecture-independent files here.
binary-indep: build install
......
......@@ -34,10 +34,17 @@ Description: dolibarr DB setup NOTE.
Template: dolibarr/db/host
Type: string
Default: localhost
Description: Please, insert dolibarr DB host name:
Description: Please, insert your database host name:
This should be the host-name or IP address that dolibarr will use to access
the DB.
Template: dolibarr/db/port
Type: string
Default: 3306
Description: Please, insert your database port:
This should be the port value that dolibarr will use to access
the DB.
Template: dolibarr/db/name
Type: string
Default: dolibarr
......@@ -69,11 +76,12 @@ Description: Passwords mismatch.
Template: dolibarr/db/admin/name
Type: string
Default: root
Description: Please, insert the DBMS administrator user-name:
This user-name will be used to access the DBMS to create (if needed):
.
(1) The DB
(2) The new DBMS account that dolibarr will use to access the DB
(1) The new dolibarr database
(2) The new database account that dolibarr will use to access the DB
.
It should be 'root' for MySql.
......@@ -91,4 +99,4 @@ Default: true
Description: Delete *ALL*?
Datas subjected to this question are the DBMS account, the DB and the
dolibarr users ang group files. Do I have to delete *ALL* datas whenever
the the dolibarr package will be completely removed from the system?
the dolibarr package will be completely removed from the system?
......@@ -232,9 +232,13 @@ if ($nboftargetok) {
$ret=`cp -pr "$SOURCE" "$BUILDROOT/dolibarr"`;
}
print "Clean $BUILDROOT\n";
$ret=`rm -fr $BUILDROOT/$PROJECT/.cache`;
$ret=`rm -fr $BUILDROOT/$PROJECT/.project`;
$ret=`rm -fr $BUILDROOT/$PROJECT/.settings`;
$ret=`rm -fr $BUILDROOT/$PROJECT/index.php`;
$ret=`rm -fr $BUILDROOT/$PROJECT/documents`;
$ret=`rm -fr $BUILDROOT/$PROJECT/document`;
$ret=`rm -fr $BUILDROOT/$PROJECT/document`;
$ret=`rm -fr $BUILDROOT/$PROJECT/Thumbs.db $BUILDROOT/$PROJECT/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/*/*/Thumbs.db`;
$ret=`rm -fr $BUILDROOT/$PROJECT/CVS* $BUILDROOT/$PROJECT/*/CVS* $BUILDROOT/$PROJECT/*/*/CVS* $BUILDROOT/$PROJECT/*/*/*/CVS* $BUILDROOT/$PROJECT/*/*/*/*/CVS* $BUILDROOT/$PROJECT/*/*/*/*/*/CVS*`;
}
......@@ -342,27 +346,58 @@ if ($nboftargetok) {
}
if ($target eq 'DEB') {
# print "Automatic build for DEB is not yet supported.\n";
print "Create directory $BUILDROOT/DEBIAN\n";
print "Move $BUILDROOT/$PROJECT $BUILDROOT/$PROJECT.tmp\n";
$cmd="mv \"$BUILDROOT/$PROJECT\" \"$BUILDROOT/$PROJECT.tmp\"";
$ret=`$cmd`;
print "Create directory $BUILDROOT/$PROJECT/usr/share\n";
$ret=`mkdir -p "$BUILDROOT/$PROJECT/usr/share"`;
print "Move $BUILDROOT/$PROJECT.tmp $BUILDROOT/$PROJECT/usr/share/$PROJECT\n";
$cmd="mv \"$BUILDROOT/$PROJECT.tmp\" \"$BUILDROOT/$PROJECT/usr/share/$PROJECT\"";
$ret=`$cmd`;
print "Create directory $BUILDROOT/$PROJECT/DEBIAN\n";
$ret=`mkdir "$BUILDROOT/$PROJECT/DEBIAN"`;
print "Copy $SOURCE/build/deb to $BUILDROOT/$PROJECT/DEBIAN\n";
$ret=`cp -r "$SOURCE/build/deb" "$BUILDROOT/$PROJECT/DEBIAN"`;
print "Copy $SOURCE/build/deb/* to $BUILDROOT/$PROJECT/DEBIAN\n";
$ret=`cp -r "$SOURCE/build/deb/." "$BUILDROOT/$PROJECT/DEBIAN"`;
$ret=`rm -fr $BUILDROOT/$PROJECT/DEBIAN/CVS`;
$ret=`chmod -R 755 $BUILDROOT/$PROJECT/DEBIAN`;
print "Edit version in file $BUILDROOT/$PROJECT/DEBIAN/control\n";
open (SPECFROM,"<$SOURCE/build/deb/control") || die "Error";
open (SPECTO,">$BUILDROOT/$PROJECT/DEBIAN/control") || die "Error";
while (<SPECFROM>) {
$_ =~ s/__VERSION__/$MAJOR.$MINOR.$BUILD/;
$newbuild = $BUILD;
$newbuild =~ s/alpha/0/gi;
$newbuild =~ s/beta/1/gi;
if ($newbuild !~ /-/) { $newbuild.='-2'; }
$_ =~ s/__VERSION__/$MAJOR.$MINOR.$newbuild/;
print SPECTO $_;
}
close SPECFROM;
close SPECTO;
print "Create directory $BUILDROOT/$PROJECT/etc/dolibarr\n";
$ret=`mkdir -p "$BUILDROOT/$PROJECT/etc/dolibarr"`;
#print "Copy changelog file into $BUILDROOT/$PROJECT/DEBIAN\n";
#$ret=`cp "$SOURCE/ChangeLog" "$BUILDROOT/$PROJECT/DEBIAN/changelog"`;
print "Copy README file into $BUILDROOT/$PROJECT/DEBIAN\n";
$ret=`cp "$SOURCE/README" "$BUILDROOT/$PROJECT/DEBIAN/README"`;
print "Copy copyright file into $BUILDROOT/$PROJECT/DEBIAN\n";
$ret=`cp "$SOURCE/COPYRIGHT" "$BUILDROOT/$PROJECT/DEBIAN/copyright"`;
print "Copy apache conf file into $BUILDROOT/$PROJECT/etc/dolibarr\n";
$ret=`cp "$SOURCE/build/deb/apache.conf" "$BUILDROOT/$PROJECT/etc/dolibarr"`;
print "Go to directory $BUILDROOT\n";
chdir("$BUILDROOT");
print "Launch DEB build (dpkg -b $BUILDROOT/$PROJECT $BUILDROOT/${FILENAMEDEB}.deb)\n";
$cmd="$DEB -b $BUILDROOT/$PROJECT $BUILDROOT/${FILENAMEDEB}.deb";
$cmd="dpkg -b $BUILDROOT/$PROJECT $BUILDROOT/${FILENAMEDEB}.deb";
print "Launch DEB build ($cmd)\n";
$ret=`$cmd`;
print $ret."\n";
next;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment