added debug function
This commit is contained in:
parent
4de41f8a2d
commit
07ae55dea9
|
@ -25,6 +25,7 @@ sshkeyfile="$HOME/.ssh/id_rsa"
|
||||||
|
|
||||||
config=0
|
config=0
|
||||||
sshkey=0
|
sshkey=0
|
||||||
|
deploy=0
|
||||||
options=$*
|
options=$*
|
||||||
|
|
||||||
|
|
||||||
|
@ -49,8 +50,9 @@ usage()
|
||||||
echo "OPTIONS:"
|
echo "OPTIONS:"
|
||||||
echo " -h, --help show this message"
|
echo " -h, --help show this message"
|
||||||
echo " -v, --version version information"
|
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 " -s, --sshkey <sshkeyfile> alternate sshkeyfile"
|
||||||
|
echo " -d, --deploy <remote machine> deploy remote settings"
|
||||||
echo
|
echo
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -76,7 +78,15 @@ preflight()
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
echo "im running in interactive mode"
|
echo "im running in interactive mode"
|
||||||
echo "you have no ssh key configured."
|
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
|
else
|
||||||
echo "aborting mission. no sshkey found."
|
echo "aborting mission. no sshkey found."
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -87,6 +97,7 @@ preflight()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#work in progress
|
||||||
deploy()
|
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 ****
|
# **** start of script ****
|
||||||
|
|
||||||
|
@ -191,6 +215,9 @@ for option in $options; do
|
||||||
-s|--sshkey)
|
-s|--sshkey)
|
||||||
sshkey=1
|
sshkey=1
|
||||||
;;
|
;;
|
||||||
|
-d|--deploy)
|
||||||
|
deploy=1
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
if [ $config -eq 1 ]; then
|
if [ $config -eq 1 ]; then
|
||||||
if [ -r $option ]; then
|
if [ -r $option ]; then
|
||||||
|
@ -208,6 +235,9 @@ for option in $options; do
|
||||||
echo "aborting mission. cannot read sshkeyfile. [$option]"
|
echo "aborting mission. cannot read sshkeyfile. [$option]"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
elif [ $deploy -eq 1 ]; then
|
||||||
|
remotemachine=$option
|
||||||
|
deploy=0
|
||||||
else
|
else
|
||||||
if [[ $option =~ ^-.* ]]; then
|
if [[ $option =~ ^-.* ]]; then
|
||||||
echo "aborting mission. unknown option given. [$option]"
|
echo "aborting mission. unknown option given. [$option]"
|
||||||
|
@ -245,8 +275,10 @@ if [ -r $configfile ]; then
|
||||||
source $configfile
|
source $configfile
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
debug
|
||||||
|
|
||||||
#running preflight checks
|
#running preflight checks
|
||||||
preflight
|
#preflight
|
||||||
#sshbackup $sourcepath $destinationpath $versions
|
#sshbackup $sourcepath $destinationpath $versions
|
||||||
|
|
||||||
|
|
||||||
|
|
Reference in New Issue