summaryrefslogtreecommitdiff
path: root/rvs.sh
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2009-07-30 12:02:04 -0400
committerLuke Shumaker <lukeshu@sbcglobal.net>2015-06-26 00:30:13 -0600
commit56d4ab21576bcc3049f62374597b7a5f47a560ab (patch)
treecb9fd258c607ee0105ab057e6f05720d938b5e75 /rvs.sh
parent7f78b595ce3baf3ade82e546a3ed7cfba41c8ef9 (diff)
tweak makefiles
Diffstat (limited to 'rvs.sh')
-rw-r--r--rvs.sh33
1 files changed, 28 insertions, 5 deletions
diff --git a/rvs.sh b/rvs.sh
index d020b90..3ac3526 100644
--- a/rvs.sh
+++ b/rvs.sh
@@ -1,5 +1,5 @@
#!@SHELL@
-name='rvs'
+name='@name@'
ver='0.7.0'
# Copyright (C) 2009 Luke Shumaker
# This program is distributed in the hope that it will be useful,
@@ -9,7 +9,7 @@ ver='0.7.0'
#
# Originally written by Luke Shumaker <lukeshu@sbcglobal.net>.
-RVSDIR='@rvsdir@'
+RVSDIR="@libexecdir@/$name"
error() {
echo "$name: $1" >> /dev/stderr
@@ -48,7 +48,7 @@ init() {
export REPO=.rvs/$plugin
echo 'foo2'
if [ -e "$RVSDIR/$plugin/init" ]; then
- $RVSDIR/$plugin/init
+ "$RVSDIR/$plugin/init"
fi
echo 'foo3'
done < $repo/plugins
@@ -57,13 +57,35 @@ init() {
fi
}
+install() {
+ id=$1
+ dir=${2-$id}
+ name=`echo $id | sed 's/-.*$//'`
+ if (grep "^$name-" "$RVSDIR/plugins" &> /dev/null); then
+ # an entry for this plugin already exists, though possibly a
+ # different version
+ sed -i "s/^$name-.*$/$id/" "$RVSDIR/plugins"
+ else
+ echo "$id" >> "$RVSDIR/plugins"
+ fi
+ cp -rp "$dir" "$RVSDIR/$id"
+}
+
+uninstall() {
+ id=$1
+ sed -i "/^$id$/ d" "$RVSDIR/plugins"
+ rm -rf "$RVSDIR/$id"
+}
+
# START OPTION HANDLING #
com=$1;
# END OPTION HANDLING #
case "$com" in
'') error 'no command specified';;
'repo') repo; exit $?;;
- 'init') init;;
+ 'init') init; exit $?;;
+ 'install') shift; install $@; exit $?;;
+ 'uninstall') shift; uninstall $@; exit $?;;
*)
if [ -f "$RVSDIR/$com" ]; then
export RVSDIR
@@ -72,10 +94,11 @@ case "$com" in
else
while read plugin; do
if [ -f "$RVSDIR/$plugin/$com" ]; then
+ done='yes'
export RVSDIR=$RVSDIR/$plugin
export REPO=`repo`/$plugin
$RVSDIR/$@
- done='yes'
+ exit $?
break
fi
done < $REPO/plugins