summaryrefslogtreecommitdiff
path: root/plugins/users
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2009-08-03 19:03:08 -0400
committerLuke Shumaker <lukeshu@sbcglobal.net>2015-06-26 00:30:13 -0600
commitfc8d2f56a8104e755766fbbca4729906000cf78d (patch)
treeb902e17f5e59e960772d215ee613a73c8a87226b /plugins/users
parentaa5141e77203fd084d809f27d55192a988723803 (diff)
0.7.2 -- refactor slightly, flesh out plugin: users
Diffstat (limited to 'plugins/users')
-rw-r--r--plugins/users/commit.sh21
-rw-r--r--plugins/users/init.sh6
-rw-r--r--plugins/users/lib/stdio.sh59
-rw-r--r--plugins/users/login.sh20
-rw-r--r--plugins/users/logout.sh19
-rw-r--r--plugins/users/mkuser.sh8
-rw-r--r--plugins/users/rmuser.sh14
7 files changed, 138 insertions, 9 deletions
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 <lukeshu@sbcglobal.net>.
+
+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 <lukeshu@sbcglobal.net>.
+#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 <lukeshu@sbcglobal.net>.
+
+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 <lukeshu@sbcglobal.net>.
+__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 <lukeshu@sbcglobal.net>.
+
+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 <lukeshu@sbcglobal.net>.
+
+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 <lukeshu@sbcglobal.net>.
+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 <lukeshu@sbcglobal.net>.
-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