Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. #!/bin/sh
  2. # Check the which command exists, and if so make sure it behaves how we want
  3. # it to...
  4. WHICH=`which which 2>/dev/null`
  5. if [ "" = "${WHICH}" ]; then
  6. echo "which command not found. Aborting.";
  7. exit 0;
  8. else
  9. # Solaris sucks
  10. BADWHICH=`which /`
  11. if [ "${BADWHICH}" != "" ]; then
  12. echo "Replacing bad which command.";
  13. # "Which" on solaris gives non-empty results for commands that don't exist
  14. which() {
  15. OUT=`${WHICH} ${1}`
  16. if [ $? -eq 0 ]; then
  17. echo ${OUT}
  18. else
  19. echo ""
  20. fi;
  21. }
  22. fi;
  23. fi
  24. # Find out where we are
  25. BASEDIR=${0%/*}
  26. if [ "${BASEDIR}" = "${0}" ]; then
  27. BASEDIR=`which $0`
  28. BASEDIR=${BASEDIR%/*}
  29. fi
  30. CHECKBASEDIR=`echo "${BASEDIR}" | sed 's#^/##'`
  31. if [ "${CHECKBASEDIR}" = "${BASEDIR}" ]; then
  32. BASEDIR=${PWD}/${BASEDIR}
  33. fi;
  34. if [ ! -e ${BASEDIR}/.uninstall.conf ]; then
  35. echo "No .uninstall.conf found, unable to continue."
  36. exit 1;
  37. else
  38. INSTALLED_AS_ROOT=""
  39. INSTALL_LOCATION=""
  40. . ${BASEDIR}/.uninstall.conf
  41. if [ "${INSTALL_LOCATION}" = "" ]; then
  42. echo "Unable to read .uninstall.conf, unable to continue."
  43. exit 1;
  44. fi;
  45. fi;
  46. PIDOF=`which pidof`
  47. if [ -z "${PIDOF}" ]; then
  48. # For some reason some distros hide pidof...
  49. if [ -e /sbin/pidof ]; then
  50. PIDOF=/sbin/pidof
  51. elif [ -e /usr/sbin/pidof ]; then
  52. PIDOF=/usr/sbin/pidof
  53. fi;
  54. fi;
  55. JAVA=`which java`
  56. if [ -e "${BASEDIR}/functions.sh" ]; then
  57. . ${BASEDIR}/functions.sh
  58. else
  59. echo "Unable to find functions.sh, unable to continue."
  60. exit 1;
  61. fi;
  62. if [ "${INSTALLED_AS_ROOT}" -eq 1 ]; then
  63. USER=`whoami`
  64. if [ "${USER}" != "root" ]; then
  65. errordialog "Uninstaller" "Uninstall Aborted. Only root can use this script"
  66. exit 1;
  67. fi
  68. fi
  69. questiondialog "Uninstaller" "Are you sure you want to uninstall DMDirc?"
  70. if [ $? -ne 0 ]; then
  71. messagedialog "Uninstaller" "Uninstall Aborted."
  72. echo "Uninstall Aborted"
  73. exit 1;
  74. fi
  75. ${JAVA} -jar ${INSTALL_LOCATION}/DMDirc.jar -k
  76. if [ $? -eq 0 ]; then
  77. errordialog "Uninstaller" "Uninstall Aborted - DMDirc is still running. Please close DMDirc before continuing"
  78. echo "Uninstall Aborted - DMDirc already running."
  79. exit 1;
  80. fi
  81. echo "Uninstalling DMDirc"
  82. echo "Removing Shortcuts.."
  83. TOOL=`which gconftool-2`
  84. COMMAND=""
  85. FILENAME=""
  86. if [ "${INSTALLED_AS_ROOT}" -eq 1 ]; then
  87. COMMAND="${TOOL} --config-source=`${TOOL} --get-default-source`"
  88. FILENAME="/usr/share/services/irc.protocol"
  89. rm -Rfv /usr/share/applications/DMDirc.desktop
  90. else
  91. COMMAND="${TOOL}"
  92. FILENAME="${HOME}/.kde/share/services/irc.protocol"
  93. rm -Rfv ${HOME}/.local/share/applications/DMDirc.desktop
  94. rm -Rfv ${HOME}/Desktop/DMDirc.desktop
  95. fi;
  96. if [ "${TOOL}" != "" ]; then
  97. CURRENT=`${COMMAND} --get /desktop/gnome/url-handlers/irc/command`
  98. if [ "${CURRENT}" = "\"${INSTALL_LOCATION}/DMDirc.sh\" -e -c %s" ]; then
  99. echo "Removing Gnome Protocol Handler"
  100. ${COMMAND} --unset /desktop/gnome/url-handlers/irc/enabled
  101. ${COMMAND} --unset /desktop/gnome/url-handlers/irc/command
  102. else
  103. echo "Not Removing Gnome Protocol Handler"
  104. fi
  105. fi
  106. if [ -e "${FILENAME}" ]; then
  107. CURRENT=`grep DMDirc ${FILENAME}`
  108. if [ "" != "${CURRENT}" ]; then
  109. echo "Removing KDE Protocol Handler"
  110. rm -Rfv ${FILENAME}
  111. else
  112. echo "Not Removing KDE Protocol Handler"
  113. fi
  114. fi
  115. echo "Removing Installation Directory"
  116. rm -Rfv ${INSTALL_LOCATION}
  117. PROFILEDIR="${HOME}/.DMDirc"
  118. if [ -e ${PROFILEDIR}/dmdirc.config ]; then
  119. questiondialog "Uninstaller" "A DMDirc profile has been detected (${PROFILEDIR}) Do you want to delete it as well?"
  120. if [ $? -eq 0 ]; then
  121. rm -Rfv "${PROFILEDIR}"
  122. fi
  123. fi
  124. messagedialog "Uninstaller" "DMDirc Uninstalled Successfully"
  125. echo "Done."
  126. exit 0;