You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

69 lines
1.8 KiB

  1. #! /bin/sh
  2. set -e
  3. . /usr/share/debconf/confmodule
  4. THIS_PACKAGE=slim
  5. DEFAULT_DISPLAY_MANAGER_FILE=/etc/X11/default-display-manager
  6. # debconf is not a registry, so we only fiddle with the default file if it
  7. # does not exist
  8. if [ ! -e "$DEFAULT_DISPLAY_MANAGER_FILE" ]; then
  9. if db_get shared/default-x-display-manager; then
  10. # workaround debconf passthru bug (#379198)
  11. if [ -z "$RET" ]; then
  12. $RET="$THIS_PACKAGE"
  13. fi
  14. if [ "$THIS_PACKAGE" != "$RET" ]; then
  15. echo "Please be sure to run \"dpkg --configure $RET\"."
  16. fi
  17. if db_get "$RET"/daemon_name; then
  18. echo "$RET" > $DEFAULT_DISPLAY_MANAGER_FILE
  19. fi
  20. fi
  21. fi
  22. # remove the displaced old default display manager file if it exists
  23. if [ -e "$DEFAULT_DISPLAY_MANAGER_FILE.dpkg-tmp" ]; then
  24. rm "$DEFAULT_DISPLAY_MANAGER_FILE.dpkg-tmp"
  25. fi
  26. # debconf hangs if slim gets started below without this
  27. db_stop || true
  28. # update-rc.d levels
  29. S=30
  30. K=01
  31. if [ -x /etc/init.d/slim ]; then
  32. update-rc.d slim defaults $S $K >/dev/null 2>&1
  33. fi
  34. if [ "$1" = "configure" ];
  35. then
  36. invoke-rc.d dbus reload || true
  37. fi
  38. DEFAULT_SERVICE=/etc/systemd/system/display-manager.service
  39. # set default-display-manager systemd service link according to our config
  40. if [ "$1" = configure ] && [ -d /etc/systemd/system/ ]; then
  41. if [ -e "$DEFAULT_DISPLAY_MANAGER_FILE" ]; then
  42. SERVICE=/lib/systemd/system/$(basename $(cat "$DEFAULT_DISPLAY_MANAGER_FILE")).service
  43. if [ -h "$DEFAULT_SERVICE" ] && [ $(readlink "$DEFAULT_SERVICE") = /dev/null ]; then
  44. echo "Display manager service is masked" >&2
  45. elif [ -e "$SERVICE" ]; then
  46. ln -sf "$SERVICE" "$DEFAULT_SERVICE"
  47. else
  48. echo "WARNING: $SERVICE is the selected default display manager but does not exist" >&2
  49. rm -f "$DEFAULT_SERVICE"
  50. fi
  51. else
  52. rm -f "$DEFAULT_SERVICE"
  53. fi
  54. fi
  55. #DEBHELPER#
  56. exit 0