aboutsummaryrefslogtreecommitdiff
path: root/exp/exp.sh
diff options
context:
space:
mode:
authorn-peugnet <n.peugnet@free.fr>2021-10-04 15:18:33 +0200
committern-peugnet <n.peugnet@free.fr>2021-10-04 15:18:33 +0200
commit7fab7722bdc67184bff18cc7e70d7f2043f5b057 (patch)
tree91cc89bc40652a86f7a5fabcf5a84c248c264ed8 /exp/exp.sh
parenta8d4b5b440ed9ac29a0eae7fc47c144d46745078 (diff)
downloaddna-backup-7fab7722bdc67184bff18cc7e70d7f2043f5b057.tar.gz
dna-backup-7fab7722bdc67184bff18cc7e70d7f2043f5b057.zip
first add of cdemu (might not be useful)
Diffstat (limited to 'exp/exp.sh')
-rwxr-xr-xexp/exp.sh39
1 files changed, 25 insertions, 14 deletions
diff --git a/exp/exp.sh b/exp/exp.sh
index c031b94..2ddb33f 100755
--- a/exp/exp.sh
+++ b/exp/exp.sh
@@ -1,35 +1,46 @@
#!/bin/bash
-commits="$1"
-repo="$2"
-max_count="$3"
-backup="$4"
-diffs="$5"
+# This script expects the following variables to be exported:
+# - REPO_PATH: the path of the repo the experiment is based on
+# - MAX_VERSION: the max number for versions for the experiment
+# - LO_DEV: the loopbak device used to mount the UDF dir
+# - COMMITS: the name of the file that contains the lists of versions
+# - BACKUP: the path fo the dna-backup dir
+# - DIFFS: the path of the git diff dir
+# - UDF: the path of the UDF dir
-mkdir -p $backup $diffs
+GITC="git -C $REPO_PATH"
# "empty tree" commit
prev="4b825dc642cb6eb9a060e54bf8d69288fbee4904"
-last=$(tail --lines=1 "$commits" | cut -f1)
+last=$(tail --lines=1 $COMMITS | cut -f1)
+
+sudo mount -t udf -o loop $LO_DEV $UDF
+sudo chown $USER:$USER $UDF
i=0
-cat "$commits" | while read line
+cat $COMMITS | while read line
do
hash=$(echo "$line" | cut -f1)
- git -C "$repo" checkout "$hash"
+ $GITC checkout $hash
# create diff for this version
- git -C "$repo" diff --minimal --binary --unified=0 "$prev" | gzip > "$diffs/$i.diff.gz"
+ $GITC diff --minimal --binary --unified=0 $prev | gzip > $DIFFS/$i.diff.gz
# create backup for this version
- ../dna-backup commit -v 2 "$repo" "$backup"
+ ../dna-backup commit -v 2 $REPO_PATH $BACKUP
+
+ # write to udf
+ $GITC diff | git -C $UDF apply -
+ sudo umount $UDF
- prev="$hash"
+ prev=$hash
let i++
- if [[ $i == $max_count ]]
+ if [[ $i == $MAX_VERSION ]]
then
break
fi
done
-git -C "$repo" checkout "$last"
+# cleanup
+$GITC checkout $last