Fix: Error management in debian package

This commit is contained in:
Laurent Destailleur 2011-01-12 01:52:48 +00:00
parent ec52618149
commit 8629549f6d

View File

@ -155,8 +155,8 @@ case "$1" in
then then
if [ -s $conffile ] ; if [ -s $conffile ] ;
then then
echo postrm remove dolibarr include from /etc/dolibarr/apache.conf
# We disable set -e to avoid premature end of script if error # We disable set -e to avoid premature end of script if error
echo postrm remove dolibarr include from /etc/dolibarr/apache.conf
set +e set +e
GREP="Include[[:space:]]\+$includefile\b" GREP="Include[[:space:]]\+$includefile\b"
if grep -e "$GREP" $conffile > /dev/null 2>&1; then if grep -e "$GREP" $conffile > /dev/null 2>&1; then
@ -165,6 +165,7 @@ case "$1" in
grep -v -e "$GREP" < $conffile > $conffile.purg grep -v -e "$GREP" < $conffile > $conffile.purg
mv $conffile.purg $conffile mv $conffile.purg $conffile
fi fi
# We restore blocking errors
set -e set -e
fi fi
fi fi
@ -183,17 +184,29 @@ case "$1" in
else else
# Another way to restart # Another way to restart
for server in $servers ; do for server in $servers ; do
# We disable blocking errors
set +e
echo "Restart server $server if exists"
if [ -x /usr/sbin/invoke-rc.d ]; then if [ -x /usr/sbin/invoke-rc.d ]; then
invoke-rc.d $server reload || true invoke-rc.d $server reload || true
else else
/etc/init.d/$server reload || true /etc/init.d/$server reload || true
fi fi
# We restore blocking errors
set -e
done 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
# We disable blocking errors
set +e
echo "Remove directory $dir"
rm -rf $dir ;
# We restore blocking errors
set -e
fi
done done
db_reset "dolibarr/postrm" db_reset "dolibarr/postrm"