diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/filecontent/bin/commit.d.sh (renamed from plugins/files/bin/commit.d.sh) | 11 | ||||
-rw-r--r-- | plugins/filecontent/bin/commit.f.sh (renamed from plugins/files/bin/commit.f.sh) | 12 | ||||
-rw-r--r-- | plugins/filecontent/bin/commit.sh (renamed from plugins/files/etc/5-f.sh) | 13 | ||||
-rw-r--r-- | plugins/filecontent/bin/get.d.sh (renamed from plugins/files/bin/get.d.sh) | 2 | ||||
-rw-r--r-- | plugins/filecontent/bin/get.f.sh (renamed from plugins/files/bin/get.f.sh) | 2 | ||||
-rw-r--r-- | plugins/filecontent/bin/gettype.sh (renamed from plugins/files/bin/commit.sh) | 19 | ||||
-rw-r--r-- | plugins/filecontent/bin/init.sh (renamed from plugins/filedata/bin/get.sh) | 6 | ||||
-rw-r--r-- | plugins/filecontent/etc/3-d.sh | 3 | ||||
-rw-r--r-- | plugins/filecontent/etc/5-f.sh | 3 | ||||
-rw-r--r-- | plugins/filecontent/info.mk.in (renamed from plugins/files/info.mk.in) | 2 | ||||
-rw-r--r-- | plugins/filecontent/lib/stdio.sh (renamed from plugins/files/lib/stdio.sh) | 2 | ||||
-rw-r--r-- | plugins/filename/bin/commit.sh (renamed from plugins/filedata/bin/commit.sh) | 15 | ||||
-rw-r--r-- | plugins/filename/bin/get.sh (renamed from plugins/files/bin/get.sh) | 18 | ||||
-rw-r--r-- | plugins/filename/bin/init.sh (renamed from plugins/files/etc/3-d.sh) | 9 | ||||
-rw-r--r-- | plugins/filename/info.mk.in (renamed from plugins/filedata/info.mk.in) | 2 | ||||
-rw-r--r-- | plugins/plugin.mk.in | 3 | ||||
-rw-r--r-- | plugins/users/bin/commit.sh | 29 | ||||
-rw-r--r-- | plugins/users/bin/init.sh | 28 | ||||
-rw-r--r-- | plugins/users/bin/login.sh | 28 | ||||
-rw-r--r-- | plugins/users/bin/logout.sh | 27 | ||||
-rw-r--r-- | plugins/users/bin/mkuser.sh | 29 | ||||
-rw-r--r-- | plugins/users/bin/rmuser.sh | 28 | ||||
-rw-r--r-- | plugins/users/info.mk.in | 3 | ||||
-rw-r--r-- | plugins/users/lib/stdio.sh | 66 |
24 files changed, 68 insertions, 292 deletions
diff --git a/plugins/files/bin/commit.d.sh b/plugins/filecontent/bin/commit.d.sh index f5b432b..0da1efb 100644 --- a/plugins/files/bin/commit.d.sh +++ b/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/plugins/files/bin/commit.f.sh b/plugins/filecontent/bin/commit.f.sh index a86e5b5..726a7e3 100644 --- a/plugins/files/bin/commit.f.sh +++ b/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/plugins/files/etc/5-f.sh b/plugins/filecontent/bin/commit.sh index 975992a..e8db1eb 100644 --- a/plugins/files/etc/5-f.sh +++ b/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 'f'; 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/plugins/files/bin/get.d.sh b/plugins/filecontent/bin/get.d.sh index 46e1eeb..1723d8a 100644 --- a/plugins/files/bin/get.d.sh +++ b/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/plugins/files/bin/get.f.sh b/plugins/filecontent/bin/get.f.sh index e6b79d5..c706931 100644 --- a/plugins/files/bin/get.f.sh +++ b/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/plugins/files/bin/commit.sh b/plugins/filecontent/bin/gettype.sh index 63eaac1..4592ee7 100644 --- a/plugins/files/bin/commit.sh +++ b/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/plugins/filedata/bin/get.sh b/plugins/filecontent/bin/init.sh index 321d5f8..71a2aa8 100644 --- a/plugins/filedata/bin/get.sh +++ b/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/plugins/filecontent/etc/3-d.sh b/plugins/filecontent/etc/3-d.sh new file mode 100644 index 0000000..f169cae --- /dev/null +++ b/plugins/filecontent/etc/3-d.sh @@ -0,0 +1,3 @@ +#!/bin/sh +if [ -d "$1" ]; then echo 'd'; fi + diff --git a/plugins/filecontent/etc/5-f.sh b/plugins/filecontent/etc/5-f.sh new file mode 100644 index 0000000..0506894 --- /dev/null +++ b/plugins/filecontent/etc/5-f.sh @@ -0,0 +1,3 @@ +#!/bin/sh +if [ -f "$1" ]; then echo 'f'; fi + diff --git a/plugins/files/info.mk.in b/plugins/filecontent/info.mk.in index 7552306..eb388c7 100644 --- a/plugins/files/info.mk.in +++ b/plugins/filecontent/info.mk.in @@ -1,3 +1,3 @@ -name = files +name = filecontent ver = 0.9 priority = 0 diff --git a/plugins/files/lib/stdio.sh b/plugins/filecontent/lib/stdio.sh index 9062683..ca4a86a 100644 --- a/plugins/files/lib/stdio.sh +++ b/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/plugins/filedata/bin/commit.sh b/plugins/filename/bin/commit.sh index 9b7f59a..f4fd0f0 100644 --- a/plugins/filedata/bin/commit.sh +++ b/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/plugins/files/bin/get.sh b/plugins/filename/bin/get.sh index 4d0d48f..bc08063 100644 --- a/plugins/files/bin/get.sh +++ b/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/plugins/files/etc/3-d.sh b/plugins/filename/bin/init.sh index 91163dc..71a2aa8 100644 --- a/plugins/files/etc/3-d.sh +++ b/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 'd'; fi +mkdir -p "$REPO/@ID@" + diff --git a/plugins/filedata/info.mk.in b/plugins/filename/info.mk.in index 0746843..3cd3a0d 100644 --- a/plugins/filedata/info.mk.in +++ b/plugins/filename/info.mk.in @@ -1,3 +1,3 @@ -name = filedata +name = filename ver = 0.9 priority = 1 diff --git a/plugins/plugin.mk.in b/plugins/plugin.mk.in index f8a42b4..250f03a 100644 --- a/plugins/plugin.mk.in +++ b/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/plugins/users/bin/commit.sh b/plugins/users/bin/commit.sh deleted file mode 100644 index 1fa2e52..0000000 --- a/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/plugins/users/bin/init.sh b/plugins/users/bin/init.sh deleted file mode 100644 index 142f54c..0000000 --- a/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/plugins/users/bin/login.sh b/plugins/users/bin/login.sh deleted file mode 100644 index 40a5830..0000000 --- a/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/plugins/users/bin/logout.sh b/plugins/users/bin/logout.sh deleted file mode 100644 index 260846e..0000000 --- a/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/plugins/users/bin/mkuser.sh b/plugins/users/bin/mkuser.sh deleted file mode 100644 index 6f72ea9..0000000 --- a/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/plugins/users/bin/rmuser.sh b/plugins/users/bin/rmuser.sh deleted file mode 100644 index 604f359..0000000 --- a/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/plugins/users/info.mk.in b/plugins/users/info.mk.in deleted file mode 100644 index 094f2a5..0000000 --- a/plugins/users/info.mk.in +++ /dev/null @@ -1,3 +0,0 @@ -name = users -ver = 0.9 -priority = 2 diff --git a/plugins/users/lib/stdio.sh b/plugins/users/lib/stdio.sh deleted file mode 100644 index edf7c01..0000000 --- a/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 -} - |