summaryrefslogtreecommitdiffstats
authorVictor Lowther <victor.lowther@gmail.com>2008-03-31 17:32:19 (GMT)
committer Victor Lowther <victor.lowther@gmail.com>2008-03-31 17:32:19 (GMT)
commit82ccd5681a52d84033f5850a2979d72b500a6059 (patch) (side-by-side diff)
tree4941990cb8b17ee51dfe103604f3bc5e153211db
parent068a26bdf03d2815bb67f581a102ef88c90ff430 (diff)
downloadsnapshot-master.zip
snapshot-master.tar.gz
snapshot-master.tar.bz2
More updates to recover.in. This code still does not work.HEADpersonal/mastermaster
Also made some formatting cleanups in remote.in
-rw-r--r--recover.in7
-rw-r--r--remote.in35
2 files changed, 15 insertions, 27 deletions
diff --git a/recover.in b/recover.in
index d02db99..ff1d73a 100644
--- a/recover.in
+++ b/recover.in
@@ -29,6 +29,13 @@ check_master_manifest() {
done
}
+recover_one() {
+ # $1 = changeset to recover from
+ # $2 = destination to recover to
+ # $3 = private keyfile. Optional unless the changeset is encrypted.
+ # $4 = password. Optional unless the private key is encrypted.
+
+}
# recover from our backup files.
do_final_recover() {
# Using files in $1, recover to $2 using optional private key $3
diff --git a/remote.in b/remote.in
index 034e178..c6baf25 100644
--- a/remote.in
+++ b/remote.in
@@ -20,29 +20,10 @@ find_snapshot_loc() {
done
}
-head_convert() {
- [[ -f $HEADS/$1 ]] || die "Head $1 does not exist."
- [[ -d $HEADS/$1 ]] && die "Head $1 already converted."
- local p
- mkdir -p "$HEADS/$1.new"
- mv "$HEADS/$1" "$HEADS/$1.old"
- while read -r line; do
- key="${line%%'='*}"
- val="${line#*'='}"
- [[ $key = $val ]] && continue
- printf "%s" "$val" > "$HEADS/$1.new/$key"
- done < "$HEADS/$1.old"
- mv "$HEADS/$1.new" "$HEADS/$1"
- # rm -f "$HEADS.old"
-}
-
head_get() {
# $1 = head to get val from
# $2 = value to get
- [[ -d $HEADS/$1 ]] || head_convert "$1"
- if [[ -L $HEADS/$1/$2 ]]; then
- readlink "$HEADS/$1/$2"
- elif [[ -f $HEADS/$1/$2 ]]; then
+ if [[ -f $HEADS/$1/$2 ]]; then
cat "$HEADS/$1/$2"
else
return 1
@@ -54,10 +35,7 @@ head_set() {
# $1 = head to set value in
# $2 = name of value
# $3 = value of value
- [[ -d $HEADS/$1 ]] || head_convert "$1"
- if [[ -d $3 || -f $3 ]]; then
- ln -sf "$3" "$HEADS/$1/$2"
- elif [[ $3 ]]; then
+ if [[ $3 ]]; then
printf "%s" "$3" > "$HEADS/$1/$2"
else
rm -f "$HEADS/$1/$2"
@@ -105,8 +83,10 @@ update_or_remove_head() {
{ remove_head "$head"; return 0; }
# we want to move to a category that does not have a head. Yay us!
- [[ $real_current_cat != $head ]] && \
- { mv "$HEADS/$head" "$HEADS/${real_current_cat}"; head="$real_current_cat"; }
+ [[ $real_current_cat != $head ]] && {
+ mv "$HEADS/$head" "$HEADS/${real_current_cat}"
+ head="$real_current_cat"
+ }
# we do not need to reparent. ttfn
[[ $parent = none ]] && return 0
@@ -129,7 +109,8 @@ finalize_remote() {
# $1 = directory finalized remote goes into
# $2 = string to append to name of manifest file.
rm -f "${REMOTE}/${1}/key"
- find "${REMOTE}/${1}" -maxdepth 1 -mindepth 1 -type f ! -name 'MANIFEST.*' -printf '%s:%f\n' > "${REMOTE}/${1}/MANIFEST.$2"
+ find "${REMOTE}/${1}" -maxdepth 1 -mindepth 1 -type f ! -name 'MANIFEST.*' \
+ -printf '%s:%f\n' > "${REMOTE}/${1}/MANIFEST.$2"
# we need to include the manifest file in the manifest.
# Note that the size is not correct -- the restore code will ignore it.
echo "0:MANIFEST.$2" >> "$REMOTE/${1}/MANIFEST.${2}"