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

Enhancement of debian package

parent 1afda34a
No related branches found
No related tags found
No related merge requests found
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
set -e set -e
. /usr/share/debconf/confmodule . /usr/share/debconf/confmodule
db_version 2.0 db_version 2.0
...@@ -24,8 +25,8 @@ echo Run the config script ...@@ -24,8 +25,8 @@ echo Run the config script
if [ "$1" = "reconfigure" ] ; then if [ "$1" = "reconfigure" ] ; then
config="/etc/dolibarr/apache.conf" config="/etc/dolibarr/apache.conf"
for i in $(seq 8 -1 0) ; do for i in $(seq 8 -1 0) ; do
if [ -f ${config}.$i ] if [ -f ${config}.$i ] ; then
then mv ${config}.$i ${config}.$(($i +1)) mv ${config}.$i ${config}.$(($i +1))
fi fi
done done
mv ${config} ${config}.0 mv ${config} ${config}.0
...@@ -35,11 +36,12 @@ fi ...@@ -35,11 +36,12 @@ fi
db_capb backup db_capb backup
db_title "dolibarr" || true
# Ask for web server type. # Ask for web server type.
#db_input critical "dolibarr/webserver" || true #db_input critical "dolibarr/webserver" || true
db_title "dolibarr" || true
if db_go ; then if db_go ; then
okcancel="1" okcancel="1"
else else
...@@ -47,9 +49,6 @@ else ...@@ -47,9 +49,6 @@ else
fi fi
# Ask on wich host the DBMS is installed.
#db_input critical "dolibarr/db/host" || true
# Get the database administrator name and password. # Get the database administrator name and password.
#db_beginblock #db_beginblock
# db_input critical "dolibarr/db/admin/name" || true # db_input critical "dolibarr/db/admin/name" || true
...@@ -66,9 +65,12 @@ fi ...@@ -66,9 +65,12 @@ fi
#db_input critical "dolibarr/db/user/password" || true #db_input critical "dolibarr/db/user/password" || true
# Ask for deleting all the database on package purge. # Ask for deleting all the database on package purge.
#db_input medium "dolibarr/postrm" || true #db_input critical "dolibarr/postrm" || true
#onsuccess='finished="true"'
# Launch input screens
#db_go || true
onsuccess='finished="true"'
db_stop db_stop
exit 0 exit 0
usr/share/dolibarr/htdocs/conf/conf.php.example
\ No newline at end of file
...@@ -8,8 +8,8 @@ $force_install_createdatabase='1'; ...@@ -8,8 +8,8 @@ $force_install_createdatabase='1';
$force_install_databaselogin='dolibarrmysql'; $force_install_databaselogin='dolibarrmysql';
$force_install_databasepass=''; $force_install_databasepass='';
$force_install_createuser='1'; $force_install_createuser='1';
$force_install_databaserootlogin='root'; $force_install_databaserootlogin='__SUPERUSERLOGIN__';
$force_install_databaserootpass=''; $force_install_databaserootpass='__SUPERUSERPASSWORD__';
$force_install_dolibarrlogin='admin'; $force_install_dolibarrlogin='admin';
$force_install_nophpinfo='1'; $force_install_nophpinfo='1';
$force_install_lockinstall='1'; $force_install_lockinstall='1';
......
...@@ -15,7 +15,9 @@ set -e ...@@ -15,7 +15,9 @@ set -e
# <conflicting-package> <version> # <conflicting-package> <version>
# for details, see /usr/share/doc/packaging-manual/ # for details, see /usr/share/doc/packaging-manual/
. /usr/share/debconf/confmodule . /usr/share/debconf/confmodule
db_version 2.0 db_version 2.0
# #
...@@ -53,11 +55,23 @@ case "$1" in ...@@ -53,11 +55,23 @@ case "$1" in
mkdir -p /etc/dolibarr mkdir -p /etc/dolibarr
cp -p $fileorig $config cp -p $fileorig $config
# Copy install.forced.php # Create install.forced.php
fileorig="/usr/share/dolibarr/build/deb/install.forced.php" fileorig="/usr/share/dolibarr/build/deb/install.forced.php.install"
config="/usr/share/dolibarr/htdocs/install/install.forced.php" config="/usr/share/dolibarr/htdocs/install/install.forced.php"
cp -p $fileorig $config superuserlogin=''
superuserpassword=''
if [ -f /etc/mysql/debian.cnf ] ; then
# Load superuser login and pass
superuserlogin=$(/bin/grep --max-count=1 "user" /etc/mysql/debian.cnf | /bin/sed -e 's/^user[ =]*//g')
superuserpassword=$(/bin/grep --max-count=1 "password" /etc/mysql/debian.cnf | /bin/sed -e 's/^password[ =]*//g')
fi
echo Mysql superuser found to use is $superuserlogin
if [ -z "$superuserlogin" ] ; then
cat $fileorig | sed -e 's/__SUPERUSERLOGIN__/root/g' | sed -e 's/__SUPERUSERPASSWORD__//g' > $config
else
cat $fileorig | sed -e 's/__SUPERUSERLOGIN__/'$superuserlogin'/g' | sed -e 's/__SUPERUSERPASSWORD__/'$superuserpassword'/g' > $config
fi
# Create empty conf.php # Create empty conf.php
if [ ! -f /usr/share/dolibarr/htdocs/conf/conf.php ] if [ ! -f /usr/share/dolibarr/htdocs/conf/conf.php ]
then then
...@@ -150,14 +164,26 @@ case "$1" in ...@@ -150,14 +164,26 @@ case "$1" in
# perl -pi -e "s/DBPASS/$dbpass/" /usr/share/dolibarr/htdocs/conf/conf.php # perl -pi -e "s/DBPASS/$dbpass/" /usr/share/dolibarr/htdocs/conf/conf.php
#fi #fi
# Restart servers
servers="apache2-ssl apache2 mysql" servers="apache2-ssl apache2 mysql"
. /usr/share/wwwconfig-common/restart.sh if [ -f /usr/share/wwwconfig-common/restart.sh ] ;
then
. /usr/share/wwwconfig-common/restart.sh
else
# Another way to restart
for server in $servers ; do
if [ -x /usr/sbin/invoke-rc.d ]; then
invoke-rc.d $server reload || true
else
/etc/init.d/$server reload || true
fi
done
fi
echo "Launch Dolibarr on page http://localhost/dolibarr/ to complete the installation and use Dolibarr." echo "Launch Dolibarr on page http://localhost/dolibarr/ to complete the installation and use Dolibarr."
;; ;;
abort-upgrade|abort-remove|abort-deconfigure) abort-upgrade|abort-remove|abort-deconfigure)
;; ;;
*) *)
......
#! /bin/sh #!/bin/sh
# postrm script for dolibarr # postrm script for dolibarr
# #
# see: dh_installdeb(1) # see: dh_installdeb(1)
...@@ -16,10 +16,13 @@ set -e ...@@ -16,10 +16,13 @@ set -e
# * <disappearer's-postrm> `disappear' <r>overwrit>r> <new-version> # * <disappearer's-postrm> `disappear' <r>overwrit>r> <new-version>
# for details, see /usr/share/doc/packaging-manual/ # for details, see /usr/share/doc/packaging-manual/
. /usr/share/debconf/confmodule . /usr/share/debconf/confmodule
db_version 2.0 db_version 2.0
echo Run the postrm script
#echo "postrm db_get dolibarr/webserver" #echo "postrm db_get dolibarr/webserver"
# We disable set -e to avoid premature end of script if error # We disable set -e to avoid premature end of script if error
set +e set +e
...@@ -40,23 +43,40 @@ case "$1" in ...@@ -40,23 +43,40 @@ case "$1" in
purge) purge)
echo "postrm purge webservers=$webservers includefile=$includefile" echo "postrm purge webservers=$webservers includefile=$includefile"
#echo "postrm db_get dolibarr/postrm" # Ask if we must delete database
echo "postrm db_input dolibarr/postrm"
db_input critical "dolibarr/postrm" || true
db_go || true
echo "postrm db_get dolibarr/postrm"
# We disable set -e to avoid premature end of script if error # We disable set -e to avoid premature end of script if error
set +e set +e
db_get "dolibarr/postrm" db_get "dolibarr/postrm"
set -e set -e
if [ "$RET" = "true" ] ; then if [ "$RET" = "true" ] ; then
echo postrm Mysql database deletion
# Get database configuration # Get database configuration
dbserver="localhost" dbserver="localhost"
db_get "dolibarr/db/name" dbname="dolibarr"
dbname="$RET" #db_get "dolibarr/db/name"
db_get "dolibarr/db/admin/name" #dbname="$RET"
dbadmin="$RET" superuserlogin=''
db_get "dolibarr/db/admin/password" superuserpassword=''
dbadmpass="$RET" if [ -f /etc/mysql/debian.cnf ] ; then
# Load superuser login and pass
superuserlogin=$(/bin/grep --max-count=1 "user" /etc/mysql/debian.cnf | /bin/sed -e 's/^user[ =]*//g')
superuserpassword=$(/bin/grep --max-count=1 "password" /etc/mysql/debian.cnf | /bin/sed -e 's/^password[ =]*//g')
fi
echo postrm Mysql superuser found to use is $superuserlogin
dbadmin="$superuserlogin"
dbadmpass="$superuserpassword"
#db_get "dolibarr/db/admin/name"
#dbadmin="$RET"
#db_get "dolibarr/db/admin/password"
#dbadmpass="$RET"
dbtype="mysql" dbtype="mysql"
. /usr/share/wwwconfig-common/${dbtype}-dropuser.sh . /usr/share/wwwconfig-common/${dbtype}-dropuser.sh
. /usr/share/wwwconfig-common/${dbtype}-dropdb.sh . /usr/share/wwwconfig-common/${dbtype}-dropdb.sh
fi fi
...@@ -84,36 +104,50 @@ case "$1" in ...@@ -84,36 +104,50 @@ case "$1" in
rm -rf /etc/dolibarr rm -rf /etc/dolibarr
# Restart # Restart servers
servers="apache2-ssl apache2 mysql" servers="apache2-ssl apache2 mysql"
if [ -f /usr/share/wwwconfig-common/restart.sh ] ; if [ -f /usr/share/wwwconfig-common/restart.sh ] ;
then then
. /usr/share/wwwconfig-common/restart.sh . /usr/share/wwwconfig-common/restart.sh
else
# Another way to restart
for server in $servers ; do
if [ -x /usr/sbin/invoke-rc.d ]; then
invoke-rc.d $server reload || true
else
/etc/init.d/$server reload || true
fi
done
fi fi
# Remove file and conf file # Remove file and conf file
for dir in /usr/share/dolibarr ; do for dir in /usr/share/dolibarr ; do
if [ -d ${dir} ] ; then rm -rf ${dir} ; fi if [ -d ${dir} ] ; then rm -rf ${dir} ; fi
done done
db_reset "dolibarr/postrm"
db_purge db_purge
;; ;;
remove) remove)
echo "Force remove of /usr/share/dolibarr/htdocs/install" echo "postrm Force remove of /usr/share/dolibarr/htdocs/install"
rm -fr /usr/share/dolibarr/htdocs/install rm -fr /usr/share/dolibarr/htdocs/install
echo "Remove menu entry and image" echo "postrm Remove menu entry and image"
fileorig="/usr/share/applications/dolibarr.desktop" fileorig="/usr/share/applications/dolibarr.desktop"
rm -f $fileorig rm -f $fileorig
fileorig="/usr/share/pixmaps/dolibarr.xpm" fileorig="/usr/share/pixmaps/dolibarr.xpm"
rm -f $fileorig rm -f $fileorig
# Not sure this is usefulle # Not sure this is usefull
if test -x /usr/bin/update-menus; then update-menus; fi if test -x /usr/bin/update-menus; then update-menus; fi
;; ;;
upgrade) upgrade)
;; ;;
failed-upgrade|abort-install|abort-upgrade|disappear) failed-upgrade|abort-install|abort-upgrade|disappear)
;; ;;
*) *)
echo "postrm called with unknown argument \`$1'" >&2 echo "postrm called with unknown argument \`$1'" >&2
exit 0 exit 0
...@@ -122,4 +156,6 @@ esac ...@@ -122,4 +156,6 @@ esac
db_stop db_stop
#DEBHELPER#
exit 0 exit 0
...@@ -96,7 +96,7 @@ Description: Please, insert the DBMS administrator password (if any): ...@@ -96,7 +96,7 @@ Description: Please, insert the DBMS administrator password (if any):
Template: dolibarr/postrm Template: dolibarr/postrm
Type: boolean Type: boolean
Default: true Default: true
Description: Delete *ALL*? Description: Delete database ?
Datas subjected to this question are the DBMS account, the DB and the Do I have to delete also the Dolibarr MySQL database and all its datas
Dolibarr users ang group files. Do I have to delete *ALL* datas whenever (datas subjected to this quetion are the Dolibarr DBMS account and all
the Dolibarr package will be completely removed from the system? Dolibarr tables) ?
...@@ -21,6 +21,8 @@ doc/wiki ...@@ -21,6 +21,8 @@ doc/wiki
document document
documents documents
htdocs/conf/conf.php htdocs/conf/conf.php
htdocs/conf/conf.php.mysql
htdocs/conf/conf.php.postgres
htdocs/avoir htdocs/avoir
htdocs/document htdocs/document
htdocs/documents htdocs/documents
......
...@@ -20,6 +20,8 @@ ...@@ -20,6 +20,8 @@
*/document/* */document/*
*/documents/* */documents/*
*/htdocs/conf/conf.php */htdocs/conf/conf.php
*/htdocs/conf/conf.php.mysql
*/htdocs/conf/conf.php.postgres
*/htdocs/avoir/* */htdocs/avoir/*
*/htdocs/document/* */htdocs/document/*
*/htdocs/documents/* */htdocs/documents/*
......
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