summaryrefslogtreecommitdiff
path: root/git-maintenance
diff options
context:
space:
mode:
Diffstat (limited to 'git-maintenance')
-rwxr-xr-xgit-maintenance/get.sh14
-rwxr-xr-xgit-maintenance/store.sh17
2 files changed, 22 insertions, 9 deletions
diff --git a/git-maintenance/get.sh b/git-maintenance/get.sh
index f05d388..4af9fb0 100755
--- a/git-maintenance/get.sh
+++ b/git-maintenance/get.sh
@@ -4,7 +4,11 @@ PASS="$(ls "/run/media/"*/*"/key.fsojp.aes256" | head -n 1)"
PUBKEY=1KwpZECcrGWnM3AFVSbv3Xr5qguV4yG2sV
URLPFX="https://bico.media/$PUBKEY"
-REPONAME=for-slow-organization-job-private
+REPONAME="$1"
+if [ "$REPONAME" = "" ]
+then
+ REPONAME=for-slow-organization-job-private
+fi
echo ""
echo "This script is expected to be kept in sync with:"
@@ -14,15 +18,17 @@ echo ""
# 2. mkdir -p .git/encrypted and git init
mkdir -p "$REPONAME"
cd "$REPONAME"
-git init
+if ! [ -d ".git" ]; then git init; fi
-# prevent recreation of existing data on same medium-part
+# prevent recreation of existing data
git config gc.auto 0
mkdir -p .git/encrypted
+mkdir -p .git/objects/pack.bak
+mv .git/objects/pack/* .git/objects/pack.bak/
# 3. download .git/encrypted with wget
-wget "$URLPFX"/refs.aes -O .git/encrypted/refs.aes
+curl -sfI "$URLPFX"/refs.aes>/dev/null && wget "$URLPFX"/refs.aes -O .git/encrypted/refs.aes || echo "==== BROKEN REMOTE refs.aes PLEASE RE-STORE ===="
openssl aes-256-cbc -salt -pbkdf2 -pass "file:$PASS" -d -in .git/encrypted/refs.aes | tar -zxvf -
for encpack in $(<.git/encrypted/list.txt)
diff --git a/git-maintenance/store.sh b/git-maintenance/store.sh
index b073e71..95a563b 100755
--- a/git-maintenance/store.sh
+++ b/git-maintenance/store.sh
@@ -14,10 +14,8 @@ TAR="tar -z --owner=0 --group=0 --numeric-owner --mode=go=rX,u+rw,a-s"
# let us only upload new packfiles.
# we will use a mirror folder containing encrypted files
-if ! [ -d "$GITDIR"/encrypted ]
-then
- mkdir -p "$GITDIR"/encrypted
-fi
+mkdir -p "$GITDIR"/encrypted
+mkdir -p "$GITDIR"/encrypted.bak
if ! [ -d "$MAINTDIR"/bsvup/node_modules ]
then
git submodule init
@@ -33,12 +31,15 @@ fi
git config gc.auto 0
tmpfile="$(mktemp)"
+PUBKEY=1KwpZECcrGWnM3AFVSbv3Xr5qguV4yG2sV
+URLPFX="https://bico.media/$PUBKEY"
for packfile in "$GITDIR"/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 -s "$URLPFX"/"$fn" | sha256sum)" = "$(cat "$GITDIR"/encrypted/"$fn" | sha256sum)" ]; then mv "$GITDIR"/encrypted/"$fn" "$GITDIR"/encrypted.bak; fi
echo "$fn" >> "$tmpfile".list
done
rm "$tmpfile"
@@ -46,6 +47,12 @@ 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
+
+
+
+
+
# 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 !!!!!!!!
@@ -75,7 +82,7 @@ cp -va "$MAINTDIR"/get.sh "$GITDIR"/encrypted
# some imagine anger to process disconnected parts.
cd "$MAINTDIR"
-node "$MAINTDIR"/bsvup/cli.js upload -f "$GITDIR"/encrypted -t none -p "$(<"$PASS")" -vb
+node "$MAINTDIR"/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.