david/sshbackup
david
/
sshbackup
Archived
1
0
Fork 0

added debug function

This commit is contained in:
david 2013-04-26 12:14:09 +02:00
parent 4de41f8a2d
commit 07ae55dea9
1 changed files with 35 additions and 3 deletions

View File

@ -25,6 +25,7 @@ sshkeyfile="$HOME/.ssh/id_rsa"
config=0
sshkey=0
deploy=0
options=$*
@ -49,8 +50,9 @@ usage()
echo "OPTIONS:"
echo " -h, --help show this message"
echo " -v, --version version information"
echo " -c, --config <config file> alternate config file"
echo " -c, --config <configfile> alternate config file"
echo " -s, --sshkey <sshkeyfile> alternate sshkeyfile"
echo " -d, --deploy <remote machine> deploy remote settings"
echo
}
@ -76,7 +78,15 @@ preflight()
if [ $? -eq 0 ]; then
echo "im running in interactive mode"
echo "you have no ssh key configured."
echo "do you want to create a new keypair? [y] "
echo -e "do you want to create a new keypair? [y] \c"
read answer
if [ $answer == "y" ] || [ $answer == "Y" ]; then
#create keypair
:
else
#continue without sshkey
:
fi
else
echo "aborting mission. no sshkey found."
exit 1
@ -87,6 +97,7 @@ preflight()
}
#work in progress
deploy()
{
@ -162,6 +173,19 @@ deploy()
}
debug()
{
echo -e "debug output\n============"
echo "remote: $remotemachine"
echo "source: $sourcepath"
echo "destination: $destinationpath"
echo "versions: $versions"
echo "sshkey: $sshkeyfile"
echo "config: $configfile"
}
# **** start of script ****
@ -191,6 +215,9 @@ for option in $options; do
-s|--sshkey)
sshkey=1
;;
-d|--deploy)
deploy=1
;;
*)
if [ $config -eq 1 ]; then
if [ -r $option ]; then
@ -208,6 +235,9 @@ for option in $options; do
echo "aborting mission. cannot read sshkeyfile. [$option]"
exit 1
fi
elif [ $deploy -eq 1 ]; then
remotemachine=$option
deploy=0
else
if [[ $option =~ ^-.* ]]; then
echo "aborting mission. unknown option given. [$option]"
@ -245,8 +275,10 @@ if [ -r $configfile ]; then
source $configfile
fi
debug
#running preflight checks
preflight
#preflight
#sshbackup $sourcepath $destinationpath $versions