diff options
author | Luke Shumaker <LukeShu@sbcglobal.net> | 2010-03-30 22:03:04 -0600 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2015-06-26 00:30:19 -0600 |
commit | 6cd61746524c1240d8e181e6e3dda70653cea5b2 (patch) | |
tree | 3ab4aaba05fd2628caccd317983e395c529ab467 | |
parent | 3d7506dd73a5785b9f969fff2bea879454e4d709 (diff) |
whoop, should have proably commited a momemnt ago
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | README | 2 | ||||
-rw-r--r-- | rvs/config | 2 | ||||
-rw-r--r-- | rvs/plugins/filecontent/bin/commit.d.sh (renamed from rvs/plugins/files/bin/commit.d.sh) | 11 | ||||
-rw-r--r-- | rvs/plugins/filecontent/bin/commit.f.sh (renamed from rvs/plugins/files/bin/commit.f.sh) | 12 | ||||
-rw-r--r-- | rvs/plugins/filecontent/bin/commit.sh (renamed from rvs/plugins/files/etc/3-d.sh) | 13 | ||||
-rw-r--r-- | rvs/plugins/filecontent/bin/get.d.sh (renamed from rvs/plugins/files/bin/get.d.sh) | 2 | ||||
-rw-r--r-- | rvs/plugins/filecontent/bin/get.f.sh (renamed from rvs/plugins/files/bin/get.f.sh) | 2 | ||||
-rw-r--r-- | rvs/plugins/filecontent/bin/gettype.sh (renamed from rvs/plugins/files/bin/commit.sh) | 19 | ||||
-rw-r--r-- | rvs/plugins/filecontent/bin/init.sh (renamed from rvs/plugins/filedata/bin/get.sh) | 6 | ||||
-rw-r--r-- | rvs/plugins/filecontent/etc/3-d.sh | 3 | ||||
-rw-r--r-- | rvs/plugins/filecontent/etc/5-f.sh | 3 | ||||
-rw-r--r-- | rvs/plugins/filecontent/info.mk.in (renamed from rvs/plugins/files/info.mk.in) | 2 | ||||
-rw-r--r-- | rvs/plugins/filecontent/lib/stdio.sh (renamed from rvs/plugins/files/lib/stdio.sh) | 2 | ||||
-rw-r--r-- | rvs/plugins/filename/bin/commit.sh (renamed from rvs/plugins/filedata/bin/commit.sh) | 15 | ||||
-rw-r--r-- | rvs/plugins/filename/bin/get.sh (renamed from rvs/plugins/files/bin/get.sh) | 18 | ||||
-rw-r--r-- | rvs/plugins/filename/bin/init.sh (renamed from rvs/plugins/files/etc/5-f.sh) | 9 | ||||
-rw-r--r-- | rvs/plugins/filename/info.mk.in (renamed from rvs/plugins/filedata/info.mk.in) | 2 | ||||
-rw-r--r-- | rvs/plugins/plugin.mk.in | 3 | ||||
-rw-r--r-- | rvs/plugins/users/bin/commit.sh | 29 | ||||
-rw-r--r-- | rvs/plugins/users/bin/init.sh | 28 | ||||
-rw-r--r-- | rvs/plugins/users/bin/login.sh | 28 | ||||
-rw-r--r-- | rvs/plugins/users/bin/logout.sh | 27 | ||||
-rw-r--r-- | rvs/plugins/users/bin/mkuser.sh | 29 | ||||
-rw-r--r-- | rvs/plugins/users/bin/rmuser.sh | 28 | ||||
-rw-r--r-- | rvs/plugins/users/info.mk.in | 3 | ||||
-rw-r--r-- | rvs/plugins/users/lib/stdio.sh | 66 | ||||
-rw-r--r-- | rvs/wrapper/rvs.sh | 39 |
28 files changed, 96 insertions, 309 deletions
@@ -48,7 +48,7 @@ distclean-% : % %/ $(RM) -r $<-build/ $(RM) $</COPYING $(RM) $</configure - find $< -name Makefile.in -exec $(RM) '{}' \; + find $</ -name Makefile.in -exec $(RM) '{}' \; complete-% : %/ cp COPYING $< @@ -1,4 +1,4 @@ -#!/usr/bin/less +#!/bin/more Thing(y) 0.1 -- This Hack Is Not GNU (yet?) @@ -3,7 +3,7 @@ _RVS='$(bindir)/$(rvs)' _sysconfdir='$(prefix)/etc/$(rvs)' _BINDIR='$(sysconfdir)/bin' - _TMPDIR='$(sysconfdir)/tmp' + _TMPDIR='/tmp/rvs' _LIBDIR='$(sysconfdir)/lib' _ETCDIR='$(sysconfdir)/etc' vars="$vars name rvs RVS sysconfdir BINDIR TMPDIR LIBDIR ETCDIR" diff --git a/rvs/plugins/files/bin/commit.d.sh b/rvs/plugins/filecontent/bin/commit.d.sh index f5b432b..0da1efb 100644 --- a/rvs/plugins/files/bin/commit.d.sh +++ b/rvs/plugins/filecontent/bin/commit.d.sh @@ -17,19 +17,18 @@ ver=0.9 # along with this program; see the file COPYING. # If not, see <http://www.gnu.org/licenses>. -source "$libexecdir/@ID@/stdio" +. "$LIBDIR/@ID@/stdio" # commit.d DIRNAME -out="$1" -dir="$2" +dir="${1?'usage: commit.d DIRNAME'}" tmp=`mktemp` cd "$dir" for file in *; do - hash=`"$RVS" commit "$file"` - echo "$file:$hash" >> "$tmp" + id=`"$RVS" commit "$file"` + echo "$file:$id" >> "$tmp" done -"$RVS" commit.f "$out" "$tmp" +"$RVS" commit.f "$tmp" d rm "$tmp" diff --git a/rvs/plugins/files/bin/commit.f.sh b/rvs/plugins/filecontent/bin/commit.f.sh index a86e5b5..726a7e3 100644 --- a/rvs/plugins/files/bin/commit.f.sh +++ b/rvs/plugins/filecontent/bin/commit.f.sh @@ -17,16 +17,16 @@ ver=0.9 # along with this program; see the file COPYING. # If not, see <http://www.gnu.org/licenses>. -#source "$libexecdir/@ID@/stdio" +#. "$LIBDIR/@ID@/stdio" # commit.f FILENAME -out="$1" -file="$2" +usage="usage: $RVS commit.f FILENAME [PREFIX]" +file="${1?"$usage"}" +prefix="${2-f}" -#hash=`md5sum $file | sed "s/ .*$//"` hash=`sha1sum $file | sed "s/ .*$//"` if [ ! -f "$REPO/@ID@/$hash" ]; then - install -m 644 -o $USER -g $USER -T "$file" "$REPO/@ID@/$hash" + install -m 644 -o $USER -g $USER -T "$file" "$REPO/@ID@/$prefix/$hash" fi -echo "$hash" >> "$out" +echo "$prefix/$hash" diff --git a/rvs/plugins/files/etc/3-d.sh b/rvs/plugins/filecontent/bin/commit.sh index 91163dc..e8db1eb 100644 --- a/rvs/plugins/files/etc/3-d.sh +++ b/rvs/plugins/filecontent/bin/commit.sh @@ -1,6 +1,6 @@ #!/bin/sh -#name='' -#ver=0.9 +name='rvs filecontent commit' +ver=0.9 # Copyright (C) 2009-2010 Luke Shumaker # # This program is free software; you can redistribute it and/or @@ -17,4 +17,11 @@ # along with this program; see the file COPYING. # If not, see <http://www.gnu.org/licenses>. -if [ -f $file ]; then echo 'd'; fi +. "$LIBDIR/@ID@/stdio" + +# commit FILE +file=${1-.} # take arg1 as the file, default to the current directory + +type=`"$RVS" gettype "$file"` +"$RVS" "commit.$type" "$file" + diff --git a/rvs/plugins/files/bin/get.d.sh b/rvs/plugins/filecontent/bin/get.d.sh index 46e1eeb..1723d8a 100644 --- a/rvs/plugins/files/bin/get.d.sh +++ b/rvs/plugins/filecontent/bin/get.d.sh @@ -17,7 +17,7 @@ ver=0.9 # along with this program; see the file COPYING. # If not, see <http://www.gnu.org/licenses>. -#source "$libexecdir/@ID@/stdio" +#. "$LIBDIR/@ID@/stdio" # get.d ID DIRNAME id="$1" diff --git a/rvs/plugins/files/bin/get.f.sh b/rvs/plugins/filecontent/bin/get.f.sh index e6b79d5..c706931 100644 --- a/rvs/plugins/files/bin/get.f.sh +++ b/rvs/plugins/filecontent/bin/get.f.sh @@ -17,7 +17,7 @@ ver=0.9 # along with this program; see the file COPYING. # If not, see <http://www.gnu.org/licenses>. -#source "$libexecdir/@ID@/stdio" +#. "$LIBDIR/@ID@/stdio" # get.f ID FILENAME id="$1" diff --git a/rvs/plugins/files/bin/commit.sh b/rvs/plugins/filecontent/bin/gettype.sh index 63eaac1..4592ee7 100644 --- a/rvs/plugins/files/bin/commit.sh +++ b/rvs/plugins/filecontent/bin/gettype.sh @@ -1,5 +1,5 @@ #!/bin/sh -name='rvs files commit' +name='rvs filecontent gettype' ver=0.9 # Copyright (C) 2009-2010 Luke Shumaker # @@ -17,19 +17,22 @@ ver=0.9 # along with this program; see the file COPYING. # If not, see <http://www.gnu.org/licenses>. -source "$libexecdir/@ID@/stdio" +. "$LIBDIR/@ID@/stdio" -# commit FILE -file=${1-.} # take arg1 as the file, default to the current directory +usage="usage: $RVS gettype FILE" +file=${1?"$usage"} if [ ! -e "$file" ]; then error "file \`$file' does not exist"; else - foundMod='false'; - for type in select/*; do - if "$type" "$file"; then foundMod='true'; break; fi + type='' + for check in "$ETCDIR/@ID@/"*; do + type=`"$check" "$file"` + if [ -n "$type" ]; then break; fi done - if [ "$foundMod" == 'false' ]; then + if [ -z "$type" ]; then + echo "$type" + else error "cannot handle file type of \`$file'" fi fi diff --git a/rvs/plugins/filedata/bin/get.sh b/rvs/plugins/filecontent/bin/init.sh index 321d5f8..71a2aa8 100644 --- a/rvs/plugins/filedata/bin/get.sh +++ b/rvs/plugins/filecontent/bin/init.sh @@ -1,5 +1,5 @@ #!/bin/sh -name='rvs filedata get' +name='rvs generic init' ver=0.9 # Copyright (C) 2009 Luke Shumaker # @@ -17,7 +17,5 @@ ver=0.9 # along with this program; see the file COPYING. # If not, see <http://www.gnu.org/licenses>. -out="$1" - -echo "yeah, this hasn't been coded yet, sorry!" +mkdir -p "$REPO/@ID@" diff --git a/rvs/plugins/filecontent/etc/3-d.sh b/rvs/plugins/filecontent/etc/3-d.sh new file mode 100644 index 0000000..f169cae --- /dev/null +++ b/rvs/plugins/filecontent/etc/3-d.sh @@ -0,0 +1,3 @@ +#!/bin/sh +if [ -d "$1" ]; then echo 'd'; fi + diff --git a/rvs/plugins/filecontent/etc/5-f.sh b/rvs/plugins/filecontent/etc/5-f.sh new file mode 100644 index 0000000..0506894 --- /dev/null +++ b/rvs/plugins/filecontent/etc/5-f.sh @@ -0,0 +1,3 @@ +#!/bin/sh +if [ -f "$1" ]; then echo 'f'; fi + diff --git a/rvs/plugins/files/info.mk.in b/rvs/plugins/filecontent/info.mk.in index 7552306..eb388c7 100644 --- a/rvs/plugins/files/info.mk.in +++ b/rvs/plugins/filecontent/info.mk.in @@ -1,3 +1,3 @@ -name = files +name = filecontent ver = 0.9 priority = 0 diff --git a/rvs/plugins/files/lib/stdio.sh b/rvs/plugins/filecontent/lib/stdio.sh index 9062683..ca4a86a 100644 --- a/rvs/plugins/files/lib/stdio.sh +++ b/rvs/plugins/filecontent/lib/stdio.sh @@ -43,7 +43,7 @@ error() { cat << __error__ >> /dev/stderr Usage: $name $usage -Try \`$name --help\' for more options. +Try \`$name --help' for more options. __error__ exit 1 } diff --git a/rvs/plugins/filedata/bin/commit.sh b/rvs/plugins/filename/bin/commit.sh index 9b7f59a..f4fd0f0 100644 --- a/rvs/plugins/filedata/bin/commit.sh +++ b/rvs/plugins/filename/bin/commit.sh @@ -1,5 +1,5 @@ #!/bin/sh -name='rvs filedata commit' +name='rvs filename commit' ver=0.9 # Copyright (C) 2009 Luke Shumaker # @@ -17,13 +17,16 @@ ver=0.9 # along with this program; see the file COPYING. # If not, see <http://www.gnu.org/licenses>. -out="$1" -file="$2" -hash="`cat /dev/stdin`" +file="${1-.}" +string="`cat "$TMPDIR/commit/filecontent"`" +type=`echo $string | sed 's/:.*$//'` +hash=`echo $string | sed 's/^.://'` temp=`mktemp` -echo "Hash: $hash" > "$temp" -stat "$file" >> "$temp" +echo "#rvs-filename-0.9" > "$temp" +echo "name:$file" >> "$temp" +echo "type:$type" >> "$temp" +echo "hash:$hash" >> "$temp" meta=`sha1sum "$temp" | sed "s/ .*$//"` if [ ! -f "$REPO/@ID@/$hash" ]; then diff --git a/rvs/plugins/files/bin/get.sh b/rvs/plugins/filename/bin/get.sh index 4d0d48f..bc08063 100644 --- a/rvs/plugins/files/bin/get.sh +++ b/rvs/plugins/filename/bin/get.sh @@ -17,18 +17,16 @@ ver=0.9 # along with this program; see the file COPYING. # If not, see <http://www.gnu.org/licenses>. -source "$libexecdir/@ID@/stdio" +# get ID +usage="usage: $RVS get ID [FILENAME]" +id="${1?"$usage"}" -# get ID [FILE] -id="$1" -tmp=`mktemp` -"$RVS" get.f "$id" "$tmp" -type="`sed -n 's/^type://p' "$tmp"`" -file="${2-`sed -n 's/^name://p' "$tmp"`}" -hash="`sed -n 's/^hash://p' "$tmp"`" +file="$REPO/@ID@/$id" -out "-$type `pwd`/$file" -"$RVS" get.$type "$hash" "$file" + type="`sed -n 's/^type://p' "$file"`" +name="${2-`sed -n 's/^name://p' "$file"`}" + hash="`sed -n 's/^hash://p' "$file"`" +"$RVS" get.$type "$hash" "$name" rm "$tmp" diff --git a/rvs/plugins/files/etc/5-f.sh b/rvs/plugins/filename/bin/init.sh index 975992a..71a2aa8 100644 --- a/rvs/plugins/files/etc/5-f.sh +++ b/rvs/plugins/filename/bin/init.sh @@ -1,7 +1,7 @@ #!/bin/sh -#name='' -#ver=0.9 -# Copyright (C) 2009-2010 Luke Shumaker +name='rvs generic init' +ver=0.9 +# Copyright (C) 2009 Luke Shumaker # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as @@ -17,4 +17,5 @@ # along with this program; see the file COPYING. # If not, see <http://www.gnu.org/licenses>. -if [ -f $file ]; then echo 'f'; fi +mkdir -p "$REPO/@ID@" + diff --git a/rvs/plugins/filedata/info.mk.in b/rvs/plugins/filename/info.mk.in index 0746843..3cd3a0d 100644 --- a/rvs/plugins/filedata/info.mk.in +++ b/rvs/plugins/filename/info.mk.in @@ -1,3 +1,3 @@ -name = filedata +name = filename ver = 0.9 priority = 1 diff --git a/rvs/plugins/plugin.mk.in b/rvs/plugins/plugin.mk.in index f8a42b4..250f03a 100644 --- a/rvs/plugins/plugin.mk.in +++ b/rvs/plugins/plugin.mk.in @@ -28,7 +28,7 @@ dirs += $(sysconfdir) $(BINDIR) $(TMPDIR) $(LIBDIR) $(ETCDIR) rvs = @rvs@ RVS = @RVS@ -id = $(name)-$(ver) +id = $(name) # phony targets #################################################### all : $(name) @@ -86,7 +86,6 @@ $(shOutFiles) : % : %.sh $(INSTALL_PROGRAM) $< $@ $(SED) -i \ -e 's/$bSHELL@/$(subst /,\/,$(SHELL))/g' \ - -e 's/$blibexecdir@/$(subst /,\/,$(libexecdir))/g' \ -e 's/$bID@/$(subst /,\/,$(id))/g' \ $@ diff --git a/rvs/plugins/users/bin/commit.sh b/rvs/plugins/users/bin/commit.sh deleted file mode 100644 index 1fa2e52..0000000 --- a/rvs/plugins/users/bin/commit.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh -name='rvs users commit' -ver=0.9 -# Copyright (C) 2009 Luke Shumaker -# -# This program 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 of the -# License, or (at your option) any later version. -# -# 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. -# -# You should have received a copy of the GNU General Public License -# along with this program; see the file COPYING. -# If not, see <http://www.gnu.org/licenses>. - -source "$libexecdir/@ID@/stdio" - -ret=`$RVS repo-0.7beta/commit $@` -if [ -f "$REPO/@ID@/user" ]; then - cp "$REPO/@ID@/user" "$REPO/@ID@/repo/$ret" - echo "$ret" -else - error 'you must be logged in to commit files' -fi - diff --git a/rvs/plugins/users/bin/init.sh b/rvs/plugins/users/bin/init.sh deleted file mode 100644 index 142f54c..0000000 --- a/rvs/plugins/users/bin/init.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh -name='rvs users init' -ver=0.9 -# Copyright (C) 2009 Luke Shumaker -# -# This program 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 of the -# License, or (at your option) any later version. -# -# 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. -# -# You should have received a copy of the GNU General Public License -# along with this program; see the file COPYING. -# If not, see <http://www.gnu.org/licenses>. - -#source "$libexecdir/@ID@/stdio" - -mkdir -p "$REPO/@ID@"/{users,repo} -cat << __EOF__ > "$REPO/@ID@/users/Public Domain" -author:anonymous -owner:Public Domain -license: -__EOF__ - diff --git a/rvs/plugins/users/bin/login.sh b/rvs/plugins/users/bin/login.sh deleted file mode 100644 index 40a5830..0000000 --- a/rvs/plugins/users/bin/login.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh -name='rvs users login' -ver=0.9 -# Copyright (C) 2009 Luke Shumaker -# -# This program 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 of the -# License, or (at your option) any later version. -# -# 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. -# -# You should have received a copy of the GNU General Public License -# along with this program; see the file COPYING. -# If not, see <http://www.gnu.org/licenses>. - -source "$libexecdir/@ID@/stdio" - -user="$1" -if [ -f "$REPO/@ID@/users/$user" ]; then - install -m 644 -T "$REPO/@ID@/users/$user" "$REPO/@ID@/../user" -else - error "User \`$user' does not exist" -fi - diff --git a/rvs/plugins/users/bin/logout.sh b/rvs/plugins/users/bin/logout.sh deleted file mode 100644 index 260846e..0000000 --- a/rvs/plugins/users/bin/logout.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -name='rvs users logout' -ver=0.9 -# Copyright (C) 2009 Luke Shumaker -# -# This program 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 of the -# License, or (at your option) any later version. -# -# 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. -# -# You should have received a copy of the GNU General Public License -# along with this program; see the file COPYING. -# If not, see <http://www.gnu.org/licenses>. - -source "$libexecdir/@ID@/stdio" - -if [ -f "$REPO/@ID@/../user" ]; then - rm "$REPO/@ID@/../user" -else - error 'you must be logged in to logout' -fi - diff --git a/rvs/plugins/users/bin/mkuser.sh b/rvs/plugins/users/bin/mkuser.sh deleted file mode 100644 index 6f72ea9..0000000 --- a/rvs/plugins/users/bin/mkuser.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh -name='rvs users mkuser' -ver=0.9 -# 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. - -source "$libexecdir/@ID@/stdio" - -author="$1" -touch "$REPO/@ID@/users/$author" -cat << __EOF__ > "$REPO/@ID@/users/$author" -author:$author -__EOF__ - diff --git a/rvs/plugins/users/bin/rmuser.sh b/rvs/plugins/users/bin/rmuser.sh deleted file mode 100644 index 604f359..0000000 --- a/rvs/plugins/users/bin/rmuser.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh -name='rvs users rmuser' -ver=0.9 -# Copyright (C) 2009 Luke Shumaker -# -# This program 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 of the -# License, or (at your option) any later version. -# -# 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. -# -# You should have received a copy of the GNU General Public License -# along with this program; see the file COPYING. -# If not, see <http://www.gnu.org/licenses>. - -source "$libexecdir/@ID@/stdio" - -user="$1" -if [ -f "$REPO/@ID@/users/$user" ]; then - rm "$REPO/@ID@/users/$user" -else - error "User \`$user' does not exist" -fi - diff --git a/rvs/plugins/users/info.mk.in b/rvs/plugins/users/info.mk.in deleted file mode 100644 index 094f2a5..0000000 --- a/rvs/plugins/users/info.mk.in +++ /dev/null @@ -1,3 +0,0 @@ -name = users -ver = 0.9 -priority = 2 diff --git a/rvs/plugins/users/lib/stdio.sh b/rvs/plugins/users/lib/stdio.sh deleted file mode 100644 index edf7c01..0000000 --- a/rvs/plugins/users/lib/stdio.sh +++ /dev/null @@ -1,66 +0,0 @@ -#!/bin/sh -#name='rvs users stdio' -#ver=0.9 -# Copyright (C) 2009 Luke Shumaker -# -# This program 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 of the -# License, or (at your option) any later version. -# -# 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. -# -# You should have received a copy of the GNU General Public License -# along with this program; see the file COPYING. -# If not, see <http://www.gnu.org/licenses>. - -verbose() { - if [ "$volume" == '-v' ]; then - echo $@ >> /dev/stderr - 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/rvs/wrapper/rvs.sh b/rvs/wrapper/rvs.sh index 2e8f4ca..bac92e5 100644 --- a/rvs/wrapper/rvs.sh +++ b/rvs/wrapper/rvs.sh @@ -18,9 +18,9 @@ ver='0.9' # along with this program; see the file COPYING. # If not, see <http://www.gnu.org/licenses>. -export RVS="$0" #RVS="@rvs@" +export RVS="$0" #RVS="@RVS@" export BINDIR="@BINDIR@" -export TMPDIR="@TMPDIR@" + baseTMPDIR="@TMPDIR@" export LIBDIR="@LIBDIR@" export ETCDIR="@ETCDIR@" @@ -39,8 +39,7 @@ _error() { _repo() { repo=".$name" - pwd=`pwd` - owd="$pwd" # old working directory + owd="`pwd`" # old working directory # [----can ascend-----] && [-haven't found repo-] while [ "$pwd" != "`pwd`" ] && [ ! -e "`pwd`/$repo" ]; do @@ -61,25 +60,34 @@ _repo() { # Modules ############################################################ _runcom() { - command=${$1?"usage: rvs runcom COMMAND"}; shift + usage="usage: $RVS runcom COMMAND" + command=${1?"$usage"}; shift + if [ ! -e "$BINDIR/$command" ]; then _error "cannot find command \`$command" else + mkdir -p "$baseTMPDIR" + export TMPDIR=`mktemp -d --tmpdir="$baseTMPDIR"` + if [ -f "$BINDIR/$command" ]; then exec "$BINDIR/$command" $@ | tee "$TMPDIR/$command" elif [ -d "$BINDIR/$command" ]; then + mkdir -p "$TMPDIR/$command" for file in "$BINDIR/$command"/*; do - id=$(echo $file | sed 's/^[0-9]*-//') - exec "$file" $@ | tee "TMPDIR/$command/$id" + id=`basename "$file" | sed 's/^[0-9]*-//'` + "$file" $@ > "$TMPDIR/$command/$id" done + cat "$TMPDIR/$command/$id" else _error "cannot run \`$command'" fi + rm -rf "$TMPDIR" fi } _nextpriority() { - command=${1?"usage: rvs nextpriority COMMAND"} + usage="usage: $RVS nextpriority COMMAND" + command=${1?"$usage"} for file in "$BINDIR/$command"/*; do echo $file | sed 's/^\([0-9]*\)-.*/\1/' done | sort -n | tail -n1 | xargs expr 1 + @@ -92,7 +100,7 @@ _nextpriority() { _init() { REPO=`_repo 2> /dev/null` if [ -z "$REPO" ]; then - export REPO="`pwd`.$name" + export REPO="`pwd`/.$name" install -d "$REPO" _runcom init else @@ -105,9 +113,10 @@ _init() { ################################################################################ _install() { - file=${1?"usage: $RVS install FILE COMMAND ID [PRIORITY]"} - command=${2?"usage: $RVS install FILE COMMAND ID [PRIORITY]"} - id=${3?"usage: $RVS install FILE COMMAND ID [PRIORITY]"} + usage="usage: $RVS install FILE COMMAND ID [PRIORITY]" + file=${1?"$usage"} + command=${2?"$usage"} + id=${3?"$usage"} priority=${4-"`_nextpriority "$command"`"} install -d "$BINDIR/$command" @@ -115,7 +124,8 @@ _install() { } _uninstall() { - command=${1?"usage: $RVS uninstall COMMAND [ID]"} + usage="usage: $RVS uninstall COMMAND [ID]" + command=${1?"$usage"} id=$2 if [ -z "$id" ]; then @@ -139,6 +149,7 @@ com=$1; # END OPTION HANDLING # case "$com" in '') _error 'no command specified';; + repo) _repo; exit $?;; 'init' ) shift; _init $@; exit $?;; 'install') shift; _install $@; exit $?;; 'uninstall') shift; _uninstall $@; exit $?;; @@ -149,7 +160,7 @@ case "$com" in _runcom $@ exit $? else - _error 'cannot find an existing repository' + exit 1 fi :;; esac |