diff options
author | olpc user <olpc@xo-5d-f7-86.localdomain> | 2020-01-07 15:46:05 -0800 |
---|---|---|
committer | olpc user <olpc@xo-5d-f7-86.localdomain> | 2020-01-07 15:46:05 -0800 |
commit | cd4351906daaac3b77a2f5fe6b3a2f664e9b88b4 (patch) | |
tree | a16c4655a2c1ec846b669cffbe9a8175d7cd8ced | |
parent | 4c3fc266543ce59ca13a5e703ee92f94628afc95 (diff) | |
download | standingwithresilience-cd4351906daaac3b77a2f5fe6b3a2f664e9b88b4.tar.gz standingwithresilience-cd4351906daaac3b77a2f5fe6b3a2f664e9b88b4.zip |
scripts to store and get
-rw-r--r-- | .gitmodules | 2 | ||||
-rw-r--r-- | git-maintenance/.bsv/key (renamed from .bsv/key) | 0 | ||||
m--------- | git-maintenance/bsvup (renamed from bsvup) | 0 | ||||
-rwxr-xr-x | git-maintenance/get.sh | 41 | ||||
-rwxr-xr-x | git-maintenance/store.sh | 97 |
5 files changed, 139 insertions, 1 deletions
diff --git a/.gitmodules b/.gitmodules index 085bcc6..4ed6643 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "bsvup"] - path = bsvup + path = git-maintenance/bsvup url = https://github.com/monkeylord/bsvup.git diff --git a/.bsv/key b/git-maintenance/.bsv/key index 20b23c3..20b23c3 100644 --- a/.bsv/key +++ b/git-maintenance/.bsv/key diff --git a/bsvup b/git-maintenance/bsvup -Subproject cb8d1fb6165213b08549cdc3bc352337aa5aa0b +Subproject cb8d1fb6165213b08549cdc3bc352337aa5aa0b 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 diff --git a/git-maintenance/store.sh b/git-maintenance/store.sh new file mode 100755 index 0000000..b073e71 --- /dev/null +++ b/git-maintenance/store.sh @@ -0,0 +1,97 @@ +#!/usr/bin/env bash + +PASS="$(ls "/run/media/"*/*"/key.fsojp.aes256" | head -n 1)" +ROOTDIR="$(git rev-parse --show-toplevel)" +GITDIR="$ROOTDIR/.git" +MAINTDIR="$ROOTDIR/git-maintenance" +cd "$ROOTDIR" + +export GZIP=-9n +TAR="tar -z --owner=0 --group=0 --numeric-owner --mode=go=rX,u+rw,a-s" + +# this approach makes it easy for karl to look at history. it is not +# to be used by other channels yet, can migrate. + +# 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 +if ! [ -d "$MAINTDIR"/bsvup/node_modules ] +then + git submodule init + git submodule update + pushd "$MAINTDIR"/bsvup + npm install + popd +fi + +# TODO: once key picked, do what? + +# prevent recreation of existing data on same medium-part +git config gc.auto 0 + +tmpfile="$(mktemp)" +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" + echo "$fn" >> "$tmpfile".list +done +rm "$tmpfile" +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 +# 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 !!!!!!!! + +# more privacy is made if encryption key is someething only us would consider.# then can be publicized, maybe. hot-shower-in-woods? froget-it-use-random +# we are storing 'everyone' to begin a thought. we are storing it permanently +# and privately. + +# we want to encrypt filename too, for what-I-call respect, +# so let's put each file in its own tarball, preferably in subdir, +# and add each filename to an index that is also uploaded, for ease finding. +# we can write down the filenames locally too. but is sufficient to write down +# the index. =) + +# now upload. use PASS and upload .git/encrypted. need money. +# all aboriginal cultures. discovers is emergency measure by government AI. +# PTSD. need slow shift to turned-to-nanites, earth broken. +# anger is for imagination. helps process importance from events. +# what-is-harmed, what-was-relevent-to-harm. +# business-man, try to larn to live off nuts, alone, yourself, now. +# wouldn't it be nice if we had somebody alive to help us do this. + +# industry caused destruction of billions of years of learning-how-to-be and +# how-to-learn-how-to-be, which is the most important thing known. +# they are still doing this, and planning it, but do not realize it. +# they are also important, as part of learning-how-to-be and a-way-to-be. +# some imagine anger to process disconnected parts. + +cd "$MAINTDIR" +node "$MAINTDIR"/bsvup/cli.js upload -f "$GITDIR"/encrypted -t none -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. + +#PURPOSE OF LIFE: "is this a good way to be?" taken in allrecommend checking parts and environment for clues as to what is good. senses with trust for all others. + +# REMAINING: +# 0. store download-script in repo, and on blockchain +# 0b. store upload script in repo +# 1. store download-script url on USB key +# 1b. store details on backup USB key too. +# 3. try to download without usb key, as test for failure +# 4. move btc from community or from git-remote-bsv to repo bsvup +# 5. upload the encrypted repo +# 6. download the encrypted repo, as a test +# 9. consider storing bsvup transaction details in git history, to reuse transaction information. +# costs more money + +# this is not severely secure. appreciate speed change though. |