summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2009-07-31 23:16:59 -0400
committerLuke Shumaker <lukeshu@sbcglobal.net>2015-06-26 00:30:13 -0600
commit452a7e70ff8d837a1c2ca26642d6a9b18db41a29 (patch)
tree55fcf50033e551172b73d62b3c878bb6ec7ee137
parentf684fcc409532b95ad06087b85106616e915cf18 (diff)
command selection rewritten
-rw-r--r--Makefile.in2
-rw-r--r--plugins/repo/Makefile.in10
-rw-r--r--plugins/users/Makefile.in10
-rw-r--r--rvs.sh45
4 files changed, 33 insertions, 34 deletions
diff --git a/Makefile.in b/Makefile.in
index fd7a2fe..9f7b61e 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -70,7 +70,7 @@ install-$(name) : $(bindir)/$(rvs)
uninstall :
- $(RM) $(prefix)/$(bindir)/rvs
+ $(RM) $(bindir)/$(rvs)
$(RM) -r $(libexecdir)/$(rvs)
clean :
diff --git a/plugins/repo/Makefile.in b/plugins/repo/Makefile.in
index 12fb469..1e07226 100644
--- a/plugins/repo/Makefile.in
+++ b/plugins/repo/Makefile.in
@@ -1,6 +1,6 @@
#!/usr/bin/make -f
name = repo
-# version 0.7.1
+ver = 0.7beta
# Copyright (C) 2009 Luke Shumaker
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -52,7 +52,7 @@ $(name) : $(shOutFiles)
# (un)install ######################################################
install : all
- $(RVS) install $(name) $(myoutdir)
+ $(RVS) install $(name)-$(ver) $(myoutdir)
uninstall :
$(RVS) uninstall $(name)
@@ -71,9 +71,11 @@ b := @
# build shell scripts
$(myoutdir)/% : $(mysrcdir)/%.sh
$(MKDIR) $(dir $@)
- $(SED) 's/$bSHELL@/$(subst /,\/,$(SHELL))/g' <$< > $@
+ $(INSTALL_PROGRAM) $< $@
+ $(SED) -i 's/$bSHELL@/$(subst /,\/,$(SHELL))/g' $@
# workaround... idk why it doesn't match `lib/'
$(myoutdir)/lib/% : $(mysrcdir)/lib/%.sh
$(MKDIR) $(dir $@)
- $(SED) 's/$bSHELL@/$(subst /,\/,$(SHELL))/g' <$< > $@
+ $(INSTALL_PROGRAM) $< $@
+ $(SED) -i 's/$bSHELL@/$(subst /,\/,$(SHELL))/g' $@
diff --git a/plugins/users/Makefile.in b/plugins/users/Makefile.in
index 975d884..b6fe534 100644
--- a/plugins/users/Makefile.in
+++ b/plugins/users/Makefile.in
@@ -1,6 +1,6 @@
#!/usr/bin/make -f
name = users
-# version 0.7.1
+ver = 0.7beta
# Copyright (C) 2009 Luke Shumaker
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -52,7 +52,7 @@ $(name) : $(shOutFiles)
# (un)install ######################################################
install : all
- $(RVS) install $(name) $(myoutdir)
+ $(RVS) install $(name)-$(ver) $(myoutdir)
uninstall :
$(RVS) uninstall $(name)
@@ -71,9 +71,11 @@ b := @
# build shell scripts
$(myoutdir)/% : $(mysrcdir)/%.sh
$(MKDIR) $(dir $@)
- $(SED) 's/$bSHELL@/$(subst /,\/,$(SHELL))/g' <$< > $@
+ $(INSTALL_PROGRAM) $< $@
+ $(SED) -i 's/$bSHELL@/$(subst /,\/,$(SHELL))/g' $@
# workaround... idk why it doesn't match `lib/'
$(myoutdir)/lib/% : $(mysrcdir)/lib/%.sh
$(MKDIR) $(dir $@)
- $(SED) 's/$bSHELL@/$(subst /,\/,$(SHELL))/g' <$< > $@
+ $(INSTALL_PROGRAM) $< $@
+ $(SED) -i 's/$bSHELL@/$(subst /,\/,$(SHELL))/g' $@
diff --git a/rvs.sh b/rvs.sh
index df8560c..9c3b7ac 100644
--- a/rvs.sh
+++ b/rvs.sh
@@ -11,12 +11,12 @@ ver='0.7.0'
RVSDIR="@libexecdir@/$name"
-error() {
+_error() {
echo "$name: $1" >> /dev/stderr
exit 1
}
-repo() {
+_repo() {
repo=".$name"
pwd=`pwd`
owd="$pwd"
@@ -29,35 +29,31 @@ repo() {
if [ -e "`pwd`/$repo" ]; then
echo "`pwd`/$repo"
else
- error "no $name repository found" >> /dev/stderr
+ _error "no $name repository found" >> /dev/stderr
fi
cd "$owd"
}
-init() {
- repo=`repo 2> /dev/null`
+_init() {
+ repo=`_repo 2> /dev/null`
if [ -z "$repo" ]; then
repo=".$name"
install -d "$repo"
install -T $RVSDIR/plugins $repo/plugins
while read plugin; do
echo "initializing plugin \`$plugin'"
- echo 'foo0'
install -d "$repo/$plugin"
- echo 'foo1'
export REPO=.rvs/$plugin
- echo 'foo2'
if [ -e "$RVSDIR/$plugin/init" ]; then
"$RVSDIR/$plugin/init"
fi
- echo 'foo3'
done < $repo/plugins
else
- error "repository already exists at \`$repo'"
+ _error "repository already exists at \`$repo'"
fi
}
-install() {
+_install() {
id=$1
dir=${2-$id}
name=`echo $id | sed 's/-.*$//'`
@@ -71,7 +67,7 @@ install() {
cp -rp "$dir" "$RVSDIR/$id"
}
-uninstall() {
+_uninstall() {
id=$1
sed -i "/^$id$/ d" "$RVSDIR/plugins"
rm -rf "$RVSDIR/$id"
@@ -81,30 +77,29 @@ uninstall() {
com=$1;
# END OPTION HANDLING #
case "$com" in
- '') error 'no command specified';;
+ '') _error 'no command specified';;
# 'repo') repo; exit $?;;
- 'init') init; exit $?;;
- 'install') shift; install $@; exit $?;;
- 'uninstall') shift; uninstall $@; exit $?;;
- *)
- if [ -f "$RVSDIR/$com" ]; then
- export RVSDIR
- $RVSDIR/$@
- done='yes'
- else
+ 'init') _init; exit $?;;
+ 'install') shift; _install $@; exit $?;;
+ 'uninstall') shift; _uninstall $@; exit $?;;
+ *) repo=`_repo`
+ if exit $?; then
while read plugin; do
if [ -f "$RVSDIR/$plugin/$com" ]; then
done='yes'
export RVSDIR=$RVSDIR/$plugin
- export REPO=`repo`/$plugin
+ export REPO=$repo/$plugin
+ echo $RVSDIR/$@
$RVSDIR/$@
exit $?
break
fi
- done < $REPO/plugins
+ done < $repi/plugins
+ else
+ exit 1;
fi
if [ "$done" != 'yes' ]; then
- error "unrecognized command \`$com'"
+ _error "unrecognized command \`$com'"
fi
:;;
esac