diff options
Diffstat (limited to 'rvs.sh')
-rw-r--r-- | rvs.sh | 33 |
1 files changed, 28 insertions, 5 deletions
@@ -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 |