Work on debian package
This commit is contained in:
parent
a6e2d32af3
commit
e352d2545e
@ -1,5 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# postinst script for dolibarr
|
# postinst script for dolibarr
|
||||||
|
#
|
||||||
|
# see: dh_installdeb(1)
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
@ -14,31 +16,6 @@ set -e
|
|||||||
# for details, see /usr/share/doc/packaging-manual/
|
# for details, see /usr/share/doc/packaging-manual/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
lighttpd_install() {
|
|
||||||
if [ ! -f /etc/lighttpd/conf-available/50-dolibarr.conf ] ; then
|
|
||||||
if which lighty-enable-mod >/dev/null 2>&1 ; then
|
|
||||||
echo "Add link for Lighttpd config file"
|
|
||||||
ln -fs /etc/dolibarr/lighttpd.conf /etc/lighttpd/conf-available/50-dolibarr.conf
|
|
||||||
# We enabled it
|
|
||||||
lighty-enable-mod dolibarr fastcgi-php
|
|
||||||
else
|
|
||||||
echo "Lighttpd not installed, skipping"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
apache_install() {
|
|
||||||
webserver=$1
|
|
||||||
if [ -d /etc/$webserver/conf.d ] && [ ! -e /etc/$webserver/conf.d/dolibarr.conf ]; then
|
|
||||||
echo "Add link for Apache config file"
|
|
||||||
ln -fs /etc/dolibarr/apache.conf /etc/$webserver/conf.d/dolibarr.conf
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
. /usr/share/debconf/confmodule
|
. /usr/share/debconf/confmodule
|
||||||
|
|
||||||
db_version 2.0
|
db_version 2.0
|
||||||
@ -47,25 +24,23 @@ db_version 2.0
|
|||||||
echo Run the dolibarr postinst script
|
echo Run the dolibarr postinst script
|
||||||
|
|
||||||
|
|
||||||
# Define vars
|
|
||||||
docdir='/var/lib/dolibarr/documents'
|
docdir='/var/lib/dolibarr/documents'
|
||||||
#docdir='/usr/share/dolibarr/documents'
|
#docdir='/usr/share/dolibarr/documents'
|
||||||
installfileorig="/usr/share/dolibarr/build/deb/install.forced.php.install"
|
|
||||||
installconfig="/etc/dolibarr/install.forced.php"
|
|
||||||
#config="/usr/share/dolibarr/htdocs/conf/conf.php"
|
|
||||||
config="/etc/dolibarr/conf.php"
|
|
||||||
|
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
configure)
|
configure)
|
||||||
|
|
||||||
# Create document directory for uploaded data files
|
# Copy apache.conf file into target directory.
|
||||||
mkdir -p $docdir
|
#fileorig="/usr/share/dolibarr/build/deb/apache.conf"
|
||||||
chown -R www-data:www-data $docdir
|
#config="/etc/dolibarr/apache.conf"
|
||||||
chmod -R 775 $docdir
|
#mkdir -p /etc/dolibarr
|
||||||
chmod -R g+s $docdir
|
#cp -p $fileorig $config
|
||||||
|
|
||||||
# Copy install config file (with matching Debian) values into target directory
|
# Edit install.forced.php to match Debian values
|
||||||
|
fileorig="/usr/share/dolibarr/build/deb/install.forced.php.install"
|
||||||
|
config="/usr/share/dolibarr/htdocs/install/install.forced.php"
|
||||||
superuserlogin=''
|
superuserlogin=''
|
||||||
superuserpassword=''
|
superuserpassword=''
|
||||||
if [ -f /etc/mysql/debian.cnf ] ; then
|
if [ -f /etc/mysql/debian.cnf ] ; then
|
||||||
@ -75,31 +50,42 @@ case "$1" in
|
|||||||
fi
|
fi
|
||||||
echo Mysql superuser found to use is $superuserlogin
|
echo Mysql superuser found to use is $superuserlogin
|
||||||
if [ -z "$superuserlogin" ] ; then
|
if [ -z "$superuserlogin" ] ; then
|
||||||
cat $installfileorig | sed -e 's/__SUPERUSERLOGIN__/root/g' | sed -e 's/__SUPERUSERPASSWORD__//g' > $installconfig
|
cat $fileorig | sed -e 's/__SUPERUSERLOGIN__/root/g' | sed -e 's/__SUPERUSERPASSWORD__//g' > $config
|
||||||
else
|
else
|
||||||
cat $installfileorig | sed -e 's/__SUPERUSERLOGIN__/'$superuserlogin'/g' | sed -e 's/__SUPERUSERPASSWORD__/'$superuserpassword'/g' > $installconfig
|
cat $fileorig | sed -e 's/__SUPERUSERLOGIN__/'$superuserlogin'/g' | sed -e 's/__SUPERUSERPASSWORD__/'$superuserpassword'/g' > $config
|
||||||
fi
|
fi
|
||||||
chown -R root:www-data $installconfig
|
|
||||||
chmod -R 660 $installconfig
|
# Create document directory for uploaded data files
|
||||||
|
mkdir -p $docdir
|
||||||
|
chown -R www-data:www-data $docdir
|
||||||
|
chmod -R 775 $docdir
|
||||||
|
chmod -R g+s $docdir
|
||||||
|
|
||||||
# Create an empty conf.php with permission to web server
|
# Create an empty conf.php with permission to web server
|
||||||
if [ ! -f $config ]
|
if [ ! -f /usr/share/dolibarr/htdocs/conf/conf.php ]
|
||||||
then
|
then
|
||||||
echo Create empty file $config
|
echo Create empty file /usr/share/dolibarr/htdocs/conf/conf.php
|
||||||
touch $config
|
touch /usr/share/dolibarr/htdocs/conf/conf.php
|
||||||
chown -R root:www-data $config
|
chown -R root:www-data /usr/share/dolibarr/htdocs/conf/conf.php
|
||||||
chmod -R 660 $config
|
chmod -R 660 /usr/share/dolibarr/htdocs/conf/conf.php
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
#db_reset "dolibarr/webserver"
|
||||||
|
|
||||||
db_get dolibarr/reconfigure-webserver
|
# Get the web server type (use db_get for interactive mode).
|
||||||
|
#db_get "dolibarr/webserver" # Read value for webserver.
|
||||||
|
#webserver="$RET"
|
||||||
|
|
||||||
webservers="$RET"
|
case $webserver in
|
||||||
|
Apache) webservers="apache2" ;;
|
||||||
|
Apache-SSL) webservers="apache2-ssl" ;;
|
||||||
|
Both) webservers="apache2 apache2-ssl" ;;
|
||||||
|
*) webservers="apache2 apache2-ssl" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
# Set up web server.
|
# Set up web server.
|
||||||
for webserver in $webservers ; do
|
for server in $webservers ; do
|
||||||
webserver=${webserver%,}
|
echo Complete config of server $server
|
||||||
echo Complete config of server $webserver
|
|
||||||
|
|
||||||
# Detect webuser and webgroup
|
# Detect webuser and webgroup
|
||||||
webuser=
|
webuser=
|
||||||
@ -116,33 +102,48 @@ case "$1" in
|
|||||||
|
|
||||||
# Set permissions to web server
|
# Set permissions to web server
|
||||||
chown -R $webuser:$webgroup /usr/share/dolibarr
|
chown -R $webuser:$webgroup /usr/share/dolibarr
|
||||||
chown -R root:$webgroup $config
|
chown -R root:$webgroup /usr/share/dolibarr/htdocs/conf/conf.php
|
||||||
|
|
||||||
|
# Add link to config file
|
||||||
|
echo Setup web server $server to add dolibarr config file
|
||||||
|
ln -fs /etc/dolibarr/apache.conf /etc/apache2/conf.d/dolibarr.conf
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|
||||||
# Restart web server.
|
#echo "Install menu entry"
|
||||||
for webserver in $webservers; do
|
# This one is for Gnome ubuntu
|
||||||
webserver=${webserver%,}
|
#fileorig="/usr/share/dolibarr/build/deb/dolibarr.desktop"
|
||||||
if [ "$webserver" = "lighttpd" ] ; then
|
#target="/usr/share/applications/"
|
||||||
lighttpd_install
|
#cp -f $fileorig $target
|
||||||
else
|
# Not sure this is usefull
|
||||||
apache_install $webserver
|
#if test -x /usr/bin/update-menus; then
|
||||||
fi
|
# echo "update-menus"
|
||||||
# Reload webserver in any case, configuration might have changed
|
# update-menus;
|
||||||
# Redirection of 3 is needed because Debconf uses it and it might
|
#fi
|
||||||
# be inherited by webserver. See bug #446324.
|
|
||||||
if [ -f /etc/init.d/$webserver ] ; then
|
# 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
|
||||||
|
|
||||||
|
# Restart servers
|
||||||
|
servers="apache2-ssl apache2 mysql"
|
||||||
|
# Another way to restart
|
||||||
|
for server in $servers ; do
|
||||||
if [ -x /usr/sbin/invoke-rc.d ]; then
|
if [ -x /usr/sbin/invoke-rc.d ]; then
|
||||||
echo Restart web server $server using invoke-rc.d
|
echo Restart web server $server using invoke-rc.d
|
||||||
# This works with Debian (5.05,...) and Ubuntu (9.10,10.04,...)
|
# This works with Debian (5.05,...) and Ubuntu (9.10,10.04,...)
|
||||||
invoke-rc.d $webserver reload 3>/dev/null || true
|
invoke-rc.d $server reload || true
|
||||||
else
|
else
|
||||||
echo Restart web server $server using $server reload
|
echo Restart web server $server using $server reload
|
||||||
/etc/init.d/$webserver reload 3>/dev/null || true
|
/etc/init.d/$server reload || true
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
echo ----------
|
echo ----------
|
||||||
echo "Call Dolibarr page http://localhost/dolibarr/ to complete the installation and use Dolibarr."
|
echo "Call Dolibarr page http://localhost/dolibarr/ to complete the installation and use Dolibarr."
|
||||||
echo ----------
|
echo ----------
|
||||||
@ -152,13 +153,13 @@ case "$1" in
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
echo "postinst called with unknown argument $1" >&2
|
echo "postinst called with unknown argument \`$1'" >&2
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
#DEBHELPER#
|
|
||||||
|
|
||||||
db_stop
|
db_stop
|
||||||
|
|
||||||
|
#DEBHELPER#
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
# \file build/makepack-dolibarr.pl
|
# \file build/makepack-dolibarr.pl
|
||||||
# \brief Dolibarr package builder (tgz, zip, rpm, deb, exe, aps)
|
# \brief Dolibarr package builder (tgz, zip, rpm, deb, exe, aps)
|
||||||
# \version $Id: makepack-dolibarr.pl,v 1.119 2011/07/27 23:51:07 eldy Exp $
|
# \version $Id: makepack-dolibarr.pl,v 1.120 2011/07/28 18:32:00 eldy Exp $
|
||||||
# \author (c)2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
# \author (c)2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -48,7 +48,7 @@ if (-d "/usr/src/RPM") {
|
|||||||
|
|
||||||
|
|
||||||
use vars qw/ $REVISION $VERSION /;
|
use vars qw/ $REVISION $VERSION /;
|
||||||
$REVISION='$Revision: 1.119 $'; $REVISION =~ /\s(.*)\s/; $REVISION=$1;
|
$REVISION='$Revision: 1.120 $'; $REVISION =~ /\s(.*)\s/; $REVISION=$1;
|
||||||
$VERSION="1.0 (build $REVISION)";
|
$VERSION="1.0 (build $REVISION)";
|
||||||
|
|
||||||
|
|
||||||
@ -555,11 +555,14 @@ if ($nboftargetok) {
|
|||||||
# To remove once stable
|
# To remove once stable
|
||||||
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/htdocs/htdocs/theme/bureau2crea`;
|
$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/usr/share/$PROJECT/htdocs/htdocs/theme/bureau2crea`;
|
||||||
|
|
||||||
# apache.conf
|
# Apache conf files
|
||||||
print "Copy apache.conf file into $BUILDROOT/$PROJECT.tmp/etc/$PROJECT/apache.conf\n";
|
print "Copy apache.conf file into $BUILDROOT/$PROJECT.tmp/etc/$PROJECT/apache.conf\n";
|
||||||
$ret=`mkdir -p "$BUILDROOT/$PROJECT.tmp/etc/$PROJECT"`;
|
$ret=`mkdir -p "$BUILDROOT/$PROJECT.tmp/etc/$PROJECT"`;
|
||||||
$ret=`cp "$SOURCE/build/deb/apache.conf" "$BUILDROOT/$PROJECT.tmp/etc/$PROJECT/apache.conf"`;
|
$ret=`cp "$SOURCE/build/deb/apache.conf" "$BUILDROOT/$PROJECT.tmp/etc/$PROJECT/apache.conf"`;
|
||||||
|
|
||||||
|
# Dolibarr conf files
|
||||||
|
# TODO
|
||||||
|
|
||||||
# dolibarr.desktop
|
# dolibarr.desktop
|
||||||
print "Create directory $BUILDROOT/$PROJECT.tmp/usr/share/applications\n";
|
print "Create directory $BUILDROOT/$PROJECT.tmp/usr/share/applications\n";
|
||||||
$ret=`mkdir -p "$BUILDROOT/$PROJECT.tmp/usr/share/applications"`;
|
$ret=`mkdir -p "$BUILDROOT/$PROJECT.tmp/usr/share/applications"`;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user