mirror of
https://github.com/kevinveenbirkenbach/linux-image-manager.git
synced 2024-11-10 01:51:03 +01:00
Optimized backup folders
This commit is contained in:
parent
022269c189
commit
eb47f44a29
@ -12,3 +12,12 @@ DATA_PATH="$DECRYPTED_PATH/data";
|
|||||||
BACKUP_PATH="$DECRYPTED_PATH/backup";
|
BACKUP_PATH="$DECRYPTED_PATH/backup";
|
||||||
TEMPLATE_PATH="$REPOSITORY_PATH/templates";
|
TEMPLATE_PATH="$REPOSITORY_PATH/templates";
|
||||||
LOCAL_REPOSITORIES_PATH="$HOME/Documents/repositories";
|
LOCAL_REPOSITORIES_PATH="$HOME/Documents/repositories";
|
||||||
|
declare -a BACKUP_LIST=("$HOME/.ssh/" \
|
||||||
|
"$HOME/.gitconfig" \
|
||||||
|
"$HOME/.atom/config.cson" \
|
||||||
|
"$HOME/Documents/certificates/" \
|
||||||
|
"$HOME/Documents/recovery_codes/" \
|
||||||
|
"$HOME/Documents/identity/" \
|
||||||
|
"$HOME/Documents/passwords/" \
|
||||||
|
"$HOME/.local/share/rhythmbox/rhythmdb.xml" \
|
||||||
|
"$HOME/.config/keepassxc/keepassxc.ini");
|
||||||
|
@ -20,15 +20,6 @@ if [ "$1" = "reverse" ]
|
|||||||
fi
|
fi
|
||||||
CONCRETE_BACKUP_FOLDER="$BACKUP_PATH/$MODE/$(date '+%Y%m%d%H%M%S')"
|
CONCRETE_BACKUP_FOLDER="$BACKUP_PATH/$MODE/$(date '+%Y%m%d%H%M%S')"
|
||||||
mkdir -p "$CONCRETE_BACKUP_FOLDER"
|
mkdir -p "$CONCRETE_BACKUP_FOLDER"
|
||||||
declare -a BACKUP_LIST=("$HOME/.ssh/" \
|
|
||||||
"$HOME/.gitconfig" \
|
|
||||||
"$HOME/.atom/config.cson" \
|
|
||||||
"$HOME/Documents/certificates/" \
|
|
||||||
"$HOME/Documents/recovery_codes/" \
|
|
||||||
"$HOME/Documents/identity/" \
|
|
||||||
"$HOME/Documents/passwords/" \
|
|
||||||
"$HOME/.local/share/rhythmbox/rhythmdb.xml" \
|
|
||||||
"$HOME/.config/keepassxc/keepassxc.ini");
|
|
||||||
for system_item_path in "${BACKUP_LIST[@]}";
|
for system_item_path in "${BACKUP_LIST[@]}";
|
||||||
do
|
do
|
||||||
data_item_path="$DATA_PATH$system_item_path"
|
data_item_path="$DATA_PATH$system_item_path"
|
||||||
@ -52,14 +43,18 @@ do
|
|||||||
mkdir -p "$destination_dir"
|
mkdir -p "$destination_dir"
|
||||||
if [ -f "$source" ]
|
if [ -f "$source" ]
|
||||||
then
|
then
|
||||||
|
backup_dir=$(dirname "$CONCRETE_BACKUP_FOLDER/$system_item_path");
|
||||||
|
mkdir -p "$backup_dir"
|
||||||
echo "Copy data from $source to $destination..."
|
echo "Copy data from $source to $destination..."
|
||||||
rsync -abcEPuvW --backup-dir="$CONCRETE_BACKUP_FOLDER" "$source" "$destination"
|
rsync -abcEPuvW --backup-dir="$backup_dir" "$source" "$destination"
|
||||||
else
|
else
|
||||||
if [ -d "$source" ]
|
if [ -d "$source" ]
|
||||||
then
|
then
|
||||||
mkdir -p "$destination"
|
mkdir -p "$destination"
|
||||||
|
backup_dir="$CONCRETE_BACKUP_FOLDER/$system_item_path";
|
||||||
|
mkdir -p "$backup_dir"
|
||||||
echo "Copy data from directory $source to directory $destination..."
|
echo "Copy data from directory $source to directory $destination..."
|
||||||
rsync -abcEPuvW --delete --backup-dir="$CONCRETE_BACKUP_FOLDER" "$source" "$destination"
|
rsync -abcEPuvW --delete --backup-dir="$backup_dir" "$source" "$destination"
|
||||||
else
|
else
|
||||||
echo "$source doesn't exist. Copying data is not possible."
|
echo "$source doesn't exist. Copying data is not possible."
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user