summaryrefslogtreecommitdiff
path: root/wrapper
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2009-09-13 15:20:14 -0400
committerLuke Shumaker <lukeshu@sbcglobal.net>2015-06-26 00:30:15 -0600
commit3e100e9de3cec5ec5e9a641e782ae47ca095233d (patch)
tree4419164e75c32490a96307335a9fd2c80d8161b4 /wrapper
parent3f829bcc56a0dff2ba4ed6e1a1c081b6262fbed9 (diff)
bichun!
fixed makefiles, moved around files The wrapper is now a hybrid shell-C program. A shell script does the integrated commands, but it calls the C program (`$(libexecdir)/rvs/runcom') to launch plugins Note that right now, it does EVERYTHING BUT launch plugins.
Diffstat (limited to 'wrapper')
-rw-r--r--wrapper/Makefile.in26
-rw-r--r--wrapper/TODO4
-rw-r--r--wrapper/runcom.c (renamed from wrapper/rvs.c)7
-rw-r--r--wrapper/rvs.sh110
4 files changed, 140 insertions, 7 deletions
diff --git a/wrapper/Makefile.in b/wrapper/Makefile.in
index 85f56f7..a6eef15 100644
--- a/wrapper/Makefile.in
+++ b/wrapper/Makefile.in
@@ -31,6 +31,7 @@ dirs = $(srcdir) $(prefix) $(exec_prefix) $(bindir) $(sbindir) $(libexecdir)/
#export srcdir prefix exec_prefix bindir sbindir libexecdir
# programs #########################################################
+CC = @CC@
RVS ?= @RVS@
SHELL ?= @SHELL@
RM ?= rm
@@ -43,19 +44,36 @@ INSTALL_DATA ?= $(INSTALL) -m 644
TOUCH ?= touch # This file doesn't use touch
#export RVS SHELL RM CP SED INSTALL MKDIR INSTALL_PROGRAM INSTALL_DATA TOUCH
+CFLAGS = -DLIBEXECDIR=\"$(libexecdir)\" -DPLUGIN_CONF=\"plugin.conf\"
+
# phony targets ####################################################
-all : rvs
-.PHONY : install uninstall clean distclean dist
+all : rvs runcom
+.PHONY : install uninstall clean distclean dist install-runcom
.SUFFIXES : .c .o
VPATH = $(srcdir)/wrapper
# most everything ##################################################
-install : $(RVS)
-$(RVS) : rvs $(bindir)
+RUNCOM = $(libexecdir)/$(rvs)/runcom
+install : $(RVS) $(RUNCOM)
+$(RVS) : rvs $(dir $(RVS))
+ $(INSTALL_PROGRAM) $< $@
+
+$(RUNCOM): runcom $(dir $(RUNCOM))
+ $(INSTALL_PROGRAM) $< $@
+
+b := @
+# build shell scripts
+rvs : rvs.sh
$(INSTALL_PROGRAM) $< $@
+ $(SED) -i \
+ -e 's/$bSHELL@/$(subst /,\/,$(SHELL))/g' \
+ -e 's/$bname@/$(rvs)/g' \
+ -e 's/$blibexecdir@/$(subst /,\/,$(libexecdir))/g' \
+ $@
uninstall :
$(RM) $(RVS)
+ $(RM) $(libexecdir)/$(rvs)/runcom
clean :
diff --git a/wrapper/TODO b/wrapper/TODO
index 577c252..6d1bd2a 100644
--- a/wrapper/TODO
+++ b/wrapper/TODO
@@ -1,6 +1,8 @@
#! /bin/more
-plugin-load.h:
+* add propper option handling via GNU getopt
+* actually launch the plugins
+* plugin-load.h:
The function `load_plugins' must loop through sub-directories in the
directory `libexecdir'. They way it does this is an ugly kludge, and
should be rewritten.
diff --git a/wrapper/rvs.c b/wrapper/runcom.c
index 4f2fa1b..f581a45 100644
--- a/wrapper/rvs.c
+++ b/wrapper/runcom.c
@@ -26,8 +26,8 @@ const char *ver="0.8c";
#include "plugin-find.h"
#include "plugin-depend.h"
-const char *libexecdir="./plugins";
-const char *plugin_conf="plugin.conf";
+const char *libexecdir=LIBEXECDIR;
+const char *plugin_conf=PLUGIN_CONF;
int
main ( int argc, char *argv[] )
@@ -45,3 +45,6 @@ main ( int argc, char *argv[] )
return 0;
}
+/* Copy/Paste Virus 1.3c Please copy and paste this text anywhere. Track *\
+\* its progress by searching for this MD5#f7eac285ebfe21c4587bfebb9582f90d */
+
diff --git a/wrapper/rvs.sh b/wrapper/rvs.sh
new file mode 100644
index 0000000..d7fc753
--- /dev/null
+++ b/wrapper/rvs.sh
@@ -0,0 +1,110 @@
+#!@SHELL@
+name='@name@'
+ver='0.8c'
+# Copyright (C) 2009 Luke Shumaker
+#
+# This file is part of rvs.
+#
+# rvs is free software; you can redistribute it and/or modify it under the
+# terms of the GNU General Public License as published by the Free Software
+# Foundation; either version 2, or (at your option) any later version.
+#
+# rvs is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with rvs; see the file COPYING.
+# If not, write to the Free Software Foundation,
+# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+RVS="$0" #RVS="@rvs@"
+libexecdir="@libexecdir@/$name"
+
+_error() {
+ echo "$name: $1" >> /dev/stderr
+ exit 1
+}
+
+_repo() {
+ repo=".$name"
+ pwd=`pwd`
+ owd="$pwd"
+
+ while [ "$pwd" != "`pwd`" ] && [ ! -e "`pwd`/$repo" ]; do
+ pwd=`pwd`
+ cd ..
+ done
+
+ if [ -e "`pwd`/$repo" ]; then
+ echo "`pwd`/$repo"
+ else
+ _error "no $name repository found"
+ fi
+ cd "$owd"
+}
+
+_init() {
+ repo=`_repo 2> /dev/null`
+ if [ -z "$repo" ]; then
+ repo=".$name"
+ install -d "$repo"
+ install -T $libexecdir/plugins $repo/plugins
+ while read plugin; do
+ echo "initializing plugin \`$plugin'"
+ install -d "$repo/$plugin"
+ export REPO=.rvs/$plugin
+ if [ -e "$libexecdir/$plugin/init" ]; then
+ "$libexecdir/$plugin/init"
+ fi
+ done < $repo/plugins
+ else
+ _error "repository already exists at \`$repo'"
+ fi
+}
+
+_install() {
+ id=$1
+ dir=${2-$id}
+ name=`echo $id | sed 's/-.*$//'`
+ if (grep "^$name-" "$libexecdir/plugins" &> /dev/null); then
+ # an entry for this plugin already exists, though possibly a
+ # different version
+ sed -i "s/^$name-.*$/$id/" "$libexecdir/plugins"
+ else
+ echo "$id" >> "$libexecdir/plugins"
+ fi
+ rm -rf "$libexecdir/$id"
+ cp -rpT "$dir" "$libexecdir/$id"
+}
+
+_uninstall() {
+ id=$1
+ sed -i "/^$id$/ d" "$libexecdir/plugins"
+ rm -rf "$libexecdir/$id"
+}
+
+# START OPTION HANDLING #
+com=$1;
+# END OPTION HANDLING #
+case "$com" in
+ '') _error 'no command specified';;
+ # 'repo') _repo; exit $?;;
+ 'init') _init; exit $?;;
+ 'install') shift; _install $@; exit $?;;
+ 'uninstall') shift; _uninstall $@; exit $?;;
+ *) repo=`_repo`
+ if [ "$?" = '0' ]; then
+ shift
+ $libexecdir/runcom $@
+ exit $?
+ else
+ _error "cannot find an existing repository"
+ fi
+ :;;
+esac
+
+# Copy/Paste Virus 1.3c Please copy and paste this text anywhere. Track
+# its progress by searching for this MD5#f7eac285ebfe21c4587bfebb9582f90d
+