]> dgit.raspbian.org Git - git-annex.git/commitdiff
Added a comment
authoryarikoptic <yarikoptic@web>
Sat, 14 Nov 2020 02:00:13 +0000 (02:00 +0000)
committeradmin <admin@branchable.com>
Sat, 14 Nov 2020 02:00:13 +0000 (02:00 +0000)
doc/todo/calckey___91__--path__93___given_a_checksum_and_filename__63__/comment_5_ec644589ec44a442dc2f3bd2244c9800._comment [new file with mode: 0644]

diff --git a/doc/todo/calckey___91__--path__93___given_a_checksum_and_filename__63__/comment_5_ec644589ec44a442dc2f3bd2244c9800._comment b/doc/todo/calckey___91__--path__93___given_a_checksum_and_filename__63__/comment_5_ec644589ec44a442dc2f3bd2244c9800._comment
new file mode 100644 (file)
index 0000000..aa249da
--- /dev/null
@@ -0,0 +1,43 @@
+[[!comment format=mdwn
+ username="yarikoptic"
+ avatar="http://cdn.libravatar.org/avatar/f11e9c84cb18d26a1748c33b48c924b4"
+ subject="comment 5"
+ date="2020-11-14T02:00:13Z"
+ content="""
+Woohoo -- thank you Joey!
+
+Here is my complete example which seems to work quite neatly.  One aspect which you might (or not -- shouldn't matter to me but bash people might appreciate): could \"${filename}\" (if provided to examinekey) be passed into `format` as well? that would allow for easy looping like in this example, but on more than one key at a time.
+
+Unrelated, just curious -- what is the best way to \"chain\" multiple batch processes in bash, like here `examinekey` and `registerurl`?
+
+
+```bash
+$> cat ./addurl-uberfast.sh
+#!/bin/bash
+
+export PS4='> '
+set -x
+set -eu
+cd \"$(mktemp -d ${TMPDIR:-/tmp}/dl-XXXXXXX)\"
+
+md5=f92bbc617f8c8714a251f1f208af37a0
+size=6605
+filename=GLwDrawA.h
+url=http://www.onerussian.com/tmp/$filename
+
+git init
+git annex init
+
+echo MD5-s$size--$md5 $filename | \
+ git-annex examinekey --batch --format='${key} ${objectpath}\n' --migrate-to-backend=MD5E | \
+ while read key objectpath; do
+    git-annex registerurl \"$key\" \"$url\"
+    # examinekey does not know ${filename} in its format so such looping isn't exactly
+    # possible easily in bash ATM
+    ln -s \"$objectpath\" \"$filename\"
+    git add \"$filename\"
+    git annex get \"$filename\"
+    git annex drop \"$filename\"
+ done
+```
+"""]]