-
Notifications
You must be signed in to change notification settings - Fork 315
/
REMOVE.in
95 lines (79 loc) · 2.32 KB
/
REMOVE.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#! /bin/sh
#
# ${R_HOME}/bin/REMOVE for removing add-on packages
revision='$Revision: 1.18 $'
version=`set - ${revision}; echo ${2}`
version="R add-on package remover ${version}
Copyright (C) 2000-2002 The R Core Development Team.
This is free software; see the GNU General Public Licence version 2
or later for copying conditions. There is NO warranty."
usage="Usage: R CMD REMOVE [options] pkgs
Remove the add-on packages specified by pkgs. The library tree to
remove from can be specified via '--library'. By default, packages are
removed from the library tree rooted at the first directory given in the
environment variable R_LIBS if this is set and non-null, and from the
default R library tree (${R_HOME}/library) otherwise.
Options:
-h, --help print short help message and exit
-v, --version print version info and exit
-l, --library=LIB remove packages from library tree LIB
Report bugs to <r-bugs@r-project.org>."
GETWD='@GETWD@'
NO_PERL5=@NO_PERL5@
if test -n "${R_LIBS}"; then
lib=`echo "${R_LIBS}" | cut -f1 -d:`
else
lib="${R_HOME}/library"
fi
pkgs=
while test -n "${1}"; do
case ${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}" ;;
esac
shift
done
if test -z "${pkgs}"; then
echo "ERROR: no packages specified"
exit 1
fi
if test -d "${lib}" -a -w "${lib}"; then
lib=`cd "${lib}" && ${GETWD}`
else
echo "ERROR: cannot cd to or remove from directory '${lib}'"
exit 2
fi
cd "${lib}"
for pkg in ${pkgs}; do
pkg=`basename "${pkg}"` # in case someone gave a path ...
if test -d "${pkg}"; then
rm -rf "${pkg}"
else
echo "WARNING: there is no pkg '${pkg}' in lib '${lib}'"
continue
fi
done
if ${NO_PERL5}; then
echo "*** Cannot update the file"
echo "*** ${lib}/index.html"
echo "*** without Perl version 5. Please delete the entries for"
echo "*** the packages you removed manually."
exit 2
fi
if test "${lib}" = `cd "${R_HOME}/library" && ${GETWD}`; then
${R_CMD} perl "${R_HOME}/share/perl/build-help.pl" --htmllists
cat "${R_HOME}"/library/*/CONTENTS \
> "${R_HOME}"/doc/html/search/index.txt
fi
### Local Variables: ***
### mode: sh ***
### sh-indentation: 2 ***
### End: ***