summaryrefslogtreecommitdiff
path: root/git-maintenance/store.sh
diff options
context:
space:
mode:
Diffstat (limited to 'git-maintenance/store.sh')
-rwxr-xr-xgit-maintenance/store.sh39
1 files changed, 27 insertions, 12 deletions
diff --git a/git-maintenance/store.sh b/git-maintenance/store.sh
index 1361226..e45524b 100755
--- a/git-maintenance/store.sh
+++ b/git-maintenance/store.sh
@@ -6,8 +6,19 @@ cd "$ROOTDIR"
GITDIR="$ROOTDIR/.git"
MAINTDIR="$ROOTDIR/git-maintenance"
-export GZIP=-9n
-TAR="tar -z --owner=0 --group=0 --numeric-owner --mode=go=rX,u+rw,a-s"
+# problem: IVs are producing files that do not have the same content each time,
+# and a reupload of everything is made each store.
+
+#export GZIP=-9n
+TAR="tar -J --owner=0 --group=0 --numeric-owner --mode=go=rX,u+rw,a-s"
+
+encrypt() {
+ openssl aes-256-cbc -salt -pbkdf2 -pass "file:$PASS" -e
+}
+
+decrypt() {
+ openssl aes-256-cbc -salt -pbkdf2 -pass "file:$PASS" -d
+}
# this approach makes it easy for karl to look at history. it is not
# to be used by other channels yet, can migrate.
@@ -25,8 +36,6 @@ then
popd
fi
-# TODO: once key picked, do what?
-
# prevent recreation of existing data on same medium-part
git config gc.auto 0
@@ -40,17 +49,24 @@ cd "$GITDIR"
for packfile in objects/pack/*.pack
do
$TAR -cv "$packfile" > "$tmpfile"
- openssl aes-256-cbc -salt -pbkdf2 -pass "file:$PASS" -e -in "$tmpfile" -out "$tmpfile".aes
- fn="$({ cat "$tmpfile"; echo -n "$PASS"; } | sha256sum | cut -f 1 -d ' ')".aes
+ fn="$({ cat "$packfile"; echo -n "$PASS"; } | sha256sum | cut -f 1 -d ' ')".aes
if [ -e encrypted/"$fn" ]
then
echo "$fn ALREADY EXISTS LOCALLY ($packfile)"
else
echo "$fn IS NEW LOCALLY ($packfile)"
fi
- mv "$tmpfile".aes encrypted/"$fn"
- if [ "$(curl "$URLPFX"/"$fn" | sha256sum)" = "$(cat encrypted/"$fn" | sha256sum)" ]; then
- echo "$fn ALREADY EXISTS REMOTELY ($packfile)"
+ if [ "$(cat "$packfile" | sha256sum)" = "$(decrypt < encrypted/"$fn" | sha256sum) ]
+ then
+ echo "$fn MATCHES CONTENT LOCALLY ($packfile)"
+ else
+ echo "$fn DOESN'T MATCH LOCAL CONTENT ($packfile)"
+ encrypt < "$tmpfile" > "$tmpfile".aes
+ mv "$tmpfile".aes encrypted/"$fn"
+ fi
+ # need to decrypt to compare content.
+ if [ "$(curl "$URLPFX"/"$fn" | decrypt | "$TAR" -xvOf - "$packfile" | sha256sum)" = "$(cat "$packfile" | sha256sum)" ]; then
+ echo "$fn MATCHES DOWNLOAD CONTENT ($packfile)"
mv -v encrypted/"$fn" encrypted.bak
else
echo "$fn FAILED GET MATCH REMOTELY ($packfile)"
@@ -59,7 +75,7 @@ do
done
rm "$tmpfile"
mv "$tmpfile".list encrypted/list.txt
-$TAR -cv encrypted/list.txt refs HEAD packed-refs | openssl aes-256-cbc -salt -pbkdf2 -pass "file:$PASS" -e -out encrypted/refs.aes
+$TAR -cv encrypted/list.txt refs HEAD packed-refs | encrypt > encrypted/refs.aes
rm encrypted/list.txt
cp -va "$MAINTDIR"/get.sh encrypted
if [ "$(curl -s "$URLPFX"/get.sh | sha256sum)" = "$(cat encrypted/get.sh | sha256sum)" ]; then rm encrypted/get.sh; fi
@@ -67,7 +83,6 @@ if [ "$(curl -s "$URLPFX"/get.sh | sha256sum)" = "$(cat encrypted/get.sh | sha25
-
# primordia is detectable due to a pattern that emerges from not being industrialized. appears resolvable with industrial history assumption, including academic degrees. name-AI-primordia, keep earth-is-god assumption? the-king? the-king-is-earth. AI works for earth. be any thing you want. silica-computer.
# this junk in scriptfile is why private !!!!!!!!
@@ -97,7 +112,7 @@ if [ "$(curl -s "$URLPFX"/get.sh | sha256sum)" = "$(cat encrypted/get.sh | sha25
# some imagine anger to process disconnected parts.
cd "$MAINTDIR"
-node bsvup/cli.js upload -f "$GITDIR"/encrypted -t dir -p "$(<"$PASS")" -vb
+node bsvup/cli.js upload -f "$GITDIR"/encrypted -t dir -p "$(<"$PASS")" -v # -b
# 'is this a good way to be' <- habit's task for self and others, by living
# the best way to be it can.