1
0
mirror of https://github.com/deajan/obackup.git synced 2024-12-24 14:33:41 +01:00

Added SetEncryption before all functions

This commit is contained in:
deajan 2016-09-04 09:38:11 +02:00
parent 1187360b62
commit e0a8c5567d

View File

@ -96,7 +96,9 @@ function SetEncryption () {
function SetupGPG { function SetupGPG {
if type gpg2 > /dev/null; then if type gpg2 > /dev/null; then
GPG=gpg2 GPG=gpg2
echo "USING GPG2"
elif type gpg > /dev/null; then elif type gpg > /dev/null; then
echo "USING GPG"
GPG=gpg GPG=gpg
else else
echo "No gpg support" echo "No gpg support"
@ -119,7 +121,7 @@ Passphrase: PassPhrase123
EOF EOF
if type apt-get > /dev/null 2>&1; then if type apt-get > /dev/null 2>&1; then
apt-get install rng-tools sudo apt-get install rng-tools
fi fi
# Setup fast entropy # Setup fast entropy
@ -212,6 +214,8 @@ function test_Merge () {
} }
function test_LocalRun () { function test_LocalRun () {
SetEncryption "$CONF_DIR/$LOCAL_CONF" false
# Basic return code tests. Need to go deep into file presence testing # Basic return code tests. Need to go deep into file presence testing
cd "$OBACKUP_DIR" cd "$OBACKUP_DIR"
./$OBACKUP_EXECUTABLE "$CONF_DIR/$LOCAL_CONF" ./$OBACKUP_EXECUTABLE "$CONF_DIR/$LOCAL_CONF"
@ -258,6 +262,8 @@ function test_LocalRun () {
} }
function test_PullRun () { function test_PullRun () {
SetEncryption "$CONF_DIR/$LOCAL_CONF" false
# Basic return code tests. Need to go deep into file presence testing # Basic return code tests. Need to go deep into file presence testing
cd "$OBACKUP_DIR" cd "$OBACKUP_DIR"
./$OBACKUP_EXECUTABLE "$CONF_DIR/$PULL_CONF" ./$OBACKUP_EXECUTABLE "$CONF_DIR/$PULL_CONF"
@ -305,6 +311,8 @@ function test_PullRun () {
} }
function test_PushRun () { function test_PushRun () {
SetEncryption "$CONF_DIR/$LOCAL_CONF" false
# Basic return code tests. Need to go deep into file presence testing # Basic return code tests. Need to go deep into file presence testing
cd "$OBACKUP_DIR" cd "$OBACKUP_DIR"
./$OBACKUP_EXECUTABLE "$CONF_DIR/$PUSH_CONF" ./$OBACKUP_EXECUTABLE "$CONF_DIR/$PUSH_CONF"
@ -397,14 +405,13 @@ function test_EncryptLocalRun () {
[ -d "$TARGET_DIR_FILE_LOCAL/$(dirname $SOURCE_DIR)$CRYPT_EXTENSION$ROTATE_1_EXTENSION" ] [ -d "$TARGET_DIR_FILE_LOCAL/$(dirname $SOURCE_DIR)$CRYPT_EXTENSION$ROTATE_1_EXTENSION" ]
assertEquals "File rotated Presence [$TARGET_DIR_FILE_LOCAL/$(dirname $SOURCE_DIR)$CRYPT_EXTENSION$ROTATE_1_EXTENSION]" "0" $? assertEquals "File rotated Presence [$TARGET_DIR_FILE_LOCAL/$(dirname $SOURCE_DIR)$CRYPT_EXTENSION$ROTATE_1_EXTENSION]" "0" $?
SetEncryption "$CONF_DIR/$LOCAL_CONF" false
./$OBACKUP_EXECUTABLE --decrypt="$TARGET_DIR_SQL_LOCAL" --passphrase-file="$TESTS_DIR/$PASSFILE" ./$OBACKUP_EXECUTABLE --decrypt="$TARGET_DIR_SQL_LOCAL" --passphrase-file="$TESTS_DIR/$PASSFILE"
assertEquals "Decrypt sql storage in [$TARGET_DIR_SQL_LOCAL]" "0" $? assertEquals "Decrypt sql storage in [$TARGET_DIR_SQL_LOCAL]" "0" $?
./$OBACKUP_EXECUTABLE --decrypt="$TARGET_DIR_FILE_CRYPT" --passphrase-file="$TESTS_DIR/$PASSFILE" ./$OBACKUP_EXECUTABLE --decrypt="$TARGET_DIR_FILE_CRYPT" --passphrase-file="$TESTS_DIR/$PASSFILE"
assertEquals "Decrypt file storage in [$TARGET_DIR_FILE_CRYPT]" "0" $? assertEquals "Decrypt file storage in [$TARGET_DIR_FILE_CRYPT]" "0" $?
SetEncryption "$CONF_DIR/$LOCAL_CONF" false
} }
function test_EncryptPullRun () { function test_EncryptPullRun () {
@ -454,14 +461,13 @@ function test_EncryptPullRun () {
[ -d "$TARGET_DIR_FILE_CRYPT/$(dirname $SOURCE_DIR)$CRYPT_EXTENSION$ROTATE_1_EXTENSION" ] [ -d "$TARGET_DIR_FILE_CRYPT/$(dirname $SOURCE_DIR)$CRYPT_EXTENSION$ROTATE_1_EXTENSION" ]
assertEquals "File rotated Presence [$TARGET_DIR_FILE_CRYPT/$(dirname $SOURCE_DIR)$CRYPT_EXTENSION$ROTATE_1_EXTENSION]" "0" $? assertEquals "File rotated Presence [$TARGET_DIR_FILE_CRYPT/$(dirname $SOURCE_DIR)$CRYPT_EXTENSION$ROTATE_1_EXTENSION]" "0" $?
SetEncryption "$CONF_DIR/$PULL_CONF" false
./$OBACKUP_EXECUTABLE --decrypt="$TARGET_DIR_SQL_PULL" --passphrase-file="$TESTS_DIR/$PASSFILE" ./$OBACKUP_EXECUTABLE --decrypt="$TARGET_DIR_SQL_PULL" --passphrase-file="$TESTS_DIR/$PASSFILE"
assertEquals "Decrypt sql storage in [$TARGET_DIR_SQL_PULL]" "0" $? assertEquals "Decrypt sql storage in [$TARGET_DIR_SQL_PULL]" "0" $?
./$OBACKUP_EXECUTABLE --decrypt="$TARGET_DIR_FILE_CRYPT" --passphrase-file="$TESTS_DIR/$PASSFILE" ./$OBACKUP_EXECUTABLE --decrypt="$TARGET_DIR_FILE_CRYPT" --passphrase-file="$TESTS_DIR/$PASSFILE"
assertEquals "Decrypt file storage in [$TARGET_DIR_FILE_CRYPT]" "0" $? assertEquals "Decrypt file storage in [$TARGET_DIR_FILE_CRYPT]" "0" $?
SetEncryption "$CONF_DIR/$PULL_CONF" false
} }
function test_EncryptPushRun () { function test_EncryptPushRun () {
@ -511,13 +517,13 @@ function test_EncryptPushRun () {
[ -d "$TARGET_DIR_FILE_PUSH/$(dirname $SOURCE_DIR)$CRYPT_EXTENSION$ROTATE_1_EXTENSION" ] [ -d "$TARGET_DIR_FILE_PUSH/$(dirname $SOURCE_DIR)$CRYPT_EXTENSION$ROTATE_1_EXTENSION" ]
assertEquals "File rotated Presence [$TARGET_DIR_FILE_PUSH/$(dirname $SOURCE_DIR)$CRYPT_EXTENSION$ROTATE_1_EXTENSION]" "0" $? assertEquals "File rotated Presence [$TARGET_DIR_FILE_PUSH/$(dirname $SOURCE_DIR)$CRYPT_EXTENSION$ROTATE_1_EXTENSION]" "0" $?
SetEncryption "$CONF_DIR/$PUSH_CONF" false
./$OBACKUP_EXECUTABLE --decrypt="$TARGET_DIR_SQL_PUSH" --passphrase-file="$TESTS_DIR/$PASSFILE" ./$OBACKUP_EXECUTABLE --decrypt="$TARGET_DIR_SQL_PUSH" --passphrase-file="$TESTS_DIR/$PASSFILE"
assertEquals "Decrypt sql storage in [$TARGET_DIR_SQL_PUSH]" "0" $? assertEquals "Decrypt sql storage in [$TARGET_DIR_SQL_PUSH]" "0" $?
./$OBACKUP_EXECUTABLE --decrypt="$TARGET_DIR_FILE_PUSH" --passphrase-file="$TESTS_DIR/$PASSFILE" ./$OBACKUP_EXECUTABLE --decrypt="$TARGET_DIR_FILE_PUSH" --passphrase-file="$TESTS_DIR/$PASSFILE"
assertEquals "Decrypt file storage in [$TARGET_DIR_FILE_PUSH]" "0" $? assertEquals "Decrypt file storage in [$TARGET_DIR_FILE_PUSH]" "0" $?
SetEncryption "$CONF_DIR/$PUSH_CONF" false
} }
function test_WaitForTaskCompletion () { function test_WaitForTaskCompletion () {