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.
 
 
 
 
 

68 lines
2.2 KiB

  1. #!/bin/bash
  2. # Debian slim package pre-removal script
  3. # © 2010 Yves-Alexis Perez, using slim script which is
  4. # Copyright 2001 Branden Robinson.
  5. # Licensed under the GNU General Public License, version 2. See the file
  6. # /usr/share/common-licenses/GPL or <http://www.gnu.org/copyleft/gpl.txt>.
  7. # Acknowlegements to Stephen Early, Mark Eichin, and Manoj Srivastava.
  8. set -e
  9. THIS_PACKAGE=slim
  10. DEFAULT_DISPLAY_MANAGER_FILE=/etc/X11/default-display-manager
  11. if [ "$1" = "remove" -o "$1" = "deconfigure" ]; then
  12. if [ -e /usr/share/debconf/confmodule ]; then
  13. . /usr/share/debconf/confmodule
  14. # disown this question
  15. db_unregister shared/default-x-display-manager || true
  16. # does the question still exist?
  17. if db_get shared/default-x-display-manager; then
  18. db_metaget shared/default-x-display-manager owners
  19. db_subst shared/default-x-display-manager choices "$RET"
  20. db_get shared/default-x-display-manager
  21. # are we removing the currently selected display manager?
  22. if [ "$THIS_PACKAGE" = "$RET" ]; then
  23. if [ -e "$DEFAULT_DISPLAY_MANAGER_FILE" ]; then
  24. db_get "$RET"/daemon_name
  25. if [ "$(cat $DEFAULT_DISPLAY_MANAGER_FILE)" = "$RET" ]; then
  26. rm "$DEFAULT_DISPLAY_MANAGER_FILE"
  27. fi
  28. fi
  29. # ask the user to choose a new default
  30. db_fset shared/default-x-display-manager seen false
  31. db_input critical shared/default-x-display-manager || true
  32. db_go
  33. # if the display manager file doesn't exist, write it with the path
  34. # to the new default display manager
  35. if [ ! -e $DEFAULT_DISPLAY_MANAGER_FILE ]; then
  36. db_get shared/default-x-display-manager
  37. echo "Please be sure to run \"dpkg-reconfigure $RET\"."
  38. db_get "$RET"/daemon_name
  39. echo "$RET" > "$DEFAULT_DISPLAY_MANAGER_FILE"
  40. fi
  41. fi
  42. fi
  43. fi
  44. fi
  45. if [ "$1" = "remove" ]; then
  46. if [ -x /etc/init.d/slim ]; then
  47. nostop=
  48. for hostname in "" "localhost" "$(hostname)" "$(hostname -f)"; do
  49. if echo $DISPLAY | grep -q "^$hostname:0.*"; then
  50. nostop=yes
  51. fi
  52. done
  53. if [ -z $nostop ]; then
  54. invoke-rc.d slim stop
  55. fi
  56. fi
  57. fi
  58. update-alternatives --remove desktop-slim-theme /usr/share/slim/themes/default
  59. #DEBHELPER#
  60. exit 0