diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/repo/Makefile.orig | 65 | ||||
-rw-r--r-- | plugins/repo/commit.d.sh | 25 | ||||
-rw-r--r-- | plugins/repo/commit.f.sh | 23 | ||||
-rw-r--r-- | plugins/repo/commit.sh | 47 | ||||
-rw-r--r-- | plugins/repo/get.d.sh | 29 | ||||
-rw-r--r-- | plugins/repo/get.f.sh | 19 | ||||
-rw-r--r-- | plugins/repo/get.sh | 24 | ||||
-rw-r--r-- | plugins/repo/lib/stdio.sh | 58 | ||||
-rw-r--r-- | plugins/users/init.sh | 17 | ||||
-rw-r--r-- | plugins/users/mkuser.sh | 24 | ||||
-rw-r--r-- | plugins/users/rmuser.sh | 14 |
11 files changed, 345 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" + |