From fc8d2f56a8104e755766fbbca4729906000cf78d Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 3 Aug 2009 19:03:08 -0400 Subject: 0.7.2 -- refactor slightly, flesh out plugin: users --- plugins/users/commit.sh | 21 +++++++++++++++++ plugins/users/init.sh | 6 +++-- plugins/users/lib/stdio.sh | 59 ++++++++++++++++++++++++++++++++++++++++++++++ plugins/users/login.sh | 20 ++++++++++++++++ plugins/users/logout.sh | 19 +++++++++++++++ plugins/users/mkuser.sh | 8 ++++--- plugins/users/rmuser.sh | 14 +++++++---- 7 files changed, 138 insertions(+), 9 deletions(-) create mode 100644 plugins/users/commit.sh create mode 100644 plugins/users/lib/stdio.sh create mode 100644 plugins/users/login.sh create mode 100644 plugins/users/logout.sh (limited to 'plugins/users') diff --git a/plugins/users/commit.sh b/plugins/users/commit.sh new file mode 100644 index 0000000..f272013 --- /dev/null +++ b/plugins/users/commit.sh @@ -0,0 +1,21 @@ +#!@SHELL@ +name='rvs users commit' +ver='0.7.2' +# 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 . + +source "$libexecdir/lib/stdio" + +ret=`$RVS repo-0.7beta/commit $@` +if [ -f "$REPO/user" ]; then + cp "$REPO/user" "$REPO/repo/$ret" + echo "$ret" +else + error 'you must be logged in to commit files' +fi + diff --git a/plugins/users/init.sh b/plugins/users/init.sh index 6d703ec..cdb291c 100644 --- a/plugins/users/init.sh +++ b/plugins/users/init.sh @@ -1,6 +1,6 @@ #!@SHELL@ -name='rvs init' -ver='0.7.0' +name='rvs users init' +ver='0.7.2' # 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 @@ -9,6 +9,8 @@ ver='0.7.0' # # Originally written by Luke Shumaker . +#source "$libexecdir/lib/stdio" + mkdir -p "$REPO"/{users,repo} cat << __EOF__ > "$REPO/users/Public Domain" author:anonymous diff --git a/plugins/users/lib/stdio.sh b/plugins/users/lib/stdio.sh new file mode 100644 index 0000000..cad1b74 --- /dev/null +++ b/plugins/users/lib/stdio.sh @@ -0,0 +1,59 @@ +#!@SHELL@ +#name='rvs users stdio' +#ver='0.7.2' +# 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 . + +verbose() { + if [ "$volume" == '-v' ]; then + echo $@ >> /dev/stderr + fi +} + +out() { + if [ "$volume" != '-q' ]; then + echo $@ >> /dev/stderr + fi +} + +warn () { + echo "$name: $1" >> /dev/stderr + echo "$name: $1" >> "$repo/../rvs.log" +} + +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 . +__disclaimer__ + fi + exit 0 +} + diff --git a/plugins/users/login.sh b/plugins/users/login.sh new file mode 100644 index 0000000..615f4c0 --- /dev/null +++ b/plugins/users/login.sh @@ -0,0 +1,20 @@ +#!@SHELL@ +name='rvs users login' +ver='0.7.2' +# 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 . + +source "$libexecdir/lib/stdio" + +user="$1" +if [ -f "$REPO/users/$user" ]; then + install -m 644 -T "$REPO/users/$user" "$REPO/user" +else + error "User \`$user' does not exist" +fi + diff --git a/plugins/users/logout.sh b/plugins/users/logout.sh new file mode 100644 index 0000000..e3207a6 --- /dev/null +++ b/plugins/users/logout.sh @@ -0,0 +1,19 @@ +#!@SHELL@ +name='rvs users logout' +ver='0.7.2' +# 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 . + +source "$libexecdir/lib/stdio" + +if [ -f "$REPO/user" ]; then + rm "$REPO/user" +else + error 'you must be logged in to logout' +fi + diff --git a/plugins/users/mkuser.sh b/plugins/users/mkuser.sh index f07235b..6de768e 100644 --- a/plugins/users/mkuser.sh +++ b/plugins/users/mkuser.sh @@ -1,6 +1,6 @@ #!@SHELL@ -name='rvs mkuser' -ver='0.7.0' +name='rvs users mkuser' +ver='0.7.2' # 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 @@ -9,6 +9,8 @@ ver='0.7.0' # # Originally written by Luke Shumaker . +source "$libexecdir/lib/stdio" + read -p 'username: ' author echo "$author" read -p 'give copyright to: ' owner @@ -18,7 +20,7 @@ if [ "$owner" != 'Public Domain' ]; then else license='' fi -cat << __EOF__ > "$REPO/$author" +cat << __EOF__ > "$REPO/users/$author" author:$author owner:$owner license:$license diff --git a/plugins/users/rmuser.sh b/plugins/users/rmuser.sh index 85ba64a..bad801e 100644 --- a/plugins/users/rmuser.sh +++ b/plugins/users/rmuser.sh @@ -1,6 +1,6 @@ #!@SHELL@ -name='rvs rmuser' -ver='0.7.0' +name='rvs users rmuser' +ver='0.7.2' # 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 @@ -9,6 +9,12 @@ ver='0.7.0' # # Originally written by Luke Shumaker . -uname=$1 -rm "$REPO/$uname" +source "$libexecdir/lib/stdio" + +user="$1" +if [ -f "$REPO/users/$user" ]; then + rm "$REPO/users/$user" +else + error "User \`$user' does not exist" +fi -- cgit v1.2.3-54-g00ecf