Changing configuration around to cleaner approach

This commit is contained in:
Eric Renfro 2024-09-02 15:06:33 -04:00
parent 237a85a1e5
commit 3019c8e6ee
Signed by: psi-jack
SSH key fingerprint: SHA256:1TKB8Z257L8EHK8GWNxKgMhD8a+FAR+f+j3nnlcuNVM
3 changed files with 63 additions and 9 deletions

View file

@ -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
###########################################################
function is_bin_in_path {
is_bin_in_path() {
builtin type -P "$1" &>/dev/null
}
echoerr() {
echo "$*" 1>&2
}
exit_fail() {
local rc=$1
shift
echoerr "$*"
exit "$rc"
}
###########################################################
### BACKUP and RESTORE FUNCTIONS
###########################################################

8
src/srb Normal file → Executable file
View file

@ -1,4 +1,12 @@
#!/bin/bash
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

View file

@ -2,17 +2,17 @@
# This is where persistent larger files reside. Including the SystemRescueCD and Backup ISO's 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:
# Options are either resticprofile or borgmatic.
backupEngine="resticprofile"
backup_engine="resticprofile"
# ResticProfile Options:
# These are versions of restic and resticprofile to download and use with the
# SystemRescueBackup recovery image.
resticVersion="0.17.0"
resticprofileVersion="0.28.0"
restic_version="0.17.0"
resticprofile_version="0.28.0"
# Borgmatic Options:
# This is the SystemRescueBackup SRM Module to include in the recovery image.
@ -21,12 +21,12 @@ resticprofileVersion="0.28.0"
# cowpacman2srm borgmatic.srm
# And upon success, copy the borgmatic.srm to your host system and provide
# the path to it here:
borgmaticSRM=""
borgmatic_srm=""
# SystemRescueCD Version to Download and Use. If you're using borgmatic, this
# 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
# SystemRescueBackup disc image.
systemrescueTempDir="/tmp/systemrescue-backup"
systemrescue_temp_dir="/tmp/systemrescue-backup"