diff options
Diffstat (limited to 'git-maintenance/get.sh')
-rwxr-xr-x | git-maintenance/get.sh | 14 |
1 files changed, 10 insertions, 4 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) |