diff options
Diffstat (limited to 'git-maintenance/get.sh')
-rwxr-xr-x | git-maintenance/get.sh | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/git-maintenance/get.sh b/git-maintenance/get.sh index 7bff0ab..e131f18 100755 --- a/git-maintenance/get.sh +++ b/git-maintenance/get.sh @@ -2,6 +2,7 @@ PASS="$(ls "/run/media/"*/*"/key.fsojp.aes256" | head -n 1)" PUBKEY=1KwpZECcrGWnM3AFVSbv3Xr5qguV4yG2sV +NONCE="$(date +%s)" URLPFX="https://bico.media/$PUBKEY" if [ "$1" != "" ] @@ -32,17 +33,18 @@ git config gc.auto 0 pushd .git # prevent recreation of existing data mkdir -p encrypted -mkdir -p objects/pack.bak -mv -f objects/pack/* objects/pack.bak/ +mkdir -p bak +cp -va HEAD refs objects/pack bak +rm objects/pack/* # 3. download .git/encrypted with wget -curl -sfI "$URLPFX"/refs.aes>/dev/null && wget "$URLPFX"/refs.aes -O encrypted/refs.aes || echo "==== BROKEN REMOTE refs.aes PLEASE RE-STORE OR RECOVER ====" +curl -sfI "$URLPFX"/refs.aes?"$NONCE">/dev/null && wget "$URLPFX"/refs.aes?"$NONCE" -O encrypted/refs.aes || echo "==== BROKEN REMOTE refs.aes PLEASE RE-STORE OR RECOVER ====" openssl aes-256-cbc -salt -pbkdf2 -pass "file:$PASS" -d -in encrypted/refs.aes | tar -Jxvf - for encpack in $(<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 -Jxvf - + wget "$URLPFX"/"$encpack" -O encrypted/"$encpack" + openssl aes-256-cbc -salt -pbkdf2 -pass "file:$PASS" -d -in encrypted/"$encpack" | tar -Jxvf - done for pack in objects/pack/*.pack |