summaryrefslogtreecommitdiff
path: root/git-maintenance
diff options
context:
space:
mode:
Diffstat (limited to 'git-maintenance')
-rwxr-xr-xgit-maintenance/get.sh2
-rwxr-xr-xgit-maintenance/store.sh23
2 files changed, 13 insertions, 12 deletions
diff --git a/git-maintenance/get.sh b/git-maintenance/get.sh
index a7ddac9..12b8470 100755
--- a/git-maintenance/get.sh
+++ b/git-maintenance/get.sh
@@ -41,7 +41,7 @@ openssl aes-256-cbc -salt -pbkdf2 -pass "file:$PASS" -d -in .git/encrypted/refs.
for encpack in $(<.git/encrypted/list.txt)
do
wget "$URLPFX"/"$encpack" -O .git/encrypted/"$encpack"
- openssl aes-256-cbc -salt -pbkdf2 -pass "file:$PASS" -d -in .git/encrypted/"$encpack" | tar -zxvf -
+ openssl aes-256-cbc -salt -pbkdf2 -pass "file:$PASS" -d -in .git/encrypted/"$encpack" | tar -zxvf - -C .git
done
for pack in .git/objects/pack/*.pack
diff --git a/git-maintenance/store.sh b/git-maintenance/store.sh
index 19d3be2..99c71d7 100755
--- a/git-maintenance/store.sh
+++ b/git-maintenance/store.sh
@@ -3,8 +3,8 @@
PASS="$(ls "/run/media/"*/*"/key.fsojp.aes256" | head -n 1)"
ROOTDIR="$(git rev-parse --show-toplevel)"
cd "$ROOTDIR"
-GITDIR=".git"
-MAINTDIR="git-maintenance"
+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"
@@ -36,21 +36,22 @@ git prune-packed
tmpfile="$(mktemp)"
PUBKEY=1KwpZECcrGWnM3AFVSbv3Xr5qguV4yG2sV
URLPFX="https://bico.media/$PUBKEY"
-for packfile in "$GITDIR"/objects/pack/*.pack
+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
- mv "$tmpfile".aes "$GITDIR"/encrypted/"$fn"
- if [ "$(curl "$URLPFX"/"$fn" | sha256sum)" = "$(cat "$GITDIR"/encrypted/"$fn" | sha256sum)" ]; then mv -v "$GITDIR"/encrypted/"$fn" "$GITDIR"/encrypted.bak; fi
+ mv "$tmpfile".aes encrypted/"$fn"
+ if [ "$(curl "$URLPFX"/"$fn" | sha256sum)" = "$(cat encrypted/"$fn" | sha256sum)" ]; then mv -v encrypted/"$fn" encrypted.bak; fi
echo "$fn" >> "$tmpfile".list
done
rm "$tmpfile"
-mv "$tmpfile".list "$GITDIR"/encrypted/list.txt
-$TAR -cv "$GITDIR"/encrypted/list.txt "$GITDIR"/refs "$GITDIR"/HEAD "$GITDIR"/packed-refs | openssl aes-256-cbc -salt -pbkdf2 -pass "file:$PASS" -e -out "$GITDIR"/encrypted/refs.aes
-rm "$GITDIR"/encrypted/list.txt
-cp -va "$MAINTDIR"/get.sh "$GITDIR"/encrypted
-if [ "$(curl -s "$URLPFX"/get.sh | sha256sum)" = "$(cat "$GITDIR"/encrypted/get.sh | sha256sum)" ]; then rm "$GITDIR"/encrypted/get.sh; fi
+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
+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
@@ -85,7 +86,7 @@ if [ "$(curl -s "$URLPFX"/get.sh | sha256sum)" = "$(cat "$GITDIR"/encrypted/get.
# some imagine anger to process disconnected parts.
cd "$MAINTDIR"
-node "$MAINTDIR"/bsvup/cli.js upload -f "$GITDIR"/encrypted -t dir -p "$(<"$PASS")" -vb
+node bsvup/cli.js upload -f "$GITDIR"/encrypted -t dir -p "$(<"$PASS")" -vb
# 'is this a good way to be' <- habit's task for self and others, by living
# the best way to be it can.