Hello,
thanks for maintaining greetd on Debian :)
(this is roughly the equivalent of #1023982, for sysvinit and other
inits that use the DEFAULT_DISPLAY_MANAGER variable like runit)
while testing the sysvinit script I noticed that it checks for
$DEFAULT_DISPLAY_MANAGER (like each other sysv script for a display
manager in Debian) but there is no debconf question on install that
asks for the default default display manager.
As a result:
if greetd is the only one/first display manager installed on the
system the /etc/X11/default-display-manager file is not found and greetd
starts;
if another display manager is/was installed, /etc/X11/default-display-manager
file is found and is either empty or has the path for another display manager
and greetd is not started.
The workaround is to echo /usr/sbin/greetd > /etc/X11/default-display-manager
but that is not how this mechanism is supposed to work; for comparison other
display manager have a debconf question on install that ask for the desired default
dm among a list (and writes the path in the file).
this is a mechanism intended to prevent the start of two dm at the same time.
I don't have a proper patch, but I think roughly:
* add a dependency on debconf (>=0.5) | debconf-2.0
* add a template, debian/greetd.templates (just copy the one from
lightdm or sddm, changing the name and path to greetd)
* add code to handle the debconf question in postinst
* add code to for debconf to remove greetd from the list of
available dm in prerm
all other dm handle this in a similar way, I'm attaching lightdm
postinst and prerm debconf snippets as example
Thanks,
Lorenzo
---postinst---
THIS_PACKAGE=lightdm #NOTE should be changed to greetd
DEFAULT_DISPLAY_MANAGER_FILE=/etc/X11/default-display-manager
# debconf is not a registry, so we only fiddle with the default file if it
# does not exist
if [ ! -e "$DEFAULT_DISPLAY_MANAGER_FILE" ]; then
if db_get shared/default-x-display-manager; then
# workaround debconf passthru bug (#379198)
if [ -z "$RET" ]; then
$RET="$THIS_PACKAGE"
fi
if [ "$THIS_PACKAGE" != "$RET" ]; then
echo "Please be sure to run \"dpkg --configure $RET\"."
fi
if db_get "$RET"/daemon_name; then
echo "$RET" > $DEFAULT_DISPLAY_MANAGER_FILE
fi
fi
fi
# remove the displaced old default display manager file if it exists
if [ -e "$DEFAULT_DISPLAY_MANAGER_FILE.dpkg-tmp" ]; then
rm "$DEFAULT_DISPLAY_MANAGER_FILE.dpkg-tmp"
fi
# debconf hangs if lightdm gets started below without this
db_stop || true
----------
---prerm---
THIS_PACKAGE=lightdm #NOTE should be changed to greetd
DEFAULT_DISPLAY_MANAGER_FILE=/etc/X11/default-display-manager
if [ "$1" = "remove" -o "$1" = "deconfigure" ]; then
if [ -e /usr/share/debconf/confmodule ]; then
. /usr/share/debconf/confmodule
# disown this question
db_unregister shared/default-x-display-manager || true
# does the question still exist?
if db_get shared/default-x-display-manager; then
db_metaget shared/default-x-display-manager owners
db_subst shared/default-x-display-manager choices "$RET"
db_get shared/default-x-display-manager
# are we removing the currently selected display manager?
if [ "$THIS_PACKAGE" = "$RET" ]; then
if [ -e "$DEFAULT_DISPLAY_MANAGER_FILE" ]; then
db_get "$RET"/daemon_name
if [ "$(cat $DEFAULT_DISPLAY_MANAGER_FILE)" = "$RET" ]; then
rm "$DEFAULT_DISPLAY_MANAGER_FILE"
fi
fi
# ask the user to choose a new default
db_fset shared/default-x-display-manager seen false
db_input critical shared/default-x-display-manager || true
db_go
# if the display manager file doesn't exist, write it with the path
# to the new default display manager
if [ ! -e $DEFAULT_DISPLAY_MANAGER_FILE ]; then
db_get shared/default-x-display-manager
echo "Please be sure to run \"dpkg-reconfigure $RET\"."
db_get "$RET"/daemon_name
echo "$RET" > "$DEFAULT_DISPLAY_MANAGER_FILE"
fi
fi
fi
fi
fi
--------------------------------