diff --git a/le-proinfodata/package/DEBIAN/control b/le-proinfodata/package/DEBIAN/control index c0379199af1cdb3697833e120ddc1a1d750831da..244fb2ee11d716b10923c7038405134c38eb6fbe 100644 --- a/le-proinfodata/package/DEBIAN/control +++ b/le-proinfodata/package/DEBIAN/control @@ -1,5 +1,5 @@ Package: le-proinfodata -Version: 1.2.40 +Version: 1.2.42 Maintainer: <proinfodata@c3sl.ufpr.br> Architecture: i386 Section: main diff --git a/le-proinfodata/package/DEBIAN/postinst b/le-proinfodata/package/DEBIAN/postinst index b939f36cbd4bd65023ebc42815477be207cdd428..a626daa0c601c3b9e3949fb83681b7cb55ad1c1f 100755 --- a/le-proinfodata/package/DEBIAN/postinst +++ b/le-proinfodata/package/DEBIAN/postinst @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright (C) 2004-2010 Centro de Computacao Cientifica e Software Livre +# Copyright (C) 2004-2014 Centro de Computacao Cientifica e Software Livre # Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR # # This file is part of proinfodata @@ -26,6 +26,28 @@ BACKUP_DIR="/opt/seed_mec_backup" LBFILE="/etc/le-proinfodata/le.zone.bz2" MULTISEAT_DIR="/etc/userful/scripts/PostLogin" +# Set option on lightdm.conf. If the option $1 already exists, make sure it +# has the value $2. If it doesn't exist, add it. +function setLightdmOption() { + local option=$1 + local value=$2 + if ! grep -q "$option" /etc/lightdm/lightdm.conf; then + sed -i "/\[SeatDefaults\]/ a ${option}=${value}" \ + /etc/lightdm/lightdm.conf + else + sed -i "/${option}/ s#=.*#=${value}#" \ + /etc/lightdm/lightdm.conf + fi +} + +# Check whether file $1 was already diverted. +# Return true if it was and false otherwise. +function alreadyDiverted() { + file="$1" + dpkg-divert --listpackage $file | grep -q le-proinfodata + return $? +} + # Descompressing the local base [[ -f $LBFILE ]] && bunzip2 -f $LBFILE @@ -54,15 +76,9 @@ fi # Set lightdm to open the le-proinfodata configuration script when user # session starts if [[ ! -d $MULTISEAT_DIR ]]; then - if ! grep -q "session.*exec_dialog.sh" "/etc/lightdm/lightdm.conf"; then - sed -i '/\[SeatDefaults\]/ a\session-setup-script=/usr/local/bin/exec_dialog.sh' \ - /etc/lightdm/lightdm.conf - fi -else - sed -i '\,session-setup-script=/usr/local/bin/exec_dialog.sh,d' \ - /etc/lightdm/lightdm.conf + setLightdmOption "session-setup-script" "/usr/local/bin/exec_dialog.sh" fi - + # We will no longer need this files, but as the postrm would only remove the # diverts when this package were removed, we have to do it here DIVERTS=" @@ -70,9 +86,7 @@ DIVERTS=" /etc/init/tty1.conf \ " for file in $DIVERTS; do - # Why the heck dpkg-divert doesn't return 'false' if the pattern doesn't - # match on the --list option? - if [ -n "$(dpkg-divert --list $file)" ]; then + if alreadyDiverted $file; then dpkg-divert --package le-proinfodata --remove --rename \ --divert ${file}{.real,} fi