diff options
author | Aleksey Veresov <aleksey@veresov.pro> | 2020-12-06 23:00:38 +0300 |
---|---|---|
committer | Aleksey Veresov <aleksey@veresov.pro> | 2020-12-06 23:00:38 +0300 |
commit | 2282ef61b60c1ce90ce7ac056781bfba0d7bdfec (patch) | |
tree | 13ec3bce878111cae8e65c33884299ea9e930a18 /vsvs-extract | |
parent | 217fc658ff15c7dc00e61d90b13cd84b0adc63b1 (diff) | |
download | vsvs-2282ef61b60c1ce90ce7ac056781bfba0d7bdfec.tar vsvs-2282ef61b60c1ce90ce7ac056781bfba0d7bdfec.tar.xz vsvs-2282ef61b60c1ce90ce7ac056781bfba0d7bdfec.zip |
.
Diffstat (limited to 'vsvs-extract')
-rw-r--r-- | vsvs-extract | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/vsvs-extract b/vsvs-extract new file mode 100644 index 0000000..a45d231 --- /dev/null +++ b/vsvs-extract @@ -0,0 +1,43 @@ +#!/bin/bash +after () { test -z "${2##*$1*}" && echo -n "${2#*$1}" } +vsvs-locate "$2" | { read path; read vsvspath; } || exit 1 +if test -f "$path" +then + lockfile="$base/proc/$proc/lock/" + if test "${path::1}" == "." + then lockfile="$lockfile$base$path" + else lockfile="$lockfile$path" + fi + mkdir -p -- "${lockfile%/*}" + echo $proc > $lockfile + lockpath="$path.lock" + ln $lockfile $lockpath || exit 1 # Error, cannot lock + data="$(cat $path)" + rm $lockpath + rm $lockfile + until test -z "$vsvspath" + do + data="$(echo -n "$data" | vsvs-parse " + if test \"\$key\" == \"${vsvspath%%/*}\" + then + echo \"\$value\" + exit 0 + fi")" + vsvspath=$(after / "$vsvspath") + done + echo -n "$data" | vsvs-parse "$1" +else + for key in `ls -a $path` + do + test "$key" == "." || test "$key" == ".." && continue + if test -f "$key" + then value=$(cat "$path/$key") + else + savedpath=$(pwd) + cd "$path/$key" + value=$(vsvs-archive) + cd "$savedpath" + fi + eval "$1" + done +fi |