Rev 34336 | Blame | Last modification | View Log | Download | RSS feed
#! /bin/sh## ${R_HOME}/bin/REMOVE for removing add-on packagesrevision='$Rev: 37351 $'version=`set - ${revision}; echo ${2}`version="R add-on package remover ${version}Copyright (C) 2000-2005 The R Core Development Team.This is free software; see the GNU General Public Licence version 2or later for copying conditions. There is NO warranty."usage="Usage: R CMD REMOVE [options] pkgsRemove the add-on packages specified by pkgs. The library tree toremove from can be specified via '--library'. By default, packages areremoved from the library tree rooted at the first directory given in theenvironment variable R_LIBS if this is set and non-null, and from thedefault R library tree (${R_HOME}/library) otherwise.Options:-h, --help print short help message and exit-v, --version print REMOVE version info and exit-l, --library=LIB remove packages from library tree LIBReport bugs to <r-bugs@r-project.org>."GETWD='@GETWD@'if test -n "${R_LIBS}"; thenlib=`echo "${R_LIBS}" | cut -f1 -d:`elselib="${R_HOME}/library"fipkgs=while test -n "${1}"; docase ${1} in-h|--help)echo "${usage}"; exit 0 ;;-v|--version)echo "${version}"; exit 0 ;;-l)lib="${2}"; shift ;;--library=*)lib=`echo "${1}" | sed -e 's/[^=]*=//'` ;;*)pkgs="${pkgs} ${1}" ;;esacshiftdoneif test -z "${pkgs}"; thenecho "ERROR: no packages specified"exit 1fiif test -d "${lib}" -a -w "${lib}"; thenlib=`cd "${lib}" && ${GETWD}`elseecho "ERROR: cannot cd to or remove from directory '${lib}'"exit 2ficd "${lib}"for pkg in ${pkgs}; dopkg=`basename "${pkg}"` # in case someone gave a path ...if test -d "${pkg}"; thenrm -rf "${pkg}"elseecho "WARNING: there is no pkg '${pkg}' in lib '${lib}'"continuefidoneif test "${lib}" = `cd "${R_HOME}/library" && ${GETWD}`; thenecho "tools:::unix.packages.html(.Library, docdir=\"${R_DOC_DIR}\")" | \R_DEFAULT_PACKAGES=NULL LC_ALL=C "${R_HOME}/bin/R" --vanilla >/dev/nullcat "${R_HOME}"/library/*/CONTENTS \> "${R_DOC_DIR}"/html/search/index.txtfi### Local Variables: ***### mode: sh ***### sh-indentation: 2 ***### End: ***