mirror of
https://github.com/erenfro/systemrescue-backup.git
synced 2024-12-22 00:01:09 -05:00
Changing configuration around to cleaner approach
This commit is contained in:
parent
237a85a1e5
commit
3019c8e6ee
3 changed files with 63 additions and 9 deletions
|
@ -1,13 +1,59 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
###########################################################
|
||||||
|
### Default global configuration definitions
|
||||||
|
###########################################################
|
||||||
|
|
||||||
|
restic_version="0.17.0"
|
||||||
|
resticprofile_version="0.28.0"
|
||||||
|
systemrescuecd_version="11.02"
|
||||||
|
backup_engine="resticprofile"
|
||||||
|
|
||||||
|
scriptPath="$(dirname "$(readlink -f "$0")")"
|
||||||
|
configPath="$(readlink -f "${scriptPath}/../config")"
|
||||||
|
|
||||||
|
if [[ ! -d "${configPath}" ]]; then
|
||||||
|
# Start searching for common configuration paths
|
||||||
|
if [[ -r "$HOME/.config/systemrescue-backup/srb.cfg" ]]; then
|
||||||
|
configPath="$HOME/.config/systemrescue-backup"
|
||||||
|
elif [[ -r "/etc/systemrescue-backup/srb.cfg" ]]; then
|
||||||
|
configPath="/etc/systemrescue-backup"
|
||||||
|
else
|
||||||
|
echoerr "No configuration file path found. Defaults will be used." 1>&2
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -f "${configPath}/srb.cfg" ]]; then
|
||||||
|
# Fail on any issues loading configuration
|
||||||
|
trap "echo \"ERROR: Configuration failed to load without error\"" ERR
|
||||||
|
set -e
|
||||||
|
source "${configPath}/srb.cfg"
|
||||||
|
set +e
|
||||||
|
trap - ERR
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
###########################################################
|
###########################################################
|
||||||
### Utility & Common Functions
|
### Utility & Common Functions
|
||||||
###########################################################
|
###########################################################
|
||||||
|
|
||||||
function is_bin_in_path {
|
is_bin_in_path() {
|
||||||
builtin type -P "$1" &>/dev/null
|
builtin type -P "$1" &>/dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
echoerr() {
|
||||||
|
echo "$*" 1>&2
|
||||||
|
}
|
||||||
|
|
||||||
|
exit_fail() {
|
||||||
|
local rc=$1
|
||||||
|
shift
|
||||||
|
|
||||||
|
echoerr "$*"
|
||||||
|
exit "$rc"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
###########################################################
|
###########################################################
|
||||||
### BACKUP and RESTORE FUNCTIONS
|
### BACKUP and RESTORE FUNCTIONS
|
||||||
###########################################################
|
###########################################################
|
8
src/srb
Normal file → Executable file
8
src/srb
Normal file → Executable file
|
@ -1,4 +1,12 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
scriptPath="$(dirname "$(readlink -f "$0")")"
|
scriptPath="$(dirname "$(readlink -f "$0")")"
|
||||||
|
#configPath="$(dirname "$(readlink -f "${scriptPath}/../config")")"
|
||||||
|
|
||||||
|
if [[ -r "${scriptPath}/functions.sh" ]]; then
|
||||||
|
source "${scriptPath}/functions.sh"
|
||||||
|
else
|
||||||
|
echo "FATAL: Cannot find installed engine."
|
||||||
|
exit 255
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
|
@ -2,17 +2,17 @@
|
||||||
|
|
||||||
# This is where persistent larger files reside. Including the SystemRescueCD and Backup ISO's reside.
|
# This is where persistent larger files reside. Including the SystemRescueCD and Backup ISO's reside.
|
||||||
# NOTE: This is not where actual backups will reside.
|
# NOTE: This is not where actual backups will reside.
|
||||||
systemrescueBaseDir="/var/backups/systemrescue-backup"
|
systemrescue_data_dir="/var/backups/systemrescue-backup"
|
||||||
|
|
||||||
# Backup Engine to use:
|
# Backup Engine to use:
|
||||||
# Options are either resticprofile or borgmatic.
|
# Options are either resticprofile or borgmatic.
|
||||||
backupEngine="resticprofile"
|
backup_engine="resticprofile"
|
||||||
|
|
||||||
# ResticProfile Options:
|
# ResticProfile Options:
|
||||||
# These are versions of restic and resticprofile to download and use with the
|
# These are versions of restic and resticprofile to download and use with the
|
||||||
# SystemRescueBackup recovery image.
|
# SystemRescueBackup recovery image.
|
||||||
resticVersion="0.17.0"
|
restic_version="0.17.0"
|
||||||
resticprofileVersion="0.28.0"
|
resticprofile_version="0.28.0"
|
||||||
|
|
||||||
# Borgmatic Options:
|
# Borgmatic Options:
|
||||||
# This is the SystemRescueBackup SRM Module to include in the recovery image.
|
# This is the SystemRescueBackup SRM Module to include in the recovery image.
|
||||||
|
@ -21,12 +21,12 @@ resticprofileVersion="0.28.0"
|
||||||
# cowpacman2srm borgmatic.srm
|
# cowpacman2srm borgmatic.srm
|
||||||
# And upon success, copy the borgmatic.srm to your host system and provide
|
# And upon success, copy the borgmatic.srm to your host system and provide
|
||||||
# the path to it here:
|
# the path to it here:
|
||||||
borgmaticSRM=""
|
borgmatic_srm=""
|
||||||
|
|
||||||
# SystemRescueCD Version to Download and Use. If you're using borgmatic, this
|
# SystemRescueCD Version to Download and Use. If you're using borgmatic, this
|
||||||
# version will be relevant to the previously provided borgmaticSRM module.
|
# version will be relevant to the previously provided borgmaticSRM module.
|
||||||
systemrescueVersion="11.02"
|
systemrescuecd_version="11.02"
|
||||||
|
|
||||||
# Temporary working directory, mostly for downloads to generate the
|
# Temporary working directory, mostly for downloads to generate the
|
||||||
# SystemRescueBackup disc image.
|
# SystemRescueBackup disc image.
|
||||||
systemrescueTempDir="/tmp/systemrescue-backup"
|
systemrescue_temp_dir="/tmp/systemrescue-backup"
|
Loading…
Reference in a new issue