From c034306d75dc64c08f9e09242ac1b77a4b561a85 Mon Sep 17 00:00:00 2001 From: olpc user Date: Tue, 7 Jan 2020 18:32:45 -0800 Subject: bugfixes in get --- git-maintenance/get.sh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'git-maintenance') 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 $(