summaryrefslogtreecommitdiff
path: root/git-maintenance/get.sh
diff options
context:
space:
mode:
Diffstat (limited to 'git-maintenance/get.sh')
-rwxr-xr-xgit-maintenance/get.sh41
1 files changed, 41 insertions, 0 deletions
diff --git a/git-maintenance/get.sh b/git-maintenance/get.sh
new file mode 100755
index 0000000..f05d388
--- /dev/null
+++ b/git-maintenance/get.sh
@@ -0,0 +1,41 @@
+#!/usr/bin/env bash
+
+PASS="$(ls "/run/media/"*/*"/key.fsojp.aes256" | head -n 1)"
+PUBKEY=1KwpZECcrGWnM3AFVSbv3Xr5qguV4yG2sV
+
+URLPFX="https://bico.media/$PUBKEY"
+REPONAME=for-slow-organization-job-private
+
+echo ""
+echo "This script is expected to be kept in sync with:"
+echo " ${URLPFX}/get.sh"
+echo ""
+
+# 2. mkdir -p .git/encrypted and git init
+mkdir -p "$REPONAME"
+cd "$REPONAME"
+git init
+
+# prevent recreation of existing data on same medium-part
+git config gc.auto 0
+
+mkdir -p .git/encrypted
+
+# 3. download .git/encrypted with wget
+wget "$URLPFX"/refs.aes -O .git/encrypted/refs.aes
+openssl aes-256-cbc -salt -pbkdf2 -pass "file:$PASS" -d -in .git/encrypted/refs.aes | tar -zxvf -
+
+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 -
+done
+
+for pack in .git/objects/pack/*.pack
+do
+ git index-pack "$pack"
+done
+
+git checkout
+
+echo DONE