From a497edf8b9df24be69fd323f755dcc703709287f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cyryl=20P=C5=82otnicki?= Date: Sat, 8 Oct 2016 08:04:46 +0200 Subject: [PATCH] CHecksum calculation --- tools/mount-vault | 5 ++++- tools/umount-vault | 8 ++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/tools/mount-vault b/tools/mount-vault index 685149ff..2dd5183e 100755 --- a/tools/mount-vault +++ b/tools/mount-vault @@ -2,7 +2,10 @@ set -e echo "decrypting..." -gpg2 -d ~/Nextcloud/vault.zip.gpg > ~/.vault.zip +cp -v ~/Nextcloud/vault.zip.gpg ~/.vault.zip.gpg +cp -v ~/Nextcloud/vault.zip.gpg.sha512 ~/.vault.zip.gpg.sha512 +sha512sum -c ~/.vault.zip.gpg.sha512 +gpg2 -d ~/.vault.zip.gpg > ~/.vault.zip echo "mounting..." mkdir -p ~/.vault archivemount -o nobackup ~/.vault.zip ~/.vault diff --git a/tools/umount-vault b/tools/umount-vault index 56da2175..5f6a9212 100755 --- a/tools/umount-vault +++ b/tools/umount-vault @@ -1,8 +1,16 @@ #!/bin/bash set -e +echo "Unmounting vault.." sudo umount ~/.vault +echo "Encrypting archive..." gpg2 -c ~/.vault.zip +echo "Calculating checksum..." +sha512sum ~/.vault.zip.gpg > ~/.vault.zip.gpg.sha512 +sha512sum -c ~/.vault.zip.gpg.sha512 +cat ~/.vault.zip.gpg.sha512 +echo "Moving vault to storage..." mv ~/.vault.zip.gpg ~/Nextcloud/vault.zip.gpg +mv ~/.vault.zip.gpg.sha512 ~/Nextcloud/vault.zip.gpg.sha512 rm -vfr ~/.vault*