Added missing launcher
[mupen64plus-pandora.git] / source / mupen64plus-core / tools / uninstall_binary_bundle.sh
CommitLineData
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
23set -e
24
25export PATH=/bin:/usr/bin
26
27usage()
28{
29printf "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
39if [ $# -gt 6 ]; then
40 usage
41 exit 1
42fi
43
44PREFIX="${1:-/usr/local}"
45SHAREDIR="${2:-${PREFIX}/share/mupen64plus}"
46BINDIR="${3:-${PREFIX}/bin}"
47LIBDIR="${4:-${PREFIX}/lib}"
48PLUGINDIR="${5:-${PREFIX}/lib/mupen64plus}"
49MANDIR="${6:-${PREFIX}/share/man}"
50
51# simple check for some permissions
52if [ -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
55fi
56if [ -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
59fi
60if [ -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
63fi
64if [ -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
67fi
68if [ -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
71fi
72
73printf "Uninstalling Mupen64Plus Binary Bundle from ${PREFIX}\n"
74# Mupen64Plus-Core
75rm -f "${LIBDIR}"/libmupen64plus.so*
76/sbin/ldconfig
77rm -f "${SHAREDIR}/font.ttf"
78rm -f "${SHAREDIR}/mupen64plus.cht"
79rm -f "${SHAREDIR}/mupen64plus.ini"
80rm -f "${SHAREDIR}"/doc/*
81# Mupen64Plus-ROM
82rm -f "${SHAREDIR}/m64p_test_rom.v64"
83# Mupen64Plus-UI-Console
84rm -f "${BINDIR}/mupen64plus"
85rm -f "${MANDIR}/man6/mupen64plus.6"
86# Plugins
87rm -f "${PLUGINDIR}/mupen64plus-audio-sdl.so"
88rm -f "${PLUGINDIR}/mupen64plus-input-sdl.so"
89rm -f "${PLUGINDIR}/mupen64plus-rsp-hle.so"
90rm -f "${PLUGINDIR}/mupen64plus-video-rice.so"
91rm -f "${PLUGINDIR}/mupen64plus-video-glide64mk2.so"
92rm -f "${SHAREDIR}/RiceVideoLinux.ini"
93rm -f "${SHAREDIR}/InputAutoCfg.ini"
94rm -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
105printf "Uninstall successful.\n"
106