-
Notifications
You must be signed in to change notification settings - Fork 315
/
REMOVE.in
62 lines (53 loc) · 1.25 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
#! /bin/sh
# ${R_HOME}/bin/REMOVE for removing add-on packages
# Usage:
# R REMOVE [options] [-l lib] pkg_1 ... pkg_n
VERSION="0.1-0"
USAGE_MSG="Usage: R REMOVE [options] [-l lib] pkg_1 ... pkg_n"
PKGS=
lib=${R_HOME}/library
while test -n "${1}"; do
case ${1} in
-h|--help|-\?)
echo "${USAGE_MSG}"; exit 0 ;;
-V|--version)
echo "${VERSION}"; exit 0 ;;
-l)
lib=${2}; shift ;;
*)
PKGS="${PKGS} ${1}" ;;
esac
shift
done
if test -z "${PKGS}"; then
echo "${USAGE_MSG}"
exit 1
fi
if test -d ${lib} -a -w ${lib}; then
cd ${lib}
lib=`pwd`
else
echo "ERROR: cannot cd to or remove from directory \`${lib}'"
exit 2
fi
for pkg in ${PKGS}; do
if test -d ${pkg}; then
rm -rf ${pkg}
else
echo "Warning: there is no pkg \`${pkg}' in lib \`${lib}'"
continue
fi
done
cat */TITLE > LibIndex 2> /dev/null
NO_PERL5=@NO_PERL5@
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} = ${R_HOME}/library; then
${R_HOME}/bin/build-help --htmllists
cat ${R_HOME}/library/*/CONTENTS > ${R_HOME}/doc/html/search/index.txt
fi