Fork 0

some final changes to oh_four

This commit is contained in:
david 2013-07-07 20:09:55 +02:00
parent 212c211d22
commit 8a59d57b81
2 changed files with 15 additions and 9 deletions

View File

@ -13,8 +13,7 @@ sudo chmod +x /usr/bin/sshbackup
### usage
usage: sshbackup <options> source destination [versions]
source/destination example: [[user@]server:]/path/to/files
usage: sshbackup <options> [[user@]server:]/source/path /destination/path [versions]
-h, --help show this message
@ -25,7 +24,7 @@ OPTIONS:
-s, --sshkey <file> alternate sshkey [~/.ssh/id_rsa]
-b, --bandwidth <kbps> bandwidth limit in kbit/s
-d, --deploy <hostname> deploy settings to remote host
-d, --deploy deploy settings to remote host
-n, --no-root run without root privileges

View File

@ -134,7 +134,7 @@ deploy()
echo "i will now attempt to create the user $user and apply all needed"
echo "settings on following remote host: $machine"
echo "in order to do so i need a sudo enabled username and"
echo "password on the remote host."
echo "password on the remote host. (hit Ctrl-C to abort)"
echo -e "please enter your [sudo] username: \c"
read username
echo -e "please enter your [sudo] password: \c"
@ -149,6 +149,8 @@ deploy()
eval pipewrap '$password' '$lockfile' | (sshpass -p "$password" ssh -q "$username@$machine" "sudo -S '$script'"; rm "$lockfile")
sshpass -p $password ssh -q "$username@$machine" rm $script
rm $script
#we will assume everything went fine
return 0
@ -168,8 +170,8 @@ preflight()
return 1
#TODO: check for dependencies and install them if necessary
#check for dependencies
#TODO: and install them if necessary
local deps="rsync cat ssh scp sshpass rm mv grep awk date tty id"
local missingdeps=""
local depscount="0"
@ -193,9 +195,8 @@ preflight()
if [[ $sourcepath =~ .*@.* ]]; then
#deactivate StrictHostKeyChecking for ssh client
#TODO: what if StrictHostKeyChecking is set but not to "no"
if [ -r $HOME/.ssh/config ]; then
cat $HOME/.ssh/config | grep "StrictHostKeyChecking no" >> /dev/null
cat $HOME/.ssh/config | grep "StrictHostKeyChecking" >> /dev/null
if [ $? -ne 0 ]; then
echo "StrictHostKeyChecking no" >> $HOME/.ssh/config
@ -222,9 +223,15 @@ preflight()
echo "aborting mission. error occured while creating ssh key pair"
return 1
echo -e "do you want to create a user and deploy this key now as well \c"
read choice
if [ -z $choice ]; then
echo "aborting mission. remote host must accept ssh key."
return 1
elif [ $choice == "y" ] || [ $choice == "Y" ]; then
#deploy key to remote system
deploy ${sourcepath%:*} $pubkeyfile
return 0
deploy ${sourcepath%:*} $pubkeyfile
echo "aborting mission. no ssh key found."
return 1