-
Notifications
You must be signed in to change notification settings - Fork 0
/
link-ssh.sh
executable file
·46 lines (34 loc) · 1.01 KB
/
link-ssh.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/bash
red=`tput setaf 1`
green=`tput setaf 2`
reset=`tput sgr0`
echo
echo
echo "${green}---------------------------${reset}"
echo "${green}--- create link for ssh ---${reset}"
echo "${green}---------------------------${reset}"
echo
source ./.env
source_file="$SOURCE_ROOT_PATH/ssh/.ssh"
target_file="/Users/$USER/.ssh"
echo "🧪 try: ln -s ${source_file} ${target_file}"
echo " - 🔍 is target exist? : \`${green}${target_file}${reset}\`"
if [ -e "${target_file}" ]; then
echo "⭕️${green}ssh files found.${reset}"
else
echo " - 🔍 is source exist? : \`${green}${source_file}${reset}\`"
if [ -e "${source_file}" ]; then
echo "‼️ssh files not found! ready to create link...."
cd ~ && ln -s $SOURCE_ROOT_PATH/ssh/.ssh/
chmod 400 ~/.ssh/id_rsa ~/.ssh/id_dsa
ssh-add
else
echo "❌${red}source not exist...${reset}"
fi
fi
echo
echo "${green}-------------${reset}"
echo "${green}--- Done. ---${reset}"
echo "${green}-------------${reset}"
echo
echo