DRC | 6533b6e | 2010-02-15 14:57:18 +0000 | [diff] [blame] | 1 | -- Copyright (C)2010 D. R. Commander |
| 2 | -- Copyright (C)2009 Sun Microsystems, Inc. |
| 3 | -- |
| 4 | -- This library is free software and may be redistributed and/or modified under |
| 5 | -- the terms of the wxWindows Library License, Version 3.1 or (at your option) |
| 6 | -- any later version. The full license is in the LICENSE.txt file included |
| 7 | -- with this distribution. |
| 8 | -- |
| 9 | -- This library is distributed in the hope that it will be useful, |
| 10 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | -- wxWindows Library License for more details. |
| 13 | |
| 14 | set disk to (path to startup disk) as string |
| 15 | set tmpfile to path to temporary items from user domain |
| 16 | set tmpfile to POSIX path of tmpfile & "libjpeg-turbo_uninstall.log" |
| 17 | set uninstaller to disk & "opt:libjpeg-turbo:bin:uninstall" |
| 18 | set uninstaller to "sh " & POSIX path of uninstaller & " 2>&1 >" & tmpfile |
| 19 | set success to 0 |
| 20 | |
| 21 | display dialog "You are about to uninstall libjpeg-turbo. Proceed?" buttons {"Yes", "No"} default button "No" |
| 22 | |
| 23 | if button returned of result is "Yes" then |
| 24 | try |
| 25 | do shell script (uninstaller) with administrator privileges |
| 26 | set success to 1 |
| 27 | on error errstr number errnum |
| 28 | if errnum is -128 then |
| 29 | display dialog "Uninstall aborted." buttons {"OK"} |
| 30 | else if errnum is 255 then |
| 31 | set errmsg to "The uninstall script could not remove some of the files or directories installed by the libjpeg-turbo package. Consult:" & return & return & tmpfile & return & return & "for more details." |
| 32 | display dialog errmsg buttons {"OK"} default button "OK" with icon caution |
| 33 | else if errnum is 127 then |
| 34 | display dialog "Could not find the libjpeg-turbo uninstall script. The libjpeg-turbo package may have already been uninstalled." buttons {"OK"} default button "OK" with icon stop |
| 35 | else |
| 36 | set errmsg to "ERROR " & errnum & ": " & errstr |
| 37 | display dialog errmsg buttons {"OK"} default button "OK" with icon stop |
| 38 | end if |
| 39 | end try |
| 40 | if success is 1 then |
| 41 | display dialog "libjpeg-turbo has been successfully uninstalled." buttons {"OK"} |
| 42 | end if |
| 43 | else |
| 44 | display dialog "Uninstall aborted." buttons {"OK"} |
| 45 | end if |