Path: blob/master/libmupen64plus/mupen64plus-core/tools/uninstall_binary_bundle.sh
2 views
#!/bin/sh1#2# mupen64plus binary bundle uninstall script3#4# Copyright 2007-2013 The Mupen64Plus Development Team5#6# This program is free software; you can redistribute it and/or7# modify it under the terms of the GNU General Public License8# as published by the Free Software Foundation; either version 29# of the License, or (at your option) any later version.10#11# This program is distributed in the hope that it will be useful,12# but WITHOUT ANY WARRANTY; without even the implied warranty of13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the14# GNU General Public License for more details.15#16# You should have received a copy of the GNU General Public License17# along with this program; if not, write to the Free Software18# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA19# 02110-1301, USA.20#2122set -e2324export PATH=/bin:/usr/bin2526usage()27{28printf "usage: $(basename $0) [PREFIX] [SHAREDIR] [BINDIR] [LIBDIR] [PLUGINDIR] [MANDIR]29\tPREFIX - installation directories prefix (default: /usr/local)30\tSHAREDIR - path to Mupen64Plus shared data files (default: \$PREFIX/share/mupen64plus)31\tBINDIR - path to Mupen64Plus binary program files (default: \$PREFIX/bin)32\tLIBDIR - path to Mupen64Plus core library (default: \$PREFIX/lib)33\tPLUGINDIR - path to Mupen64Plus plugin libraries (default: \$PREFIX/lib/mupen64plus)34\tMANDIR - path to manual files (default: \$PREFIX/man)35"36}3738if [ $# -gt 6 ]; then39usage40exit 141fi4243PREFIX="${1:-/usr/local}"44SHAREDIR="${2:-${PREFIX}/share/mupen64plus}"45BINDIR="${3:-${PREFIX}/bin}"46LIBDIR="${4:-${PREFIX}/lib}"47PLUGINDIR="${5:-${PREFIX}/lib/mupen64plus}"48MANDIR="${6:-${PREFIX}/share/man}"4950# simple check for some permissions51if [ -d "${SHAREDIR}" -a ! -w "${SHAREDIR}" ]; then52printf "Error: you do not have permission to uninstall from: ${SHAREDIR}\nMaybe you need to be root?\n"53exit 154fi55if [ -d "${BINDIR}" -a ! -w "${BINDIR}" ]; then56printf "Error: you do not have permission to uninstall from: ${BINDIR}\nMaybe you need to be root?\n"57exit 158fi59if [ -d "${LIBDIR}" -a ! -w "${LIBDIR}" ]; then60printf "Error: you do not have permission to uninstall from: ${LIBDIR}\nMaybe you need to be root?\n"61exit 162fi63if [ -d "${PLUGINDIR}" -a ! -w "${PLUGINDIR}" ]; then64printf "Error: you do not have permission to uninstall from: ${PLUGINDIR}\nMaybe you need to be root?\n"65exit 166fi67if [ -d "${MANDIR}" -a ! -w "${MANDIR}" ]; then68printf "Error: you do not have permission to uninstall from: ${MANDIR}\nMaybe you need to be root?\n"69exit 170fi7172printf "Uninstalling Mupen64Plus Binary Bundle from ${PREFIX}\n"73# Mupen64Plus-Core74rm -f "${LIBDIR}"/libmupen64plus.so*75/sbin/ldconfig76rm -f "${SHAREDIR}/font.ttf"77rm -f "${SHAREDIR}/mupen64plus.cht"78rm -f "${SHAREDIR}/mupen64plus.ini"79rm -f "${SHAREDIR}"/doc/*80# Mupen64Plus-ROM81rm -f "${SHAREDIR}/m64p_test_rom.v64"82# Mupen64Plus-UI-Console83rm -f "${BINDIR}/mupen64plus"84rm -f "${MANDIR}/man6/mupen64plus.6"85# Plugins86rm -f "${PLUGINDIR}/mupen64plus-audio-sdl.so"87rm -f "${PLUGINDIR}/mupen64plus-input-sdl.so"88rm -f "${PLUGINDIR}/mupen64plus-rsp-hle.so"89rm -f "${PLUGINDIR}/mupen64plus-video-rice.so"90rm -f "${PLUGINDIR}/mupen64plus-video-glide64mk2.so"91rm -f "${SHAREDIR}/RiceVideoLinux.ini"92rm -f "${SHAREDIR}/InputAutoCfg.ini"93rm -f "${SHAREDIR}/Glide64mk2.ini"94# get rid of the empty dirs95# ignore directories if they are really symbolic links96[ ! -L "${SHAREDIR}/doc" ] && rmdir --ignore-fail-on-non-empty "${SHAREDIR}/doc"97[ ! -L "${SHAREDIR}" ] && rmdir --ignore-fail-on-non-empty "${SHAREDIR}"98[ ! -L "${BINDIR}" ] && rmdir --ignore-fail-on-non-empty "${BINDIR}"99[ ! -L "${LIBDIR}" ] && rmdir --ignore-fail-on-non-empty "${LIBDIR}"100[ ! -L "${PLUGINDIR}" ] && rmdir --ignore-fail-on-non-empty "${PLUGINDIR}"101[ ! -L "${MANDIR}/man6" ] && rmdir --ignore-fail-on-non-empty "${MANDIR}/man6"102[ ! -L "${MANDIR}" ] && rmdir --ignore-fail-on-non-empty "${MANDIR}"103104printf "Uninstall successful.\n"105106107108