--- /dev/null
+#/usr/bin/env bash
+#
+# Close a Tomb.
+#
+
+# Parameters
+BASENAME="`basename $0`"
+TOMB="$1"
+TOMBS="$HOME/data/tombs"
+KEYS="$HOME/.tombs"
+
+# Check
+if [ ! -d "$TOMBS" ]; then
+ echo "error: no cemetery available at $TOMBS"
+ exit 1
+elif [ -z "$TOMB" ]; then
+ echo "usage: $BASENAME <tomb>"
+ echo "available tombs: `ls $TOMBS | xargs basename -a -s .tomb | xargs echo`"
+ exit 1
+elif [ ! -e "$TOMBS/$TOMB.tomb" ]; then
+ echo "tomb not found: $TOMBS/$TOMB.tomb"
+ exit 1
+#elif ! tomb list $TOMB &> /dev/null; then
+# echo "tomb $TOMB is already closed"
+# exit 1
+fi
+
+# Dispatch
+tomb close $TOMB
+
+# Annex
+if [ -d "$TOMBS/.git/annex" ]; then
+ ( cd $TOMBS && git annex add $TOMB.tomb )
+fi
echo "usage: $BASENAME <tomb>"
echo "available tombs: `ls $TOMBS | xargs basename -a -s .tomb | xargs echo`"
exit 1
+elif [ ! -e "$TOMBS/$TOMB.tomb" ]; then
+ echo "tomb not found: $TOMBS/$TOMB.tomb"
+ exit 1
elif [ ! -e "$KEYS/$TOMB.tomb.key" ]; then
echo "missing keyfile $KEYS/$TOMB.tomb.key"
exit 1