summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2009-07-26 18:00:01 -0400
committerLuke Shumaker <lukeshu@sbcglobal.net>2015-06-26 00:30:12 -0600
commit13ac989be47ce85bd9776c9787c9dc17ddda92f8 (patch)
tree64960fa93cdd814c0a19a0b9d5d1bedbcccb708f
parentc283a7d4327d7d18620ac97e927d88d5667781a4 (diff)
oops, I forgot to `bzr add' all the moved files :)
-rw-r--r--plugins/repo/Makefile.orig65
-rw-r--r--plugins/repo/commit.d.sh25
-rw-r--r--plugins/repo/commit.f.sh23
-rw-r--r--plugins/repo/commit.sh47
-rw-r--r--plugins/repo/get.d.sh29
-rw-r--r--plugins/repo/get.f.sh19
-rw-r--r--plugins/repo/get.sh24
-rw-r--r--plugins/repo/lib/stdio.sh58
-rw-r--r--plugins/users/init.sh17
-rw-r--r--plugins/users/mkuser.sh24
-rw-r--r--plugins/users/rmuser.sh14
-rw-r--r--rvs.sh107
12 files changed, 452 insertions, 0 deletions
diff --git a/plugins/repo/Makefile.orig b/plugins/repo/Makefile.orig
new file mode 100644
index 0000000..00ffc5f
--- /dev/null
+++ b/plugins/repo/Makefile.orig
@@ -0,0 +1,65 @@
+#!/usr/bin/make -f
+name = repo
+# version 0.7.0
+# 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
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# Originally written by Luke Shumaker <lukeshu@sbcglobal.net>.
+
+
+# Variables ########################################################
+RM ?= rm -f
+CP ?= cp
+INSTALL = install
+MKDIR ?= $(INSTALL) -d #mkdir -p
+INSTALL_PROGRAM ?= $(INSTALL)
+INSTALL_DATA ?= $(INSTALL) -m 644
+
+SHELL ?= @SHELL@
+rvsdir ?= @rvsdir@/rvs
+srcdir ?= @srcdir@
+
+libdir = $(rvsdir)/$(name)
+reldir = plugins/$(name)
+
+VPATH = $(srcdir)/$(reldir)
+
+# phony targets ####################################################
+all : $(name)
+.PHONY : $(name) install clean remove
+.SUFFIXES :
+
+# targets ##########################################################
+srcFiles = $(filter-out %/Makefile.orig,$(shell find $(VPATH)/ -type f))
+shFiles = $(patsubst $(VPATH)/%,%,$(basename $(filter %.sh,$(srcFiles))))
+
+$(name) : $(shFiles)
+#$(name) :
+
+
+# install/clean/remove #############################################
+
+#install :
+
+clean :
+ $(RM) -r ./*
+ $(RM) Makefile
+
+remove :
+ $(RM) -r $(libdir)
+
+# implicit rules ###################################################
+
+# 'build' shell scripts
+% : %.sh
+ $(MKDIR) $(dir $@)
+ $(CP) $< $@
+
+# install
+$(libdir)/% : %
+ $(MKDIR) $(dir $@)
+ $(INSTALL_PROGRAM) $< $@
+
diff --git a/plugins/repo/commit.d.sh b/plugins/repo/commit.d.sh
new file mode 100644
index 0000000..7cfe98a
--- /dev/null
+++ b/plugins/repo/commit.d.sh
@@ -0,0 +1,25 @@
+#!$$SHELL$$
+name='rvs commit.d'
+ver='0.7.0'
+# 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
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# Originally written by Luke Shumaker <lukeshu@sbcglobal.net>.
+
+#source "$RVSDIR/lib/stdio"
+
+# commit.d DIRNAME
+dir="$1"
+
+tmp=`tempfile`
+for file in $dir/*; do
+ hash=`"$RVSDIR/commit" "$file"`
+ echo "$file:$hash" >> "$tmp"
+done
+
+"$RVSDIR/commit.f" "$tmp"
+rm "$tmp"
+
diff --git a/plugins/repo/commit.f.sh b/plugins/repo/commit.f.sh
new file mode 100644
index 0000000..c3a652c
--- /dev/null
+++ b/plugins/repo/commit.f.sh
@@ -0,0 +1,23 @@
+#!$$SHELL$$
+name='rvs commit.f'
+ver='0.7.0'
+# 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
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# Originally written by Luke Shumaker <lukeshu@sbcglobal.net>.
+
+#source "$RVSDIR/lib/stdio"
+
+# commit.f FILENAME
+file="$1"
+
+#hash=`md5sum $file | sed "s/ .*$//"`
+hash=`sha1sum $file | sed "s/ .*$//"`
+if [ ! -f "$REPO/$hash" ]; then
+ install -m 644 -o $USER -g $USER -T "$file" "$REPO/$hash"
+fi
+echo "$hash"
+
diff --git a/plugins/repo/commit.sh b/plugins/repo/commit.sh
new file mode 100644
index 0000000..e5e8eba
--- /dev/null
+++ b/plugins/repo/commit.sh
@@ -0,0 +1,47 @@
+#!$$SHELL$$
+name='rvs commit'
+ver='0.7.0'
+# 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
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# Originally written by Luke Shumaker <lukeshu@sbcglobal.net>.
+
+source "$RVSDIR/lib/stdio"
+
+# commit FILE
+file=${1-.}
+
+warn "$file"
+
+if [ ! -e $file ]; then error "file \`$file' does not exist";
+# START file type list
+elif [ -L $file ]; then type='l'; # symbolic link
+elif [ -b $file ]; then type='b'; # block (buffered) special
+elif [ -c $file ]; then type='c'; # character (unbuffered) special
+elif [ -d $file ]; then type='d'; # directory
+elif [ -p $file ]; then type='p'; # named pipe (FIFO)
+elif [ -f $file ]; then type='f'; # regular file
+elif [ -s $file ]; then type='s'; # socket
+#elif [ -D $file ]; then type='D'; # door (Solaris only)
+# END file type list
+else error "could not identify file type of \`$file'"
+fi
+
+ret=`"$RVSDIR/commit.$type" "$file"`
+
+tmp=`tempfile`
+cat << __EOF__ > "$tmp"
+name:$file
+hash:$ret
+type:$type
+author:$user
+owner:$owner
+license:$license
+__EOF__
+
+"$RVSDIR/commit.f" "$tmp"
+rm "$tmp"
+
diff --git a/plugins/repo/get.d.sh b/plugins/repo/get.d.sh
new file mode 100644
index 0000000..77107c2
--- /dev/null
+++ b/plugins/repo/get.d.sh
@@ -0,0 +1,29 @@
+#!$$SHELL$$
+name='rvs get.d'
+ver='0.7.0'
+# 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
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# Originally written by Luke Shumaker <lukeshu@sbcglobal.net>.
+
+#source "$RVSDIR/lib/stdio"
+
+# get.d ID DIRNAME
+id="$1"
+dir="$2"
+
+tmp=`tempfile`
+"$RVSDIR/get.f" `sed -n 's/^hash://p' "$db"` "$tmp"
+
+mkdir "$dir"
+while read line; do
+ hash=`echo "$line" | sed 's/^.*://'`
+ name=`echo "$line" | sed "s/:$hash$//"`
+ "$RVSDIR/get" "$dir/$file"
+done < "$tmp"
+
+rm "$tmp"
+
diff --git a/plugins/repo/get.f.sh b/plugins/repo/get.f.sh
new file mode 100644
index 0000000..f6ab761
--- /dev/null
+++ b/plugins/repo/get.f.sh
@@ -0,0 +1,19 @@
+#!$$SHELL$$
+name='rvs get.f'
+ver='0.7.0'
+# 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
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# Originally written by Luke Shumaker <lukeshu@sbcglobal.net>.
+
+#source "$RVSDIR/lib/stdio"
+
+# get.f ID FILENAME
+id="$1"
+file="$2"
+
+install -T "$REPO/$id" "$file"
+
diff --git a/plugins/repo/get.sh b/plugins/repo/get.sh
new file mode 100644
index 0000000..e1289f7
--- /dev/null
+++ b/plugins/repo/get.sh
@@ -0,0 +1,24 @@
+#!$$SHELL$$
+name='rvs get'
+ver='0.7.0'
+# 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
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# Originally written by Luke Shumaker <lukeshu@sbcglobal.net>.
+
+#source "$RVSDIR/lib/stdio"
+
+# get ID [FILE]
+id="$1"
+
+tmp=`tempfile`
+"$RVSDIR/get.f" "$id" "$tmp"
+type=`sed -n 's/^type://p' "$tmp"`
+file="${2-`sed -n 's/^name://p' "$tmp"`}"
+
+"$RVSDIR/get.$type" "$id" "$file"
+
+rm "$tmp"
diff --git a/plugins/repo/lib/stdio.sh b/plugins/repo/lib/stdio.sh
new file mode 100644
index 0000000..e20cb7f
--- /dev/null
+++ b/plugins/repo/lib/stdio.sh
@@ -0,0 +1,58 @@
+#!$$SHELL$$
+#name='rvs stdio'
+#ver='0.7.0'
+# 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
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# Originally written by Luke Shumaker <lukeshu@sbcglobal.net>.
+
+verbose() {
+ if [ "$volume" == '-v' ]; then
+ echo $@
+ fi
+}
+
+out() {
+ if [ "$volume" != '-q' ]; then
+ echo $@
+ fi
+}
+
+warn () {
+ echo "$name: $1" >> /dev/stderr
+}
+
+fatal () {
+ warn "$1"
+ exit 1
+}
+
+error() {
+ warn "$1"
+ cat << __error__ >> /dev/stderr
+Usage: $name $usage
+
+Try \`$name --help\' for more options.
+__error__
+ exit 1
+}
+
+version() {
+ echo "$name $ver"
+ if [ "$volume" != '-q' ]; then
+ cat << __disclaimer__
+$name is 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
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Originally written by Luke Shumaker <lukeshu@sbcglobal.net>.
+__disclaimer__
+ fi
+ exit 0
+}
+
diff --git a/plugins/users/init.sh b/plugins/users/init.sh
new file mode 100644
index 0000000..ee570ff
--- /dev/null
+++ b/plugins/users/init.sh
@@ -0,0 +1,17 @@
+#!$$SHELL$$
+name='rvs init'
+ver='0.7.0'
+# 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
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# Originally written by Luke Shumaker <lukeshu@sbcglobal.net>.
+
+cat << __EOF__ > "$repo/Public Domain"
+author:anonymous
+owner:Public Domain
+license:
+__EOF__
+
diff --git a/plugins/users/mkuser.sh b/plugins/users/mkuser.sh
new file mode 100644
index 0000000..594c024
--- /dev/null
+++ b/plugins/users/mkuser.sh
@@ -0,0 +1,24 @@
+#!$$SHELL$$
+name='rvs mkuser'
+ver='0.7.0'
+# 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
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# Originally written by Luke Shumaker <lukeshu@sbcglobal.net>.
+
+read -p 'username: ' author
+read -p 'give copyright to: ' owner
+if [ "$owner" != 'Public Domain' ]; then
+ read -p 'use the license: ' license
+else
+ license=''
+fi
+cat << __EOF__ > "$REPO/$author"
+author:$author
+owner:$owner
+license:$license
+__EOF__
+
diff --git a/plugins/users/rmuser.sh b/plugins/users/rmuser.sh
new file mode 100644
index 0000000..598bae9
--- /dev/null
+++ b/plugins/users/rmuser.sh
@@ -0,0 +1,14 @@
+#!$$SHELL$$
+name='rvs rmuser'
+ver='0.7.0'
+# 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
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# Originally written by Luke Shumaker <lukeshu@sbcglobal.net>.
+
+uname=$1
+rm "$REPO/$uname"
+
diff --git a/rvs.sh b/rvs.sh
new file mode 100644
index 0000000..d26c94d
--- /dev/null
+++ b/rvs.sh
@@ -0,0 +1,107 @@
+#!$$SHELL$$
+name='rvs'
+ver='0.7.0'
+# 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
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# Originally written by Luke Shumaker <lukeshu@sbcglobal.net>.
+
+RVSDIR='$$libdir$$'
+REPO=`$RVSDIR/repo`
+
+error() {
+ echo "$name: $1" >> /dev/stderr
+ exit 1
+}
+
+repo() {
+ repo='.rvs'
+ pwd=`pwd`
+ owd="$pwd"
+
+ while [ "$pwd" != "`pwd`" ] && [ ! -e "`pwd`/$repo" ]; do
+ pwd=`pwd`
+ cd ..
+ done
+
+ if [ -e "`pwd`/$repo" ]; then
+ echo "`pwd`/$repo"
+ else
+ echo "$name: no rvs repository found" >> /dev/stderr
+ exit 1
+ fi
+ cd "$owd"
+}
+
+
+init() {
+ repo=`repo`
+ if [ -z "$repo" ]; then
+ repo='.rvs'
+ install -d "$repo"
+ fi
+
+ if diff -q $RVSDIR/plugins $repo/plugins; then
+ install -T $RVSDIR/plugins $repo/plugins
+ while read plugin; do
+ if [ ! -e "$repo/$plugin" ]; then
+ install -d "$repo/$plugin"
+ if [ -e "$RVSDIR/$plugin/init" ]; then
+ $RVSDIR/$plugin/init
+ fi
+ fi
+ done < $repo/plugins
+ fi
+}
+
+# START OPTION HANDLING #
+com=$1;
+# END OPTION HANDLING #
+case "$com" in
+ '') error 'no command specified';;
+ 'repo') repo;;
+ 'init') init;;
+ *)
+ if [ -f "$RVSDIR/$com" ]; then
+ export RVSDIR
+ $RVSDIR/$@
+ done='yes'
+ else
+ while read plugin; do
+ if [ -f "$RVSDIR/$plugin/$com" ]; then
+ export RVSDIR=$RVSDIR/$plugin
+ export REPO=$REPO/$plugin
+ $RVSDIR/$@
+ done='yes'
+ break
+ fi
+ done < $REPO/plugins
+ fi
+ if [ "$done" != 'yes' ]; then
+ error "unrecognized command \`$com'"
+ fi
+ :;;
+esac
+
+#args=`getopt -n "$name" -o "${sopt}" -l "${lopt}" -- "$@"`
+#if [ $? == 0 ]; then
+# set -- $args
+# while [ $# -gt 0 ]; do
+# case "$1" in
+# -V | --version) mode='version';;
+# -h | -H | -\? | --help) mode='help';;
+#
+# -v | --verbose) volume='-v';;
+# -q | --quiet) volume='-q';;
+#
+# --) shift; break;;
+# esac
+# shift;
+# done
+#else
+# error
+#fi
+