mirror of
https://github.com/kevinveenbirkenbach/linux-image-manager.git
synced 2024-12-22 20:15:03 +01:00
Adapted scripts to new base frame
This commit is contained in:
parent
9d8dfd33a0
commit
60c9ce8a0f
@ -74,7 +74,7 @@ error(){
|
||||
get_packages(){
|
||||
for package_collection in "$@"
|
||||
do
|
||||
sed -e "/^#/d" -e "s/#.*//" "$PACKAGE_PATH""$package_collection.txt" || error "Loading package wasn't possible."
|
||||
sed -e "/^#/d" -e "s/#.*//" "$PACKAGE_PATH""$package_collection.txt" || error "Loading package wasn't possible."
|
||||
done
|
||||
}
|
||||
|
||||
|
@ -2,5 +2,5 @@
|
||||
# Executes all scripts which are necessary to backup data
|
||||
# @author Kevin Veen-Birkenbach [aka. Frantz]
|
||||
source "$(dirname "$(readlink -f "${0}")")/../base.sh" || (echo "Loading base.sh failed." && exit 1)
|
||||
bash "$SCRIPT_PATH/import-data-from-system.sh"
|
||||
bash "$SCRIPT_PATH/push-local-repositories.sh"
|
||||
bash "$SCRIPT_PATH""client/import-data-from-system.sh"
|
||||
bash "$SCRIPT_PATH""client/push-local-repositories.sh"
|
||||
|
@ -3,4 +3,4 @@
|
||||
# @author Kevin Veen-Birkenbach [aka. Frantz]
|
||||
# shellcheck source=/dev/null # Deactivate SC1090
|
||||
source "$(dirname "$(readlink -f "${0}")")/../base.sh" || (echo "Loading base.sh failed." && exit 1)
|
||||
bash "$SCRIPT_PATH/import-data-from-system.sh" reverse
|
||||
bash "$SCRIPT_PATH""client/import-data-from-system.sh" reverse
|
||||
|
@ -1,7 +1,6 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Imports data from the system
|
||||
# @author Kevin Veen-Birkenbach [aka. Frantz]
|
||||
# @param $1 If the first parameter is "reverse" the data will be exported to the system
|
||||
#
|
||||
# shellcheck source=/dev/null # Deactivate SC1090
|
||||
@ -9,8 +8,8 @@
|
||||
source "$(dirname "$(readlink -f "${0}")")/../base.sh" || (echo "Loading base.sh failed." && exit 1)
|
||||
if [ -z "$(mount | grep "$DECRYPTED_PATH")" ]
|
||||
then
|
||||
echo "The decrypted folder $DECRYPTED_PATH is locked. You need to unlock it!"
|
||||
bash "$SCRIPT_PATH/unlock.sh" || exit 1;
|
||||
info "The decrypted folder $DECRYPTED_PATH is locked. You need to unlock it!" &&
|
||||
bash "$SCRIPT_PATH/unlock.sh" || error "Unlocking failed.";
|
||||
fi
|
||||
if [ "$1" = "reverse" ]
|
||||
then
|
||||
@ -19,7 +18,7 @@ if [ "$1" = "reverse" ]
|
||||
MODE="import"
|
||||
fi
|
||||
CONCRETE_BACKUP_FOLDER="$BACKUP_PATH/$MODE/$(date '+%Y%m%d%H%M%S')"
|
||||
mkdir -p "$CONCRETE_BACKUP_FOLDER"
|
||||
mkdir -p "$CONCRETE_BACKUP_FOLDER" || error "Failed to create \"$CONCRETE_BACKUP_FOLDER\"."
|
||||
for system_item_path in "${BACKUP_LIST[@]}";
|
||||
do
|
||||
data_item_path="$DATA_PATH$system_item_path"
|
||||
@ -27,36 +26,36 @@ do
|
||||
then
|
||||
destination="$system_item_path"
|
||||
source="$data_item_path"
|
||||
echo "Export data from $source to $destination..."
|
||||
info "Export data from $source to $destination..."
|
||||
else
|
||||
source="$system_item_path"
|
||||
destination="$data_item_path"
|
||||
echo "Import data from $source to $destination..."
|
||||
info "Import data from $source to $destination..."
|
||||
fi
|
||||
if [ -f "$destination" ]
|
||||
then
|
||||
echo "The destination file allready exists!";
|
||||
echo "Difference:"
|
||||
info "The destination file allready exists!" &&
|
||||
info "Difference:" &&
|
||||
diff "$destination" "$source"
|
||||
fi
|
||||
destination_dir=$(dirname "$destination")
|
||||
mkdir -p "$destination_dir"
|
||||
mkdir -p "$destination_dir" || error "Failed to create \"$destination_dir\"."
|
||||
if [ -f "$source" ]
|
||||
then
|
||||
backup_dir=$(dirname "$CONCRETE_BACKUP_FOLDER/$system_item_path");
|
||||
mkdir -p "$backup_dir"
|
||||
echo "Copy data from $source to $destination..."
|
||||
rsync -abcEPuvW --backup-dir="$backup_dir" "$source" "$destination"
|
||||
mkdir -p "$backup_dir" || error "Failed to create \"$backup_dir\"."
|
||||
info "Copy data from $source to $destination..."
|
||||
rsync -abcEPuvW --backup-dir="$backup_dir" "$source" "$destination" || error "Failed."
|
||||
else
|
||||
if [ -d "$source" ]
|
||||
then
|
||||
mkdir -p "$destination"
|
||||
mkdir -p "$destination" || error "Failed to create \"$destination\"."
|
||||
backup_dir="$CONCRETE_BACKUP_FOLDER/$system_item_path";
|
||||
mkdir -p "$backup_dir"
|
||||
echo "Copy data from directory $source to directory $destination..."
|
||||
rsync -abcEPuvW --delete --backup-dir="$backup_dir" "$source" "$destination"
|
||||
mkdir -p "$backup_dir" || error "Failed to create \"$backup_dir\"."
|
||||
info "Copy data from directory $source to directory $destination..."
|
||||
rsync -abcEPuvW --delete --backup-dir="$backup_dir" "$source" "$destination" || error "Failed."
|
||||
else
|
||||
echo "$source doesn't exist. Copying data is not possible."
|
||||
warning "$source doesn't exist. Copying data is not possible."
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
Loading…
Reference in New Issue
Block a user