[pkg-fso-maint] Bug#579215: Bug#579215: Bug#579215: nodm: Please make it a display-manager alternative

Enrico Zini enrico at enricozini.org
Mon May 24 09:49:32 UTC 2010


On Mon, Apr 26, 2010 at 03:13:42PM +0200, Petter Reinholdtsen wrote:

> [Enrico Zini]
> > Makes sense. Is there a standard debconf snipped I can use?
> Great to hear you are willing to add this.  I do not know if there is
> a standard snippet, but assume you can lift something from xdm, kdm or
> gdm. :)

For reference:

xdm:
   # debconf is not a registry, so we only fiddle with the default file if it
   # does not exist
   DEFAULT_DISPLAY_MANAGER_FILE=/etc/X11/default-display-manager
   if ! [ -e "$DEFAULT_DISPLAY_MANAGER_FILE" ]; then
     DEFAULT_DISPLAY_MANAGER=
     if db_get shared/default-x-display-manager; then
       DEFAULT_DISPLAY_MANAGER="$RET"
     fi
     if [ -n "$DEFAULT_DISPLAY_MANAGER" ]; then
       DAEMON_NAME=
       if db_get "$DEFAULT_DISPLAY_MANAGER"/daemon_name; then
         DAEMON_NAME="$RET"
       fi
       if [ -z "$DAEMON_NAME" ]; then
         # if we were unable to determine the name of the selected daemon (for
         # instance, if the selected default display manager doesn't provide a
         # daemon_name question), guess
         DAEMON_NAME=$(which "$DEFAULT_DISPLAY_MANAGER" 2>/dev/null)
         if [ -z "$DAEMON_NAME" ]; then
           warn "unable to determine path to default X display manager" \
                "$DEFAULT_DISPLAY_MANAGER; not updating" \
                "$DEFAULT_DISPLAY_MANAGER_FILE"
         fi
       fi
       if [ -n "$DAEMON_NAME" ]; then
         if [ "$DAEMON_NAME" = "$OLD_DAEMON" ]; then
           DAEMON_NAME="$DAEMON"
         fi
         observe "committing change of default X display manager"
         echo "$DAEMON_NAME" > "$DEFAULT_DISPLAY_MANAGER_FILE"
       fi
     fi
   else
     DEFAULT_DISPLAY_MANAGER=$(cat "$DEFAULT_DISPLAY_MANAGER_FILE")
     if [ "$DEFAULT_DISPLAY_MANAGER" = "$OLD_DAEMON" ]; then
       observe "changing default X display manager from $OLD_DAEMON to $DAEMON"
       echo "$DAEMON" > "$DEFAULT_DISPLAY_MANAGER_FILE"
     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

gdm:
   # 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

kdm:
   # debconf is not a registry, so we only fiddle with the default file if it
   # does not exist
   DEFAULT_DISPLAY_MANAGER_FILE=/etc/X11/default-display-manager
   if [ ! -e "$DEFAULT_DISPLAY_MANAGER_FILE" ]; then
     DEFAULT_DISPLAY_MANAGER=
     if db_get shared/default-x-display-manager; then
       DEFAULT_DISPLAY_MANAGER="$RET"
     fi
     if [ -n "$DEFAULT_DISPLAY_MANAGER" ]; then
       DAEMON_NAME=
       if db_get "$DEFAULT_DISPLAY_MANAGER"/daemon_name; then
         DAEMON_NAME="$RET"
       fi
       if [ ! -n "$DAEMON_NAME" ]; then
         # if we were unable to determine the name of the selected daemon (for
         # instance, if the selected default display manager doesn't provide a
         # daemon_name question), guess
         DAEMON_NAME=$(which "$DEFAULT_DISPLAY_MANAGER" 2>/dev/null)
         if [ ! -n "$DAEMON_NAME" ]; then
           echo .
           # FIXME - redo this part uses shell-lib.sh from xfree86
           #warn "unable to determine path to default X display manager" \
           #     "$DEFAULT_DISPLAY_MANAGER; not updating" \
           #     "$DEFAULT_DISPLAY_MANAGER_FILE"
         fi
       fi
       if [ -n "$DAEMON_NAME" ]; then
         # FIXME - redo this part uses shell-lib.sh from xfree86
         #observe "committing change of default X display manager"
         echo "$DAEMON_NAME" > "$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

They are nontrivial things and I don't like the idea of cargoculting one
of those. They also interact with each other. I'll to see if it can be
standardised a bit first.

My gut feeling is that a shared/something debconf template calls for a
standard bit of script to handle it.


Ciao,

Enrico

-- 
GPG key: 4096R/E7AD5568 2009-05-08 Enrico Zini <enrico at enricozini.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: Digital signature
URL: <http://lists.alioth.debian.org/pipermail/pkg-fso-maint/attachments/20100524/dc9763c4/attachment.pgp>


More information about the pkg-fso-maint mailing list