if [ -x .ssh/authorized_keys ]
then
echo \"Remote authorized_keys file will not be overwritten.\"
- echo \"To remove it, do 'sshauth -d ${user}@$host}'.\"
+ echo \"To remove it, do 'sshauth -d ${user}@${host}'.\"
exit 1
+elif [ \$checkonly = 'yes' ]
+then
+ echo \"Remote .ssh exists, authorized_keys could be installed.\"
else
echo \"Creating remote .ssh/authorized_keys file...\"
+ cat >.ssh/authorized_keys <<EOF
+`cat $public_keys`
+EOF
fi
"
-if echo "$agent" | ssh -T ${quiet} ${user}@${host}
+if [ $check = 'yes' -a $verbose = '-v' ]
+then
+ echo "Here is the agent script that would be run:"
+ echo "$agent"
+ exit 0
+elif echo "$agent" | ssh -T ${quiet} ${user}@${host}
then
echo "Installation or check successful."
+ exit 0
else
echo "Installation or check failed."
exit 1