moved key management draft into preflight function
This commit is contained in:
parent
a1d08207b4
commit
f758c29c00
26
sshbackup
26
sshbackup
|
@ -89,23 +89,9 @@ preflight()
|
|||
return 1
|
||||
fi
|
||||
|
||||
#if remote source or destination check for ssh key
|
||||
#if there is a remote source or destination check for ssh key
|
||||
if [[ $sourcepath =~ .*@.* ]] || [[ $destpath =~ .*@.* ]]; then
|
||||
#if [ -r $sshkeyfile ]; then
|
||||
# #echo "sshkeyfile found. continuing."
|
||||
# :
|
||||
#else
|
||||
# echo "aborting mission. no sshkey found."
|
||||
# return 1
|
||||
#fi
|
||||
keymgmt
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
keymgmt()
|
||||
{
|
||||
#get executing user id
|
||||
local userid=$(id -u)
|
||||
|
||||
|
@ -121,7 +107,6 @@ keymgmt()
|
|||
if [ -z $sshkeyfile ]; then
|
||||
sshkeyfile="$home/.ssh/id_rsa"
|
||||
fi
|
||||
|
||||
if [ -r $sshkeyfile ]; then
|
||||
#ssh key found
|
||||
:
|
||||
|
@ -132,16 +117,21 @@ keymgmt()
|
|||
read choice
|
||||
if [ -z $choice ]; then
|
||||
echo "aborting mission. no ssh key found."
|
||||
exit 1
|
||||
return 1
|
||||
elif [ $choice == "y" ] || [ $choice == "Y" ]; then
|
||||
#creating ssh key pair
|
||||
ssh-keygen
|
||||
#TODO: key should also be deployed to remote side
|
||||
return 1 #for now i'll break up here
|
||||
fi
|
||||
else
|
||||
echo "aborting mission. no ssh key found."
|
||||
exit 1
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
sshbackup()
|
||||
|
|
Reference in New Issue