mirror of
https://github.com/kevinveenbirkenbach/linux-image-manager.git
synced 2024-11-22 15:11:04 +01:00
Replaced cp through rsync
This commit is contained in:
parent
37984f157d
commit
fff8cd0305
@ -12,6 +12,14 @@ if [ -z "$(mount | grep "$DECRYPTED_PATH")" ]
|
|||||||
echo "The decrypted folder $DECRYPTED_PATH is locked. You need to unlock it!"
|
echo "The decrypted folder $DECRYPTED_PATH is locked. You need to unlock it!"
|
||||||
bash "$SCRIPT_PATH/unlock.sh" || exit 1;
|
bash "$SCRIPT_PATH/unlock.sh" || exit 1;
|
||||||
fi
|
fi
|
||||||
|
if [ "$1" = "reverse" ]
|
||||||
|
then
|
||||||
|
MODE="export"
|
||||||
|
else
|
||||||
|
MODE="import"
|
||||||
|
fi
|
||||||
|
CONCRETE_BACKUP_FOLDER="$BACKUP_PATH/$MODE/$(date '+%Y%m%d%H%M%S')"
|
||||||
|
mkdir -p $CONCRETE_BACKUP_FOLDER
|
||||||
declare -a BACKUP_LIST=("$HOME/.ssh/" \
|
declare -a BACKUP_LIST=("$HOME/.ssh/" \
|
||||||
"$HOME/.gitconfig" \
|
"$HOME/.gitconfig" \
|
||||||
"$HOME/.atom/config.cson" \
|
"$HOME/.atom/config.cson" \
|
||||||
@ -24,7 +32,7 @@ declare -a BACKUP_LIST=("$HOME/.ssh/" \
|
|||||||
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"
|
||||||
if [ "$1" = "reverse" ]
|
if [ "$MODE" = "export" ]
|
||||||
then
|
then
|
||||||
destination="$system_item_path"
|
destination="$system_item_path"
|
||||||
source="$data_item_path"
|
source="$data_item_path"
|
||||||
@ -45,12 +53,13 @@ do
|
|||||||
if [ -f "$source" ]
|
if [ -f "$source" ]
|
||||||
then
|
then
|
||||||
echo "Copy data from $source to $destination..."
|
echo "Copy data from $source to $destination..."
|
||||||
cp -vi "$source" "$destination"
|
rsync -uWvabPE --update --times --backup-dir="$CONCRETE_BACKUP_FOLDER" "$source" "$destination"
|
||||||
else
|
else
|
||||||
if [ -d "$source" ]
|
if [ -d "$source" ]
|
||||||
then
|
then
|
||||||
echo "Copy data from directory $source to directory $destination_dir..."
|
mkdir -p "$destination"
|
||||||
cp -vir "$source" "$destination_dir"
|
echo "Copy data from directory $source to directory $destination..."
|
||||||
|
rsync -uWvabrPE --update --times --delete --backup-dir="$CONCRETE_BACKUP_FOLDER" "$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