451ab91e |
1 | #!/bin/sh |
2 | # |
3 | # mupen64plus binary bundle uninstall script |
4 | # |
5 | # Copyright 2007-2013 The Mupen64Plus Development Team |
6 | # |
7 | # This program is free software; you can redistribute it and/or |
8 | # modify it under the terms of the GNU General Public License |
9 | # as published by the Free Software Foundation; either version 2 |
10 | # of the License, or (at your option) any later version. |
11 | # |
12 | # This program is distributed in the hope that it will be useful, |
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | # GNU General Public License for more details. |
16 | # |
17 | # You should have received a copy of the GNU General Public License |
18 | # along with this program; if not, write to the Free Software |
19 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
20 | # 02110-1301, USA. |
21 | # |
22 | |
23 | set -e |
24 | |
25 | export PATH=/bin:/usr/bin |
26 | |
27 | usage() |
28 | { |
29 | printf "usage: $(basename $0) [PREFIX] [SHAREDIR] [BINDIR] [LIBDIR] [PLUGINDIR] [MANDIR] |
30 | \tPREFIX - installation directories prefix (default: /usr/local) |
31 | \tSHAREDIR - path to Mupen64Plus shared data files (default: \$PREFIX/share/mupen64plus) |
32 | \tBINDIR - path to Mupen64Plus binary program files (default: \$PREFIX/bin) |
33 | \tLIBDIR - path to Mupen64Plus core library (default: \$PREFIX/lib) |
34 | \tPLUGINDIR - path to Mupen64Plus plugin libraries (default: \$PREFIX/lib/mupen64plus) |
35 | \tMANDIR - path to manual files (default: \$PREFIX/man) |
36 | " |
37 | } |
38 | |
39 | if [ $# -gt 6 ]; then |
40 | usage |
41 | exit 1 |
42 | fi |
43 | |
44 | PREFIX="${1:-/usr/local}" |
45 | SHAREDIR="${2:-${PREFIX}/share/mupen64plus}" |
46 | BINDIR="${3:-${PREFIX}/bin}" |
47 | LIBDIR="${4:-${PREFIX}/lib}" |
48 | PLUGINDIR="${5:-${PREFIX}/lib/mupen64plus}" |
49 | MANDIR="${6:-${PREFIX}/share/man}" |
50 | |
51 | # simple check for some permissions |
52 | if [ -d "${SHAREDIR}" -a ! -w "${SHAREDIR}" ]; then |
53 | printf "Error: you do not have permission to uninstall from: ${SHAREDIR}\nMaybe you need to be root?\n" |
54 | exit 1 |
55 | fi |
56 | if [ -d "${BINDIR}" -a ! -w "${BINDIR}" ]; then |
57 | printf "Error: you do not have permission to uninstall from: ${BINDIR}\nMaybe you need to be root?\n" |
58 | exit 1 |
59 | fi |
60 | if [ -d "${LIBDIR}" -a ! -w "${LIBDIR}" ]; then |
61 | printf "Error: you do not have permission to uninstall from: ${LIBDIR}\nMaybe you need to be root?\n" |
62 | exit 1 |
63 | fi |
64 | if [ -d "${PLUGINDIR}" -a ! -w "${PLUGINDIR}" ]; then |
65 | printf "Error: you do not have permission to uninstall from: ${PLUGINDIR}\nMaybe you need to be root?\n" |
66 | exit 1 |
67 | fi |
68 | if [ -d "${MANDIR}" -a ! -w "${MANDIR}" ]; then |
69 | printf "Error: you do not have permission to uninstall from: ${MANDIR}\nMaybe you need to be root?\n" |
70 | exit 1 |
71 | fi |
72 | |
73 | printf "Uninstalling Mupen64Plus Binary Bundle from ${PREFIX}\n" |
74 | # Mupen64Plus-Core |
75 | rm -f "${LIBDIR}"/libmupen64plus.so* |
76 | /sbin/ldconfig |
77 | rm -f "${SHAREDIR}/font.ttf" |
78 | rm -f "${SHAREDIR}/mupen64plus.cht" |
79 | rm -f "${SHAREDIR}/mupen64plus.ini" |
80 | rm -f "${SHAREDIR}"/doc/* |
81 | # Mupen64Plus-ROM |
82 | rm -f "${SHAREDIR}/m64p_test_rom.v64" |
83 | # Mupen64Plus-UI-Console |
84 | rm -f "${BINDIR}/mupen64plus" |
85 | rm -f "${MANDIR}/man6/mupen64plus.6" |
86 | # Plugins |
87 | rm -f "${PLUGINDIR}/mupen64plus-audio-sdl.so" |
88 | rm -f "${PLUGINDIR}/mupen64plus-input-sdl.so" |
89 | rm -f "${PLUGINDIR}/mupen64plus-rsp-hle.so" |
90 | rm -f "${PLUGINDIR}/mupen64plus-video-rice.so" |
91 | rm -f "${PLUGINDIR}/mupen64plus-video-glide64mk2.so" |
92 | rm -f "${SHAREDIR}/RiceVideoLinux.ini" |
93 | rm -f "${SHAREDIR}/InputAutoCfg.ini" |
94 | rm -f "${SHAREDIR}/Glide64mk2.ini" |
95 | # get rid of the empty dirs |
96 | # ignore directories if they are really symbolic links |
97 | [ ! -L "${SHAREDIR}/doc" ] && rmdir --ignore-fail-on-non-empty "${SHAREDIR}/doc" |
98 | [ ! -L "${SHAREDIR}" ] && rmdir --ignore-fail-on-non-empty "${SHAREDIR}" |
99 | [ ! -L "${BINDIR}" ] && rmdir --ignore-fail-on-non-empty "${BINDIR}" |
100 | [ ! -L "${LIBDIR}" ] && rmdir --ignore-fail-on-non-empty "${LIBDIR}" |
101 | [ ! -L "${PLUGINDIR}" ] && rmdir --ignore-fail-on-non-empty "${PLUGINDIR}" |
102 | [ ! -L "${MANDIR}/man6" ] && rmdir --ignore-fail-on-non-empty "${MANDIR}/man6" |
103 | [ ! -L "${MANDIR}" ] && rmdir --ignore-fail-on-non-empty "${MANDIR}" |
104 | |
105 | printf "Uninstall successful.\n" |
106 | |