mirror of
https://github.com/kevinveenbirkenbach/linux-image-manager.git
synced 2024-11-26 00:41:04 +01:00
Implemented ssh management
This commit is contained in:
parent
87e433dd2e
commit
edd18db933
@ -1,2 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
bash ./import-data-from-system.sh reverse
|
# Executes the import script in reverse mode
|
||||||
|
# @author Kevin Veen-Birkenbach [aka. Frantz]
|
||||||
|
bash "$(dirname "$(readlink -f "${0}")")/import-data-from-system.sh" reverse
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
# Imports data from the system
|
# Imports data from the system
|
||||||
# @author Kevin Veen-Birkenbach [aka. Frantz]
|
# @author Kevin Veen-Birkenbach [aka. Frantz]
|
||||||
# @param $1 If the first parameter is "reverse" the data will be exported to the system
|
# @param $1 If the first parameter is "reverse" the data will be exported to the system
|
||||||
DATA_FOLDER="./data";
|
DATA_FOLDER="$(dirname "$(readlink -f "${0}")")/../data";
|
||||||
BACKUP_LIST=("$HOME/.gitconfig");
|
BACKUP_LIST=("$HOME/.ssh/") #,"$HOME/.gitconfig");
|
||||||
for system_item_path in "${BACKUP_LIST[@]}";
|
for system_item_path in "${BACKUP_LIST[@]}";
|
||||||
do
|
do
|
||||||
data_item_path="$DATA_FOLDER$BACKUP_LIST"
|
data_item_path="$DATA_FOLDER$BACKUP_LIST"
|
||||||
@ -15,7 +15,7 @@ do
|
|||||||
source="$system_item_path"
|
source="$system_item_path"
|
||||||
destination="$data_item_path"
|
destination="$data_item_path"
|
||||||
fi
|
fi
|
||||||
echo "Data will be copied from $source to $destination..."
|
echo "Trying to copy data from $source to $destination..."
|
||||||
if [ -f "$destination" ]
|
if [ -f "$destination" ]
|
||||||
then
|
then
|
||||||
echo "The destination file allready exists!";
|
echo "The destination file allready exists!";
|
||||||
@ -24,5 +24,17 @@ do
|
|||||||
fi
|
fi
|
||||||
destination_dir=$(dirname $destination)
|
destination_dir=$(dirname $destination)
|
||||||
mkdir -p "$destination_dir"
|
mkdir -p "$destination_dir"
|
||||||
|
if [ -f "$source" ]
|
||||||
|
then
|
||||||
|
echo "Copy data from $source to $destination..."
|
||||||
cp -vi "$source" "$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
|
done
|
||||||
|
@ -8,6 +8,17 @@ echo "Synchronizing programing languages..."
|
|||||||
sudo pacman --needed -S jdk11-openjdk python php
|
sudo pacman --needed -S jdk11-openjdk python php
|
||||||
echo "Synchronizing administration tools..."
|
echo "Synchronizing administration tools..."
|
||||||
sudo pacman --needed -S htop tree git base-devel yay make gcc cmake
|
sudo pacman --needed -S htop tree git base-devel yay make gcc cmake
|
||||||
|
ssh_key_path="$HOME/.ssh/id_rsa"
|
||||||
|
if [ ! -f "$ssh_key_path" ]; then
|
||||||
|
echo "SSH key $ssh_key_path doesn't exists!"
|
||||||
|
if [ ! -f "./data$ssh_key_path" ]; then
|
||||||
|
echo "Importing ssh key from data..."
|
||||||
|
bash ./scripts/export-data-to-system.sh
|
||||||
|
else
|
||||||
|
echo "Generating ssh key"
|
||||||
|
ssh-keygen -t rsa -b 4096 -C "$USER@$HOSTNAME"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
echo "Synchronizing gui tools..."
|
echo "Synchronizing gui tools..."
|
||||||
sudo pacman --needed -S gnome-shell-extensions
|
sudo pacman --needed -S gnome-shell-extensions
|
||||||
echo "Install NASA picture of the day GNOME extension..."
|
echo "Install NASA picture of the day GNOME extension..."
|
||||||
|
Loading…
Reference in New Issue
Block a user