Skip to content
Snippets Groups Projects
Commit c3779b77 authored by Diego Giovane Pasqualin's avatar Diego Giovane Pasqualin
Browse files

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

parent 4dc84a28
No related branches found
No related tags found
No related merge requests found
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,13 +76,7 @@ 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
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment