Browse Source

ZFEC support as ECC engine due to issue between libcurlftpfs and par2 + parallel de/compression support

master
Guillaume REMBERT 6 years ago
parent
commit
91abb7a365
  1. 20
      cfg/sw/eurybox.conf
  2. 2
      sw/src/administration_center/core/backup/eurybox_backup
  3. 13
      sw/src/administration_center/core/management/eurybox_exec_commands
  4. 4
      sw/src/eurybox.functions.backup
  5. 8
      sw/src/eurybox.functions.check
  6. 98
      sw/src/eurybox.functions.create
  7. 6
      sw/src/eurybox.functions.detect
  8. 30
      sw/src/eurybox.functions.euryboxctrl
  9. 36
      sw/src/eurybox.functions.tools

20
cfg/sw/eurybox.conf

@ -9,13 +9,13 @@ EURYBOX_CORPORATE="My Corporate" @@ -9,13 +9,13 @@ EURYBOX_CORPORATE="My Corporate"
#Details level on script execution
#Can be: debug, verbose, info, warning or error
EURYBOX_LOG_LEVEL="debug"
EURYBOX_LOG_LEVEL="info"
#Parallelism depth / depends on host CPU
EURYBOX_PARALLELISM_LEVEL="8"
#Max retry on failure before stopping execution
EURYBOX_MAX_RETRY_ON_FAILURE="5"
#Network calls timeout (in seconds)
EURYBOX_NETWORK_TIMEOUT="2"
EURYBOX_NETWORK_TIMEOUT="1"
#Version
EURYBOX_VERSION="1.0"
@ -95,21 +95,27 @@ EURYBOX_BACKUP_TARGETS=( @@ -95,21 +95,27 @@ EURYBOX_BACKUP_TARGETS=(
#Backup archive
#FORMAT= tar/tar.gz/tar.bz2
#HASH= sha256/sha512
#ECC= par2
#ECC_LEVEL = 0/1/.../99/100
#FEC= par2/zfec
#FEC_FILE_NUM = 1/2/...
#FEC_LEVEL = 0/1/.../99/100
#FEC_FILE_NUM_MIN = 1/2/... (<= FEC_FILE_NUM)
#ENC_ALGO= openssl supported algo (aes-256-xts/aes-256-ctr/...)
EURYBOX_BACKUP_ARCHIVE=(
[NAME]="nodeXX_archive"
[OWNER]="root:root"
[MASK]="400"
[LABEL]="backup_u:object_r:backup_t:s0"
[FORMAT]="tar"
[FORMAT]="tar.bz2"
[HASH]="sha512"
[ECC]="par2"
[ECC_LEVEL]="10"
[ENCRYPT]="true"
[ENC_ALGO]="aes-256-ctr"
[PASSWORD]="MyStrongEncryptionPassword"
[FEC]="zfec"
[FEC_FILE_NUM]="10"
#FOR PAR2 ONLY
[FEC_LEVEL]="10"
#FOR ZFEC ONLY
[FEC_FILE_NUM_MIN]="5"
)
#Backup destination

2
sw/src/administration_center/core/backup/eurybox_backup

@ -54,7 +54,7 @@ case $EURYBOX_BACKUP_TYPE in @@ -54,7 +54,7 @@ case $EURYBOX_BACKUP_TYPE in
#Create archive file
euryboxctrl_create_arch
#Re-Start all VMs
euryboxctrl_start_services
# euryboxctrl_start_services
#Create errors correcting codes files
euryboxctrl_create_eccf
#Create description file

13
sw/src/administration_center/core/management/eurybox_exec_commands

@ -28,7 +28,7 @@ else @@ -28,7 +28,7 @@ else
exit 1
fi
eurybox_message_display message STATUS "Checking configuration"
eurybox_check_configuration BACKUP
eurybox_check_configuration EXEC_COMMAND
#Check input parameters
eurybox_message_display message STATUS "Checking parameters"
@ -36,19 +36,18 @@ eurybox_check_arguments $SCRIPT_ARGUMENTS @@ -36,19 +36,18 @@ eurybox_check_arguments $SCRIPT_ARGUMENTS
#Check environment
eurybox_message_display message STATUS "Checking environment"
eurybox_check_environment BACKUP
eurybox_message_display message STATUS "$EURYBOX_CORPORATE exec commands script started"
eurybox_check_environment EXEC_COMMAND
eurybox_message_display message STATUS "$EURYBOX_CORPORATE execute commands script started"
#Start all VMs
euryboxctrl_start_services
#Execution commands on virtual machines / services
#Execute commands on virtual machines / services
euryboxctrl_exec_command_services
#Finished
END_TIME=$(date +%s)
DIFF_TIME=$(( $END_TIME - $START_TIME ))
eurybox_message_display message STATUS "Command exec finished"
eurybox_message_display message TIMING "Command exec took $DIFF_TIME seconds"
eurybox_message_display message STATUS "Commands execution finished"
eurybox_message_display message TIMING "Commands execution took $DIFF_TIME seconds"

4
sw/src/eurybox.functions.backup

@ -118,7 +118,7 @@ eurybox_backup_mount_target () @@ -118,7 +118,7 @@ eurybox_backup_mount_target ()
if [[ !($STATUS -eq 0) ]]
then
NB_TRY_LEFT=$(( $NB_TRY_LEFT - 1 ))
eurybox_display_message warning BACKUP "Backup target SSHFS mount failed and target folder is empty - trying to mount again in 5 seconds - error $STATUS:\n$MOUNT_OUT\n$NB_TRY_LEFT left"
eurybox_display_message warning BACKUP "Backup target SSHFS mount failed - trying to mount again in 5 seconds - error $STATUS:\n$MOUNT_OUT\n$NB_TRY_LEFT left"
sleep 5
fi
fi
@ -139,7 +139,7 @@ eurybox_backup_mount_target () @@ -139,7 +139,7 @@ eurybox_backup_mount_target ()
if [[ !($STATUS -eq 0) ]]
then
NB_TRY_LEFT=$(( $NB_TRY_LEFT - 1 ))
eurybox_display_message warning BACKUP "Backup target FTPFS mount failed and target folder is empty - trying to mount again in 5 seconds - error $STATUS:\n$MOUNT_OUT\n$NB_TRY_LEFT left"
eurybox_display_message warning BACKUP "Backup target FTPFS mount failed - trying to mount again in 5 seconds - error $STATUS:\n$MOUNT_OUT\n$NB_TRY_LEFT left"
sleep 5
fi
fi

8
sw/src/eurybox.functions.check

@ -125,7 +125,7 @@ eurybox_check_configuration () @@ -125,7 +125,7 @@ eurybox_check_configuration ()
EURYBOX_SSH_OPTIONS="-oPasswordAuthentication=no -oConnectTimeout=$EURYBOX_NETWORK_TIMEOUT -oConnectionAttempts=$EURYBOX_MAX_RETRY_ON_FAILURE"
EURYBOX_NMAP_OPTIONS="--host-timeout $EURYBOX_NETWORK_TIMEOUT --max-retries $EURYBOX_MAX_RETRY_ON_FAILURE"
EURYBOX_LS_OPTIONS="-x"
EURYBOX_MNT_NFS_OPTIONS="-o hard,retry=$EURYBOX_MAX_RETRY_ON_FAILURE,rsize=8192,wsize=8192,timeo=${EURYBOX_NETWORK_TIMEOUT}0"
EURYBOX_MNT_NFS_OPTIONS="-o hard,retry=$EURYBOX_MAX_RETRY_ON_FAILURE,timeo=${EURYBOX_NETWORK_TIMEOUT}0"
EURYBOX_MNT_SSHFS_OPTIONS="-o allow_root ${EURYBOX_SSH_OPTIONS}"
EURYBOX_MNT_FTPFS_OPTIONS="-o allow_root,connect_timeout=${EURYBOX_NETWORK_TIMEOUT}"
case $EURYBOX_LOG_LEVEL in
@ -147,14 +147,14 @@ eurybox_check_configuration () @@ -147,14 +147,14 @@ eurybox_check_configuration ()
EURYBOX_MNT_NFS_OPTIONS+=" -v"
EURYBOX_MNT_SSHFS_OPTIONS+=" -oLogLevel=verbose"
EURYBOX_MNT_FTPFS_OPTIONS+=" -v"
EURYBOX_VIRSH_OPTIONS+=" -q -d 4"
EURYBOX_VIRSH_OPTIONS+=" -q -d 3"
;;
info )
EURYBOX_SSH_OPTIONS+=" -oLogLevel=info"
EURYBOX_NMAP_OPTIONS+=" -d0 -v"
EURYBOX_LS_OPTIONS+=" -l"
EURYBOX_MNT_SSHFS_OPTIONS+=" -oLogLevel=info"
EURYBOX_VIRSH_OPTIONS+=" -q -d 6"
EURYBOX_VIRSH_OPTIONS+=" -q -d 4"
;;
warning )
EURYBOX_SSH_OPTIONS+=" -oLogLevel=info"
@ -261,7 +261,7 @@ eurybox_check_environment () @@ -261,7 +261,7 @@ eurybox_check_environment ()
local BKP_SPACE_LEFT
local BKP_ACCESS_OK
#Check external sotfware used
eurybox_check_command grep sudo ssh openssl tar par2 virsh sha512sum sha256sum awk pigz df tail virt-sysprep tput nmap rpcinfo pbzip2 sshfs curlftpfs lftp cryptsetup
eurybox_check_command grep sudo ssh openssl tar par2 zfec virsh sha512sum sha256sum awk df tail virt-sysprep tput nmap rpcinfo pigz pbzip2 sshfs curlftpfs lftp cryptsetup
#Check kernel capabilities
eurybox_check_kernel
#Check distribution is coherent with configuration

98
sw/src/eurybox.functions.create

@ -8,49 +8,24 @@ eurybox_create_archive_desc () @@ -8,49 +8,24 @@ eurybox_create_archive_desc ()
local SYNC_OUT
local STATUS
local DESCRIPTION
#TODO: IMPLEMENT PARALLEL EXTRACTION FOR GZ AND BZ2
case ${EURYBOX_BACKUP_ARCHIVE[FORMAT]} in
"tar" ) TAR_OPTIONS="-Stv" ;;
"tar.gz" ) TAR_OPTIONS="-Stvz" ;;
"tar.bz2" ) TAR_OPTIONS="-Stvj" ;;
"tar" ) TAR_OPTIONS="-Stv";;
"tar.gz" ) TAR_OPTIONS="-Stv --use-compress-program=pigz";;
"tar.bz2" ) TAR_OPTIONS="-Stv --use-compress-program=lbzip2";;
esac
STATUS=1234
DESTINATION=${EURYBOX_BACKUP_DESTINATION[MOUNT]}/${EURYBOX_BACKUP_ARCHIVE[NAME]}.desc
DESCRIPTION="ARCHIVE_CONTENT:${EURYBOX_CORPORATE}\nARCHIVE_FILE:${EURYBOX_BACKUP_ARCHIVE[NAME]}\nARCHIVE_FORMAT:${EURYBOX_BACKUP_ARCHIVE[FORMAT]}\nARCHIVE_TARGETS:${EURYBOX_BACKUP_TARGETS[*]}\nARCHIVE_TYPE:${EURYBOX_BACKUP_TYPE}\nARCHIVE_VERSION:${EURYBOX_VERSION}\nECC_FILE:${EURYBOX_BACKUP_ARCHIVE[NAME]}.${EURYBOX_BACKUP_ARCHIVE[ECC]}\nECC_FORMAT:${EURYBOX_BACKUP_ARCHIVE[ECC]}\nECC_LEVEL:${EURYBOX_BACKUP_ARCHIVE[ECC_LEVEL]\%}\nHASH_FILE:${EURYBOX_BACKUP_ARCHIVE[NAME]}.${EURYBOX_BACKUP_ARCHIVE[HASH]}\nENCRYPTED_ARCHIVE:${EURYBOX_BACKUP_ARCHIVE[ENCRYPT]}\n"
# DESC_OUT=`sudo sh -c "echo ARCHIVE_CONTENT:$EURYBOX_CORPORATE >> $DESTINATION" 2>&1`
# DESC_OUT=`sudo sh -c "echo ARCHIVE_FILE:${EURYBOX_BACKUP_ARCHIVE[NAME]} >> $DESTINATION" 2>&1`
# DESC_OUT=`sudo sh -c "echo ARCHIVE_FORMAT:${EURYBOX_BACKUP_ARCHIVE[FORMAT]} >> $DESTINATION" 2>&1`
# DESC_OUT=`sudo sh -c "echo ARCHIVE_TARGETS:${EURYBOX_BACKUP_TARGETS[*]} >> $DESTINATION" 2>&1`
# DESC_OUT=`sudo sh -c "echo ARCHIVE_TYPE:$EURYBOX_BACKUP_TYPE >> $DESTINATION" 2>&1`
# DESC_OUT=`sudo sh -c "echo ARCHIVE_VERSION:$EURYBOX_VERSION >> $DESTINATION" 2>&1`
# DESC_OUT=`sudo sh -c "echo ECC_FILE:${EURYBOX_BACKUP_ARCHIVE[NAME]}.${EURYBOX_BACKUP_ARCHIVE[ECC]} >> $DESTINATION" 2>&1`
# DESC_OUT=`sudo sh -c "echo ECC_FORMAT:${EURYBOX_BACKUP_ARCHIVE[ECC]} >> $DESTINATION" 2>&1`
# DESC_OUT=`sudo sh -c "echo ECC_LEVEL:${EURYBOX_BACKUP_ARCHIVE[ECC_LEVEL]\%} >> $DESTINATION" 2>&1`
# DESC_OUT=`sudo sh -c "echo HASH_FILE:${EURYBOX_BACKUP_ARCHIVE[NAME]}.${EURYBOX_BACKUP_ARCHIVE[HASH]} >> $DESTINATION" 2>&1`
# DESC_OUT=`sudo sh -c "echo HASH_FORMAT:${EURYBOX_BACKUP_ARCHIVE[HASH]} >> $DESTINATION" 2>&1`
# DESC_OUT=`sudo sh -c "echo ENCRYPTED_ARCHIVE:${EURYBOX_BACKUP_ARCHIVE[ENCRYPT]} >> $DESTINATION" 2>&1`
DESCRIPTION="ARCHIVE_CONTENT:${EURYBOX_CORPORATE}\nARCHIVE_FORMAT:${EURYBOX_BACKUP_ARCHIVE[FORMAT]}\nARCHIVE_TARGETS:${EURYBOX_BACKUP_TARGETS[*]}\nARCHIVE_TYPE:${EURYBOX_BACKUP_TYPE}\nARCHIVE_VERSION:${EURYBOX_VERSION}\nFEC_FORMAT:${EURYBOX_BACKUP_ARCHIVE[FEC]}\nHASH_FORMAT:${EURYBOX_BACKUP_ARCHIVE[HASH]}\nENCRYPTED_ARCHIVE:${EURYBOX_BACKUP_ARCHIVE[ENCRYPT]}\n"
if [[ ${EURYBOX_BACKUP_ARCHIVE[ENCRYPT]} = "true" ]]
then
DESCRIPTION+="ENCRYPTION_ALGORITHM:${EURYBOX_BACKUP_ARCHIVE[ENC_ALGO]}\nARCHIVE_CONTENT:\n"
#FIXME: function to read archive with variable archive format required here
DESCRIPTION+=`sudo sh -c "openssl enc -${EURYBOX_BACKUP_ARCHIVE[ENC_ALGO]} -d -in ${EURYBOX_BACKUP_DESTINATION[MOUNT]}/${EURYBOX_BACKUP_ARCHIVE[NAME]}.${EURYBOX_BACKUP_ARCHIVE[FORMAT]} -k ${EURYBOX_BACKUP_ARCHIVE[PASSWORD]} | tar ${TAR_OPTIONS}"`
# DESC_OUT=`sudo sh -c "echo ENCRYPTION_ALGORITHM:${EURYBOX_BACKUP_ARCHIVE[ENC_ALGO]} >> $DESTINATION" 2>&1`
# DESC_OUT=`sudo sh -c "echo ARCHIVE_CONTENT: >> $DESTINATION" 2>&1`
# DESC_OUT=$((
# (
# sudo sh -c "openssl enc -${EURYBOX_BACKUP_ARCHIVE[ENC_ALGO]} -d -in ${EURYBOX_BACKUP_DESTINATION[MOUNT]}/${EURYBOX_BACKUP_ARCHIVE[NAME]}.${EURYBOX_BACKUP_ARCHIVE[FORMAT]} -k ${EURYBOX_BACKUP_ARCHIVE[PASSWORD]} | tar ${TAR_OPTIONS} >> $DESTINATION"
# STATUS=$(( ${PIPESTATUS[0]} + ${PIPESTATUS[1]} ))
# )) 2>&1)
STATUS=$?
else
DESCRIPTION+="ARCHIVE_CONTENT:\n"
#FIXME: function to read archive with variable archive format required here
DESCRIPTION+=`sudo sh -c "tar ${TAR_OPTIONS}f ${EURYBOX_BACKUP_DESTINATION[MOUNT]}/${EURYBOX_BACKUP_ARCHIVE[NAME]}.${EURYBOX_BACKUP_ARCHIVE[FORMAT]}"`
# DESC_OUT=`sudo sh -c "sudo echo ARCHIVE_CONTENT: >> $DESTINATION" 2>&1`
# DESC_OUT=$((
# (
# sudo sh -c "tar ${TAR_OPTIONS}f ${EURYBOX_BACKUP_DESTINATION[MOUNT]}/${EURYBOX_BACKUP_ARCHIVE[NAME]}.${EURYBOX_BACKUP_ARCHIVE[FORMAT]} >> $DESTINATION"
# )) 2>&1)
STATUS=$?
fi
if [[ !($STATUS -eq 0) ]]
@ -92,10 +67,9 @@ eurybox_create_archive_tar () @@ -92,10 +67,9 @@ eurybox_create_archive_tar ()
TAR_OPTIONS="-"
fi
case ${EURYBOX_BACKUP_ARCHIVE[FORMAT]} in
"tar" ) TAR_OPTIONS="${TAR_OPTIONS}Sc" ;;
"tar.gz" ) TAR_OPTIONS="${TAR_OPTIONS}Sc --use-compress-program=pigz" ;;
"tar.bz2" ) TAR_OPTIONS="${TAR_OPTIONS}Sc --use-compress-program=pbzip2 " ;;
#xz
"tar" ) TAR_OPTIONS="${TAR_OPTIONS}Sc";;
"tar.gz" ) TAR_OPTIONS="${TAR_OPTIONS}Sc --use-compress-program=pigz";;
"tar.bz2" ) TAR_OPTIONS="${TAR_OPTIONS}Sc --use-compress-program=pbzip2";;
esac
if [[ ${EURYBOX_BACKUP_ARCHIVE[ENCRYPT]} = "true" ]]
then
@ -127,49 +101,61 @@ eurybox_create_archive_tar () @@ -127,49 +101,61 @@ eurybox_create_archive_tar ()
fi
}
#FIXME: par2 has issues with curlftpfs - flush failed (ftpfs: operation ftpfs_write failed because Input/output error)
#FIXME: extract function parameters to transfer to control section use and make functions more generic and reusable
eurybox_create_archive_par ()
eurybox_create_archive_fec ()
{
local PAR_OUT
local FEC_OUT
local SYNC_OUT
local STATUS
local FEC_LEVEL="${EURYBOX_BACKUP_ARCHIVE[FEC_LEVEL]}"
local FEC_TYPE="${EURYBOX_BACKUP_ARCHIVE[FEC]}"
local FEC_FILE_NUM="${EURYBOX_BACKUP_ARCHIVE[FEC_FILE_NUM]}"
local FEC_FILE_NUM_MIN="${EURYBOX_BACKUP_ARCHIVE[FEC_FILE_NUM_MIN]}"
local FEC_TARGET="${EURYBOX_BACKUP_DESTINATION[MOUNT]}/${EURYBOX_BACKUP_ARCHIVE[NAME]}.${EURYBOX_BACKUP_ARCHIVE[FORMAT]}"
local FEC_DESTINATION="${EURYBOX_BACKUP_DESTINATION[MOUNT]}/${EURYBOX_BACKUP_ARCHIVE[NAME]}.${EURYBOX_BACKUP_ARCHIVE[FEC]}"
case $EURYBOX_LOG_LEVEL in
debug|verbose ) PAR_OPTIONS="-v -v";;
message ) PAR_OPTIONS="-v";;
warning ) PAR_OPTIONS="-q";;
error ) PAR_OPTIONS="-q -q";;
debug|verbose ) FEC_OPTIONS="-v";;
message ) FEC_OPTIONS="";;
warning ) FEC_OPTIONS="";;
error ) FEC_OPTIONS="-q";;
esac
case "${EURYBOX_BACKUP_ARCHIVE[ECC]}" in
"par2" )
PAR_OUT=`sudo sh -c "par2 c $PAR_OPTIONS -r${EURYBOX_BACKUP_ARCHIVE[ECC_LEVEL]} -t+ ${EURYBOX_BACKUP_DESTINATION[MOUNT]}/${EURYBOX_BACKUP_ARCHIVE[NAME]}.${EURYBOX_BACKUP_ARCHIVE[ECC]} ${EURYBOX_BACKUP_DESTINATION[MOUNT]}/${EURYBOX_BACKUP_ARCHIVE[NAME]}.${EURYBOX_BACKUP_ARCHIVE[FORMAT]}" 2>&1`
case "$FEC_TYPE" in
par2 )
FEC_OUT=`sudo sh -c "par2 c $FEC_OPTIONS -r${FEC_LEVEL} -n${FEC_FILE_NUM} -u -t+ ${FEC_DESTINATION} ${FEC_TARGET}" 2>&1`
STATUS=$?
;;
zfec )
FEC_OUT=`sudo sh -c "zfec $FEC_OPTIONS -m ${FEC_FILE_NUM} -k ${FEC_FILE_NUM_MIN} ${FEC_TARGET}" 2>&1`
STATUS=$?
;;
* )
eurybox_display_message error CREATE "Archive ecc format unknown: ${EURYBOX_BACKUP_ARCHIVE[HASH]}"
eurybox_display_message error CREATE "Archive FEC format unknown: ${EURYBOX_BACKUP_ARCHIVE[FEC]}"
;;
esac
if [[ !($STATUS -eq 0) ]]
then
eurybox_display_message warning ARCHIVE "Archive ecc creation failed - error $STATUS:\n$PAR_OUT"
eurybox_display_message warning ARCHIVE "Archive FEC creation failed - error $STATUS:\n$FEC_OUT"
else
eurybox_display_message message CREATE "Archive ecc creation - OK"
eurybox_display_message debug CREATE "Ecc command output:\n$PAR_OUT"
eurybox_display_message message CREATE "Archive FEC creation - OK"
eurybox_display_message debug CREATE "FEC command output:\n$FEC_OUT"
SYNC_OUT=`sudo sync 2>&1`
STATUS=$?
if [[ !($STATUS -eq 0) ]]
then
eurybox_display_message warning CREATE "Archive description FS sync failed - error $STATUS:\n$SYNC_OUT"
eurybox_display_message warning CREATE "Archive FEC FS sync failed - error $STATUS:\n$SYNC_OUT"
else
eurybox_display_message message CREATE "Archive description FS sync - OK"
eurybox_display_message message CREATE "Archive FEC FS sync - OK"
eurybox_display_message debug CREATE "Sync command output:\n$SYNC_OUT"
fi
fi
}
#FIXME: extract function parameters to transfer to control section use and make functions more generic and reusable
eurybox_create_archive_sha ()
eurybox_create_archive_hash ()
{
local SHA_OUT
local HASH_OUT
local SYNC_OUT
local STATUS
case $EURYBOX_LOG_LEVEL in
@ -180,11 +166,11 @@ eurybox_create_archive_sha () @@ -180,11 +166,11 @@ eurybox_create_archive_sha ()
esac
case "${EURYBOX_BACKUP_ARCHIVE[HASH]}" in
"sha256" )
SHA_OUT=`sudo sh -c "sha256sum $SHA_OPTIONS ${EURYBOX_BACKUP_DESTINATION[MOUNT]}/${EURYBOX_BACKUP_ARCHIVE[NAME]}* > ${EURYBOX_BACKUP_DESTINATION[MOUNT]}/${EURYBOX_BACKUP_ARCHIVE[NAME]}.${EURYBOX_BACKUP_ARCHIVE[HASH]}" 2>&1`
HASH_OUT=`sudo sh -c "sha256sum $SHA_OPTIONS ${EURYBOX_BACKUP_DESTINATION[MOUNT]}/${EURYBOX_BACKUP_ARCHIVE[NAME]}* > ${EURYBOX_BACKUP_DESTINATION[MOUNT]}/${EURYBOX_BACKUP_ARCHIVE[NAME]}.${EURYBOX_BACKUP_ARCHIVE[HASH]}" 2>&1`
STATUS=$?
;;
"sha512" )
SHA_OUT=`sudo sh -c "sha512sum $SHA_OPTIONS ${EURYBOX_BACKUP_DESTINATION[MOUNT]}/${EURYBOX_BACKUP_ARCHIVE[NAME]}* > ${EURYBOX_BACKUP_DESTINATION[MOUNT]}/${EURYBOX_BACKUP_ARCHIVE[NAME]}.${EURYBOX_BACKUP_ARCHIVE[HASH]}" 2>&1`
HASH_OUT=`sudo sh -c "sha512sum $SHA_OPTIONS ${EURYBOX_BACKUP_DESTINATION[MOUNT]}/${EURYBOX_BACKUP_ARCHIVE[NAME]}* > ${EURYBOX_BACKUP_DESTINATION[MOUNT]}/${EURYBOX_BACKUP_ARCHIVE[NAME]}.${EURYBOX_BACKUP_ARCHIVE[HASH]}" 2>&1`
STATUS=$?
;;
* )
@ -193,17 +179,17 @@ eurybox_create_archive_sha () @@ -193,17 +179,17 @@ eurybox_create_archive_sha ()
esac
if [[ !($STATUS -eq 0) ]]
then
eurybox_display_message warning CREATE "Archive hash creation failed - error $STATUS:\n$SHA_OUT"
eurybox_display_message warning CREATE "Archive hash creation failed - error $STATUS:\n$HASH_OUT"
else
eurybox_display_message message CREATE "Archive hash creation - OK"
eurybox_display_message debug CREATE "Hash command output:\n$SHA_OUT"
eurybox_display_message debug CREATE "Hash command output:\n$HASH_OUT"
SYNC_OUT=`sudo sync 2>&1`
STATUS=$?
if [[ !($STATUS -eq 0) ]]
then
eurybox_display_message warning CREATE "Archive description FS sync failed - error $STATUS:\n$SYNC_OUT"
eurybox_display_message warning CREATE "Archive hash FS sync failed - error $STATUS:\n$SYNC_OUT"
else
eurybox_display_message message CREATE "Archive description FS sync - OK"
eurybox_display_message message CREATE "Archive hash FS sync - OK"
eurybox_display_message debug CREATE "Sync command output:\n$SYNC_OUT"
fi
fi

6
sw/src/eurybox.functions.detect

@ -71,13 +71,13 @@ eurybox_detect_archive_content () @@ -71,13 +71,13 @@ eurybox_detect_archive_content ()
eurybox_display_message warning DETECT "Archive description version search failed - unknown backup version found: $BKP_VERS"
;;
esac
BKP_ECC=`echo "${ARCH_DESC}" | grep "ECC_FORMAT" | awk -F":" '{print $NF}'`
BKP_ECC=`echo "${ARCH_DESC}" | grep "FEC_FORMAT" | awk -F":" '{print $NF}'`
case $BKP_ECC in
"" )
eurybox_display_message warning DETECT "Archive description correcting codes search failed"
;;
par2 )
EURYBOX_DETECTED_ARCHIVES[$ARCH_NUM,ECC]=$BKP_ECC
par2|zfec )
EURYBOX_DETECTED_ARCHIVES[$ARCH_NUM,FEC]=$BKP_ECC
eurybox_display_message debug DETECT "Archive description correcting codes search success - found: $BKP_ECC"
;;
* )

30
sw/src/eurybox.functions.euryboxctrl

@ -54,18 +54,10 @@ euryboxctrl_check_sign () @@ -54,18 +54,10 @@ euryboxctrl_check_sign ()
euryboxctrl_create_arch ()
{
#Create the archive
eurybox_display_message message EURYBOXCTRL "Creating the archive file"
case "${EURYBOX_BACKUP_ARCHIVE[FORMAT]}" in
tar|tar.gz|tar.bz2 )
eurybox_create_archive_tar
;;
* )
eurybox_display_message error EURYBOXCTRL "Archive format unknown: ${EURYBOX_BACKUP_ARCHIVE[FORMAT]}."
;;
esac
eurybox_create_archive_tar
#Flush temporary directory
eurybox_flush_directory $EURYBOX_BACKUP_TMP_FOLDER
}
@ -81,28 +73,14 @@ euryboxctrl_create_eccf () @@ -81,28 +73,14 @@ euryboxctrl_create_eccf ()
{
#Create the error correcting file
eurybox_display_message message EURYBOXCTRL "Creating the error correcting codes files"
case "${EURYBOX_BACKUP_ARCHIVE[ECC]}" in
par2 )
eurybox_create_archive_par
;;
* )
eurybox_display_message error EURYBOXCTRL "Archive ECC type unknown: ${EURYBOX_BACKUP_ARCHIVE[ECC]}."
;;
esac
eurybox_create_archive_fec
}
euryboxctrl_create_hash ()
{
#Create the associated hash file
eurybox_display_message message EURYBOXCTRL "Creating the hash file"
case "${EURYBOX_BACKUP_ARCHIVE[HASH]}" in
sha256|sha512 )
eurybox_create_archive_sha
;;
* )
eurybox_display_message error EURYBOXCTRL "Archive HASH type unknown: ${EURYBOX_BACKUP_ARCHIVE[HASH]}."
;;
esac
eurybox_create_archive_hash
}
euryboxctrl_create_sign ()

36
sw/src/eurybox.functions.tools

@ -115,6 +115,8 @@ eurybox_display_detected_archives () @@ -115,6 +115,8 @@ eurybox_display_detected_archives ()
local COMP=${EURYBOX_DETECTED_ARCHIVES[$ARCH_NUM,COMP]}
local TYPE=${EURYBOX_DETECTED_ARCHIVES[$ARCH_NUM,TYPE]}
local VERS=${EURYBOX_DETECTED_ARCHIVES[$ARCH_NUM,VERS]}
local FEC=${EURYBOX_DETECTED_ARCHIVES[$ARCH_NUM,FEC]}
local HASH=${EURYBOX_DETECTED_ARCHIVES[$ARCH_NUM,HASH]}
local YEAR=`echo ${EURYBOX_DETECTED_ARCHIVES[$ARCH_NUM,TIME]} | awk -F"_" '{ print $1 }'`
local MONTH=`echo ${EURYBOX_DETECTED_ARCHIVES[$ARCH_NUM,TIME]} | awk -F"_" '{ print $2 }'`
local DAY=`echo ${EURYBOX_DETECTED_ARCHIVES[$ARCH_NUM,TIME]} | awk -F"_" '{ print $3 }'`
@ -124,7 +126,7 @@ eurybox_display_detected_archives () @@ -124,7 +126,7 @@ eurybox_display_detected_archives ()
if [[ $NAME != $PREVIOUS_NAME ]]
then
echo "------------ [[ ARCHIVE: $NAME ]] ------------"
echo "YEAR \\ MONTH \\ DAY @ HOUR:MINUTE:SECOND | TYPE | VERS | ENC | COMP | ID"
echo "YEAR \\ MONTH \\ DAY @ HOUR:MINUTE:SECOND | TYPE | VERS | ENCR | COMP | FECC | HASH | ID"
PREVIOUS_YEAR=""
PREVIOUS_MONTH=""
fi
@ -163,13 +165,13 @@ eurybox_display_detected_archives () @@ -163,13 +165,13 @@ eurybox_display_detected_archives ()
esac
case $ENC in
false )
ARCH_DESC="$ARCH_DESC | "
ARCH_DESC="$ARCH_DESC | "
;;
true )
ARCH_DESC="$ARCH_DESC | X "
ARCH_DESC="$ARCH_DESC | X "
;;
* )
ARCH_DESC="$ARCH_DESC | ? "
ARCH_DESC="$ARCH_DESC | ? "
;;
esac
case $COMP in
@ -184,7 +186,31 @@ eurybox_display_detected_archives () @@ -184,7 +186,31 @@ eurybox_display_detected_archives ()
;;
* )
ARCH_DESC="$ARCH_DESC | ? "
echo "$COMP"
;;
esac
case $FEC in
none )
ARCH_DESC="$ARCH_DESC | "
;;
par2 )
ARCH_DESC="$ARCH_DESC | PAR2"
;;
zfec )
ARCH_DESC="$ARCH_DESC | ZFEC"
;;
* )
ARCH_DESC="$ARCH_DESC | ? "
;;
esac
case $HASH in
none )
ARCH_DESC="$ARCH_DESC | "
;;
sha512|sha256 )
ARCH_DESC="$ARCH_DESC | SHA "
;;
* )
ARCH_DESC="$ARCH_DESC | ? "
;;
esac
ARCH_DESC="$ARCH_DESC | $ARCH_NUM"

Loading…
Cancel
Save