summaryrefslogtreecommitdiff
path: root/modules/blobs/get.d.sh
diff options
context:
space:
mode:
Diffstat (limited to 'modules/blobs/get.d.sh')
-rw-r--r--modules/blobs/get.d.sh36
1 files changed, 19 insertions, 17 deletions
diff --git a/modules/blobs/get.d.sh b/modules/blobs/get.d.sh
index e67a267..5fdf0b2 100644
--- a/modules/blobs/get.d.sh
+++ b/modules/blobs/get.d.sh
@@ -1,7 +1,8 @@
#!/usr/bin/env bash
-# rvs blobs/get.d - get a directory from the repository
-# Copyright (C) 2009-2010, 2015-2016 Luke Shumaker
-#
+name=blobs/get.d
+desc='Get a directory from the repository'
+copyright=('2009-2010, 2015-2016 Luke Shumaker')
+license='AGPLv3+'
# This file is part of rvs.
#
# This program is free software: you can redistribute it and/or modify
@@ -17,21 +18,22 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-. "${0%/*}/_stdio.sh"
+usage="ID DIRNAME"
+. "${0%/*}/_shlib.sh"
-usage="DIRNAME ID"
-[[ $# -eq 2 ]] || errusage
-name=$1
-id=$2
+main() {
+ [[ $# -eq 2 ]] || errusage
+ dirid=$1
+ dirname=$2
-tmpfile="$(mktemp -t "${0##*/}.XXXXXXXXXX")"
-"$RVS" get.f "$tmpfile" "$id"
+ mkdir -p -- "$dirname"
+ cd "$dirname"
-mkdir -p -- "$name"
-cd "$name"
+ IFS=$'\t'
+ while read -r perm user group id name; do
+ "$RVS" get "$id" "$name"
+ chmod "$perm" "$name"
+ done < <("$RVS" get.f "$dirid" /dev/stdout)
+}
-IFS=$'\t'
-while read -r perm user group id name; do
- "$RVS" get "$name" "$id"
- chmod "$perm" "$name"
-done < "$tmpfile"
+main "$@"