cleanup
This commit is contained in:
@@ -21,7 +21,7 @@ checkcode () {
|
|||||||
if [ $retcode -ne 0 ]; then
|
if [ $retcode -ne 0 ]; then
|
||||||
echo -e "\e[31mERROR!\033[0m Response Code: $retcode"
|
echo -e "\e[31mERROR!\033[0m Response Code: $retcode"
|
||||||
else
|
else
|
||||||
printf '\e[1;32mOK!\e[0m\n'
|
printf ' \e[1;32mOK!\e[0m\n'
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,7 +56,7 @@ rm -rf "$inner_dir" > /dev/null 2>&1
|
|||||||
checkcode $?
|
checkcode $?
|
||||||
|
|
||||||
printf "ssh: signing out/contents.7z"
|
printf "ssh: signing out/contents.7z"
|
||||||
ssh-keygen -Y sign -f "$key_path" -n "$signature_tag" "$out_dir/contents.7z" # > /dev/null 2>&1
|
ssh-keygen -Y sign -f "$key_path" -n "$signature_tag" "$out_dir/contents.7z" > /dev/null 2>&1
|
||||||
checkcode $?
|
checkcode $?
|
||||||
|
|
||||||
printf "sha512: generating sha512 checksums of files in out"
|
printf "sha512: generating sha512 checksums of files in out"
|
||||||
@@ -69,14 +69,14 @@ echo
|
|||||||
echo "Enter attribution passphrase again:"
|
echo "Enter attribution passphrase again:"
|
||||||
read -r -s attribution_passphrase_check
|
read -r -s attribution_passphrase_check
|
||||||
if [[ "$attribution_passphrase" != "$attribution_passphrase_check" ]]; then
|
if [[ "$attribution_passphrase" != "$attribution_passphrase_check" ]]; then
|
||||||
echo -e "\n\n\033[0;31mAttribution passphrases do not match! Exiting!\033[0m\n\n" >&2
|
echo -e "\n\n\033[0;31mAttribution passphrases do not match! Exiting!\033[0m\n\n" > /dev/null > /dev/null 2>&1
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
echo -e "attribution_passphrase: \033[0;32mOK!\033[0m"
|
echo -e "attribution_passphrase: \033[0;32mOK!\033[0m"
|
||||||
echo "$attribution_passphrase" > "attribution_passphrase_${unix_seconds}.txt"
|
echo "$attribution_passphrase" > "attribution_passphrase_${unix_seconds}.txt"
|
||||||
fi
|
fi
|
||||||
unset attribution_passphrase_check > /dev/null 2>&1
|
unset attribution_passphrase_check > /dev/null > /dev/null 2>&1
|
||||||
unset attribution_passphrase > /dev/null 2>&1
|
unset attribution_passphrase > /dev/null > /dev/null 2>&1
|
||||||
{
|
{
|
||||||
printf '%s' "$attribution_passphrase"
|
printf '%s' "$attribution_passphrase"
|
||||||
cat "$out_dir/contents.7z"
|
cat "$out_dir/contents.7z"
|
||||||
@@ -96,14 +96,25 @@ unset attribution_passphrase > /dev/null 2>&1
|
|||||||
# checkcode $?
|
# checkcode $?
|
||||||
|
|
||||||
printf "7z archiving outer dir"
|
printf "7z archiving outer dir"
|
||||||
7z a "./out.7z" "$out_dir" > /dev/null 2>&1
|
7z a "./out.7z" "$out_dir" > /dev/null > /dev/null 2>&1
|
||||||
checkcode $?
|
checkcode $?
|
||||||
printf "moving out.7z to archives"
|
printf "moving out.7z to archives"
|
||||||
mv out.7z "archives/verifiable_archive_${unix_seconds}.7z"
|
mv out.7z "archives/verifiable_archive_${unix_seconds}.7z" > /dev/null 2>&1
|
||||||
checkcode $?
|
checkcode $?
|
||||||
|
|
||||||
|
echo "input keystore passphrase"
|
||||||
|
read -r -s keystore_passphrase
|
||||||
|
echo
|
||||||
|
echo "input keystore passphrase (again)"
|
||||||
|
read -r -s keystore_passphrase_check
|
||||||
|
echo
|
||||||
|
if [[ "$keystore_passphrase" != "$keystore_passphrase_check" ]]; then
|
||||||
|
echo -e "\n\n\033[0;31mKeystore passphrases do not match! Exiting!\033[0m\n\n" > /dev/null 2>&1
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
printf "archivin keys"
|
printf "archivin keys"
|
||||||
7z a "keystore/keystore_${unix_seconds}.7z" "private_*" "private_*.pub" "attribution_passphrase_${unix_seconds}.txt"
|
7z a "keystore/keystore_${unix_seconds}.7z" "private_*" "private_*.pub" "attribution_passphrase_${unix_seconds}.txt" > /dev/null 2>&1
|
||||||
checkcode $?
|
checkcode $?
|
||||||
|
|
||||||
printf "resetting environment..."
|
printf "resetting environment..."
|
||||||
|
|||||||
@@ -1,32 +1,60 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
echo "autoshredding these files:"
|
|
||||||
find . -type f \( -path ".git" -o -path "keystore" -o -path "archives" \) -prune \( -name "*.sha512" -o -name "checksums*" -o -name "private_*" -o -name ".*" -o -name "*.sig" -o -name "*.7z" -o -name "anonymous_signer" \) -print -exec shred -uz {} \;
|
|
||||||
echo $?
|
|
||||||
|
|
||||||
echo "nuking errant priv key files"
|
checkcode () {
|
||||||
|
local retcode
|
||||||
|
if [ -z "$1" ]; then
|
||||||
|
echo -e "\n\e[31mERROR!\033[0m checkcode missing return code parameter\n"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
retcode=$1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $retcode -ne 0 ]; then
|
||||||
|
echo -e "\e[31mERROR!\033[0m Response Code: $retcode"
|
||||||
|
else
|
||||||
|
printf '\e[1;32mOK!\e[0m\n'
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
printf "autoshredding these files:"
|
||||||
|
find . -type f \( -path ".git" -o -path "keystore" -o -path "archives" \) -prune \( -name "*.sha512" -o -name "checksums*" -o -name "private_*" -o -name ".*" -o -name "*.sig" -o -name "*.7z" -o -name "anonymous_signer" \) -print -exec shred -uz {} \;
|
||||||
|
checkcode $?
|
||||||
|
|
||||||
|
printf "nuking errant priv key files"
|
||||||
shred -uz private_*
|
shred -uz private_*
|
||||||
echo $?
|
checkcode $?
|
||||||
shred -uz *.pub
|
shred -uz *.pub
|
||||||
echo $?
|
checkcode $?
|
||||||
shred -uz attribution_passphrase_*
|
shred -uz attribution_passphrase_*
|
||||||
echo $?
|
checkcode $?
|
||||||
|
|
||||||
echo "autoshredding out"
|
echo "autoshredding out"
|
||||||
srm -r -z -l -l ./out
|
srm -r -z -l -l ./out
|
||||||
echo $?
|
checkcode $?
|
||||||
|
|
||||||
echo "rebuilding out"
|
echo "rebuilding out"
|
||||||
|
printf "making out dir structure"
|
||||||
mkdir -p out/contents
|
mkdir -p out/contents
|
||||||
echo $?
|
checkcode $?
|
||||||
|
printf "updating out/contents/READMD.md"
|
||||||
echo "put files to verifiably archive in here" > out/contents/README.md
|
echo "put files to verifiably archive in here" > out/contents/README.md
|
||||||
|
checkcode $?
|
||||||
|
printf "updating out/README.md"
|
||||||
echo "# todo: make this nice" > ./out/README.md
|
echo "# todo: make this nice" > ./out/README.md
|
||||||
|
checkcode $?
|
||||||
|
|
||||||
|
printf "making out/test_validate_passphrase.sh"
|
||||||
cp test_validation_passphrase.txt out/test_validate_passphrase.sh
|
cp test_validation_passphrase.txt out/test_validate_passphrase.sh
|
||||||
echo $?
|
checkcode $?
|
||||||
|
printf "making out/test_validate_passphrase.sh executable"
|
||||||
chmod +x out/test_validate_passphrase.sh
|
chmod +x out/test_validate_passphrase.sh
|
||||||
echo $?
|
checkcode $?
|
||||||
|
printf "making out/verify-everything.sh"
|
||||||
cp verify-everything.txt out/verify-everything.sh
|
cp verify-everything.txt out/verify-everything.sh
|
||||||
echo $?
|
checkcode $?
|
||||||
|
printf "making out/verify-everything.sh executable"
|
||||||
chmod +x out/verify-everything.sh
|
chmod +x out/verify-everything.sh
|
||||||
echo $?
|
checkcode $?
|
||||||
echo done :3
|
|
||||||
|
echo -e "\n\ndone :3\n\n"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user