le-greeter: Only divert files when needed

Signed-off-by: 's avatarDiego Giovane Pasqualin <dpasqualin@c3sl.ufpr.br>
parent 16e40001
Package: le-greeter
Priority: important
Section: main
Version: 0.1.37
Version: 0.1.38
Maintainer: LE Maintainer <le-maintainer@c3sl.ufpr.br>
Description: Login screen theme and configurations for Linux Educacional 5.0
Architecture: i386
......
......@@ -24,17 +24,29 @@
RMDIVERTS="/etc/lightdm/lightdm.conf"
DIVERTS="/usr/sbin/guest-account"
# 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-greeter
return $?
}
# Remove diverts made from previous versions of le-greeter (<0.1.36)
for file in $RMDIVERTS; do
dpkg-divert --remove ${file}
if test -e ${file}.lightdm; then
rm -f ${file}.lightdm
if alreadyDiverted $file; then
dpkg-divert --remove ${file}
if test -e ${file}.lightdm; then
rm -f ${file}.lightdm
fi
fi
done
# Divert files:
for file in $DIVERTS; do
dpkg-divert --divert ${file}.lightdm --rename ${file}
if ! alreadyDiverted $file; then
dpkg-divert --divert ${file}.real --rename ${file}
fi
done
exit 0
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