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.

uninstall.sh 2.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. #!/bin/sh
  2. if [ ! -e .uninstall.conf ]; then
  3. echo "No .uninstall.conf found, unable to continue."
  4. exit 1;
  5. else
  6. INSTALLED_AS_ROOT=""
  7. INSTALL_LOCATION=""
  8. . .uninstall.conf
  9. fi;
  10. PIDOF=`which pidof`
  11. if [ -z "${PIDOF}" ]; then
  12. # For some reason some distros hide pidof...
  13. if [ -e /sbin/pidof ]; then
  14. PIDOF=/sbin/pidof
  15. elif [ -e /usr/sbin/pidof ]; then
  16. PIDOF=/usr/sbin/pidof
  17. fi;
  18. fi;
  19. JAVA=`which java`
  20. if [ -e "functions.sh" ]; then
  21. . `dirname $0`/functions.sh
  22. else
  23. echo "Unable to find functions.sh, unable to continue."
  24. exit 1;
  25. fi;
  26. if [ ${INSTALLED_AS_ROOT} -eq 1 ]; then
  27. USER=`whoami`
  28. if [ "${USER}" != "root" ]; then
  29. errordialog "Uninstaller" "Uninstall Aborted. Only root can use this script"
  30. exit 1;
  31. fi
  32. fi
  33. questiondialog "Uninstaller" "Are you sure you want to uninstall DMDirc?"
  34. if [ $? -ne 0 ]; then
  35. messagedialog "Uninstaller" "Uninstall Aborted."
  36. echo "Uninstall Aborted"
  37. exit 1;
  38. fi
  39. ${JAVA} -jar ${INSTALL_LOCATION}/DMDirc.jar -k
  40. if [ $? -eq 0 ]; then
  41. errordialog "Uninstaller" "Uninstall Aborted - DMDirc is still running. Please close DMDirc before continuing"
  42. echo "Uninstall Aborted - DMDirc already running."
  43. exit 1;
  44. fi
  45. echo "Uninstalling DMDirc"
  46. echo "Removing Shortcuts.."
  47. TOOL=`which gconftool-2`
  48. COMMAND=""
  49. FILENAME=""
  50. if [ ${INSTALLED_AS_ROOT} -eq 1 ]; then
  51. COMMAND="${TOOL} --config-source=`${TOOL} --get-default-source`"
  52. FILENAME="/usr/share/services/irc.protocol"
  53. rm -Rfv /usr/share/applications/DMDirc.desktop
  54. else
  55. COMMAND="${TOOL}"
  56. FILENAME="${HOME}/.kde/share/services/irc.protocol"
  57. rm -Rfv ${HOME}/.local/share/applications/DMDirc.desktop
  58. rm -Rfv ${HOME}/Desktop/DMDirc.desktop
  59. fi;
  60. if [ "${TOOL}" != "" ]; then
  61. CURRENT=`${COMMAND} --get /desktop/gnome/url-handlers/irc/command`
  62. if [ "${CURRENT}" = "\"${INSTALL_LOCATION}/DMDirc.sh\" -e -c %s" ]; then
  63. echo "Removing Gnome Protocol Handler"
  64. ${COMMAND} --unset /desktop/gnome/url-handlers/irc/enabled
  65. ${COMMAND} --unset /desktop/gnome/url-handlers/irc/command
  66. else
  67. echo "Not Removing Gnome Protocol Handler"
  68. fi
  69. fi
  70. if [ -e "${FILENAME}" ]; then
  71. CURRENT=`grep DMDirc ${FILENAME}`
  72. if [ "" != "${CURRENT}" ]; then
  73. echo "Removing KDE Protocol Handler"
  74. rm -Rfv ${FILENAME}
  75. else
  76. echo "Not Removing KDE Protocol Handler"
  77. fi
  78. fi
  79. echo "Removing Installation Directory"
  80. rm -Rfv ${INSTALL_LOCATION}
  81. PROFILEDIR="${HOME}/.DMDirc"
  82. if [ -e ${PROFILEDIR}/dmdirc.config ]; then
  83. questiondialog "Uninstaller" "A DMDirc profile has been detected (${PROFILEDIR}) Do you want to delete it as well?"
  84. if [ $? -eq 0 ]; then
  85. rm -Rfv "${PROFILEDIR}"
  86. fi
  87. fi
  88. messagedialog "Uninstaller" "DMDirc Uninstalled Successfully"
  89. echo "Done."
  90. exit 0;