summaryrefslogtreecommitdiff
path: root/src/core/plugins.d
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/plugins.d')
-rw-r--r--src/core/plugins.d/repo/commit.d.sh23
-rw-r--r--src/core/plugins.d/repo/commit.f.sh24
-rw-r--r--src/core/plugins.d/repo/commit.sh51
-rw-r--r--src/core/plugins.d/repo/get.d.sh30
-rw-r--r--src/core/plugins.d/repo/get.f.sh20
-rw-r--r--src/core/plugins.d/repo/get.sh32
-rw-r--r--src/core/plugins.d/repo/lib/stdio.sh58
-rw-r--r--src/core/plugins.d/users/mkuser.sh24
-rw-r--r--src/core/plugins.d/users/rmuser.sh14
9 files changed, 276 insertions, 0 deletions
diff --git a/src/core/plugins.d/repo/commit.d.sh b/src/core/plugins.d/repo/commit.d.sh
new file mode 100644
index 0000000..5b2d3fd
--- /dev/null
+++ b/src/core/plugins.d/repo/commit.d.sh
@@ -0,0 +1,23 @@
+#!$$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>.
+
+# commit.d DIRNAME
+dir="$1"
+
+tmp=`tempfile`
+for file in $dir/*; do
+ hash=`rvs commit "$file"`
+ echo "$file:$hash" >> "$tmp"
+done
+
+rvs commit.f "$tmp"
+rm "$tmp"
+
diff --git a/src/core/plugins.d/repo/commit.f.sh b/src/core/plugins.d/repo/commit.f.sh
new file mode 100644
index 0000000..915ba3c
--- /dev/null
+++ b/src/core/plugins.d/repo/commit.f.sh
@@ -0,0 +1,24 @@
+#!$$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"
+source "$RVSDIR/lib/rvsdb"
+
+# commit.f FILENAME
+file="$1"
+
+#hash=`md5sum $file | sed "s/ .*$//"`
+hash=`sha1sum $file | sed "s/ .*$//"`
+if [ ! -f "`rvs repo`/files/$hash" ]; then
+ install -m 644 -o $USER -g $USER -T "$file" "`rvs repo`/files/$hash"
+fi
+echo "$hash"
+
diff --git a/src/core/plugins.d/repo/commit.sh b/src/core/plugins.d/repo/commit.sh
new file mode 100644
index 0000000..0c8cfc5
--- /dev/null
+++ b/src/core/plugins.d/repo/commit.sh
@@ -0,0 +1,51 @@
+#!$$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
+if [ $# -gt 0 ]; then
+ file="$1"
+else
+ file='.'
+fi
+
+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 ]; type='D'; # door (Solaris only)
+# END file type list
+else error "could not identify file type of \`$file'"
+fi
+
+ret=`rvs "commit.$type" "$file"`
+
+tmp=`tempfile`
+cat << __EOF__ > "$tmp"
+name:$file
+hash:$ret
+type:$type
+author:$user
+owner:$owner
+license:$license
+__EOF__
+
+rvs commit.f "$tmp"
+rm "$tmp"
+
diff --git a/src/core/plugins.d/repo/get.d.sh b/src/core/plugins.d/repo/get.d.sh
new file mode 100644
index 0000000..2443850
--- /dev/null
+++ b/src/core/plugins.d/repo/get.d.sh
@@ -0,0 +1,30 @@
+#!$$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"
+source "$RVSDIR/lib/rvsdb"
+
+# get.d ID DIRNAME
+id="$1"
+dir="$2"
+
+tmp=`tempfile`
+rvs get.f `logread "$db" 'hash'` "$tmp"
+
+mkdir "$dir"
+while read line; do
+ hash=`echo "$line" | sed 's/^.*://'`
+ name=`echo "$line" | sed "s/:$hash$//"`
+ rvs get "$dir/$file"
+done < "$tmp"
+
+rm "$tmp"
+
diff --git a/src/core/plugins.d/repo/get.f.sh b/src/core/plugins.d/repo/get.f.sh
new file mode 100644
index 0000000..e631a1f
--- /dev/null
+++ b/src/core/plugins.d/repo/get.f.sh
@@ -0,0 +1,20 @@
+#!$$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"
+source "$RVSDIR/lib/rvsdb"
+
+# get.f ID FILENAME
+id="$1"
+file="$2"
+
+cp "`rvs repo`/files/$id" "$file"
+
diff --git a/src/core/plugins.d/repo/get.sh b/src/core/plugins.d/repo/get.sh
new file mode 100644
index 0000000..4317c40
--- /dev/null
+++ b/src/core/plugins.d/repo/get.sh
@@ -0,0 +1,32 @@
+#!$$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"
+source "$RVSDIR/lib/rvsdb"
+
+# get ID [FILE]
+id="$1"
+
+if [ $# -gt 1 ]; then
+ file="$2"
+fi
+
+tmp=`tempfile`
+rvs get.f "$id" "$tmp"
+type=`logread "$tmp" 'type'`
+if [ $# -gt 1 ]; then
+ file="$2"
+else
+ file=`logread "$tmp" 'name'`
+fi
+
+rvs "get.$type" "$id" "$file"
+
diff --git a/src/core/plugins.d/repo/lib/stdio.sh b/src/core/plugins.d/repo/lib/stdio.sh
new file mode 100644
index 0000000..e6ef31a
--- /dev/null
+++ b/src/core/plugins.d/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
+}
+
+error() {
+ warn "$1"
+ cat << __error__ >> /dev/stderr
+Usage: $name $usage
+
+Try \`$name --help\' for more options.
+__error__
+ exit 1
+}
+
+fatal () {
+ warn "$1"
+ 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/src/core/plugins.d/users/mkuser.sh b/src/core/plugins.d/users/mkuser.sh
new file mode 100644
index 0000000..74c8a77
--- /dev/null
+++ b/src/core/plugins.d/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__ > "`rvs repo`/users/$author"
+author:$author
+owner:$owner
+license:$license
+__EOF__
+
diff --git a/src/core/plugins.d/users/rmuser.sh b/src/core/plugins.d/users/rmuser.sh
new file mode 100644
index 0000000..82a71c5
--- /dev/null
+++ b/src/core/plugins.d/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 "`rvs repo`/users/$uname"
+