From c86d548be6b69e03f4378c2e8407b6a5fcb666af Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@users.sourceforge.net>
Date: Mon, 1 Aug 2011 18:58:37 +0000
Subject: [PATCH] Work on debian package

---
 build/deb/changelog |  2 +-
 build/deb/config    | 45 +++++++++++++++++++++++++--------------------
 build/deb/postinst  | 12 ++----------
 build/deb/postrm    |  4 +++-
 4 files changed, 31 insertions(+), 32 deletions(-)

diff --git a/build/deb/changelog b/build/deb/changelog
index b035f18ae1d..3382966714b 100644
--- a/build/deb/changelog
+++ b/build/deb/changelog
@@ -4,6 +4,6 @@ dolibarr (3.1.0-1.1) unstable; urgency=low
   * New upstream release.
     closes: bug#634783
     
- -- Laurent Destailleur <eldy@users.sourceforge.net>  Mon, 30 Jul 2011 12:00:00 +0100     
+ -- Dolibarr team <contact@dolibarr.org>  Mon, 30 Jul 2011 12:00:00 +0100     
 
 # For a changelog file dedicated to users, see /usr/share/doc/dolibarr/UserChangeLog.gz file. 
\ No newline at end of file
diff --git a/build/deb/config b/build/deb/config
index fd5ea96491b..553e5ffd7f6 100644
--- a/build/deb/config
+++ b/build/deb/config
@@ -13,25 +13,29 @@ db_version 2.0
 echo Run the dolibarr config 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
+#if [ "$1" = "reconfigure" ] ; then
+#	config="/etc/dolibarr/apache.conf"
+#	if [ -f $config ] ; then
+#		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
+#fi
 # Rotate old configuration
-if [ "$1" = "reconfigure" ] ; then
-	config="/etc/dolibarr/lighttpd.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
+#if [ "$1" = "reconfigure" ] ; then
+#	config="/etc/dolibarr/lighttpd.conf"
+#	if [ -f $config ] ; then
+#		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
+#fi
 
 
 db_capb backup
@@ -39,8 +43,9 @@ db_capb backup
 db_title "dolibarr" || true
 
 
-# Ask for web server type.
-#db_input critical "dolibarr/webserver" || true
+# Ask if we must delete database
+echo "Ask for web server to setup"
+db_input critical dolibarr/reconfigure-webserver || true
 
 if db_go ; then
     okcancel="1"
diff --git a/build/deb/postinst b/build/deb/postinst
index 9f103d8876d..e0bba1be4da 100644
--- a/build/deb/postinst
+++ b/build/deb/postinst
@@ -20,7 +20,7 @@ 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 -s /etc/dolibarr/lighttpd.conf /etc/lighttpd/conf-available/50-dolibarr.conf
+			ln -fs /etc/dolibarr/lighttpd.conf /etc/lighttpd/conf-available/50-dolibarr.conf
 			# We enabled it
 			lighty-enable-mod dolibarr fastcgi-php
 		else
@@ -33,7 +33,7 @@ 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 -s /etc/dolibarr/apache.conf /etc/$webserver/conf.d/dolibarr.conf
+		ln -fs /etc/dolibarr/apache.conf /etc/$webserver/conf.d/dolibarr.conf
 	fi
 }
 
@@ -92,14 +92,6 @@ case "$1" in
 		fi
 
 	
-		# Reconfigure web server
-		db_reset dolibarr/reconfigure-webserver
-		
-		# Ask if we must delete database
-		echo "Ask for web server to setup"
-		db_input critical dolibarr/reconfigure-webserver || true
-		db_go || true
-		
 		db_get dolibarr/reconfigure-webserver
 	
 		webservers="$RET"
diff --git a/build/deb/postrm b/build/deb/postrm
index dd05ee90379..27ce3777b7e 100644
--- a/build/deb/postrm
+++ b/build/deb/postrm
@@ -65,10 +65,12 @@ case "$1" in
 
     # Call when we upgrade
 	upgrade)
+		echo "postrm upgrade"
 	;;
 
     # Call when we uninstall
 	remove)
+		echo "postrm remove"
 		rm -f $lockfile
 
 		# Reconfigure web server
@@ -98,7 +100,7 @@ case "$1" in
 
     # Call when we uninstall and purge
 	purge)
-		echo "postrm purge webservers=$webservers"
+		echo "postrm purge"
 
 		# Ask if we must delete database
 		echo "postrm db_input dolibarr/postrm"
-- 
GitLab