Implemented ssh management
This commit is contained in:
@@ -2,8 +2,8 @@
|
||||
# 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
|
||||
DATA_FOLDER="./data";
|
||||
BACKUP_LIST=("$HOME/.gitconfig");
|
||||
DATA_FOLDER="$(dirname "$(readlink -f "${0}")")/../data";
|
||||
BACKUP_LIST=("$HOME/.ssh/") #,"$HOME/.gitconfig");
|
||||
for system_item_path in "${BACKUP_LIST[@]}";
|
||||
do
|
||||
data_item_path="$DATA_FOLDER$BACKUP_LIST"
|
||||
@@ -15,7 +15,7 @@ do
|
||||
source="$system_item_path"
|
||||
destination="$data_item_path"
|
||||
fi
|
||||
echo "Data will be copied from $source to $destination..."
|
||||
echo "Trying to copy data from $source to $destination..."
|
||||
if [ -f "$destination" ]
|
||||
then
|
||||
echo "The destination file allready exists!";
|
||||
@@ -24,5 +24,17 @@ do
|
||||
fi
|
||||
destination_dir=$(dirname $destination)
|
||||
mkdir -p "$destination_dir"
|
||||
cp -vi "$source" "$destination"
|
||||
if [ -f "$source" ]
|
||||
then
|
||||
echo "Copy data from $source to $destination..."
|
||||
cp -vi "$source" "$destination"
|
||||
else
|
||||
if [ -d "$source" ]
|
||||
then
|
||||
echo "Copy data from directory $source to directory $destination_dir..."
|
||||
cp -vir "$source" "$destination_dir"
|
||||
else
|
||||
echo "$source doesn't exist. Copying data is not possible."
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
Reference in New Issue
Block a user