le-proinfodata: Fix session-setup-script option on lightdm

parent 4dc84a28
Package: le-proinfodata
Version: 1.2.40
Version: 1.2.42
Maintainer: <proinfodata@c3sl.ufpr.br>
Architecture: i386
Section: main
......
#!/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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment