-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathraspberry-ssh.sh
More file actions
executable file
·63 lines (57 loc) · 1.29 KB
/
raspberry-ssh.sh
File metadata and controls
executable file
·63 lines (57 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
source setenv.sh
###### Variable section - START
OPTION=$1
DESTINATION=
SCRIPT="raspberry-ssh.sh"
###### Variable section - END
############
## sshRun ##
############
sshRun()
{
if [ -z $PLATFORM_OPTION ]; then
printSelectDestination
fi
ssh pi@$DESTINATION -i $HOME/.ssh/ansible_rsa
}
###############
## printHelp ##
###############
printHelp()
{
printf "${red}Missing IP or Hostname destination to copy SSH key${end}\n"
printf "${cyn}Usage: ./$SCRIPT <DESTINATION>${end}\n"
printf "\n"
printf "${cyn}Example: ./$SCRIPT 192.168.4.290${end}\n"
exit
}
printSelectDestination()
{
echo ${grn}Select Raspberry Box platform to connect: ${end}
echo "${grn}1. raspberry01${end}"
echo "${grn}2. raspberry02${end}"
read OPTION
setDestination
}
setDestination()
{
case $OPTION in
1) DESTINATION="raspberry01"
;;
2) DESTINATION="raspberry02"
;;
*) printf "\n${red}No valid option selected${end}\n"
printSelectDestination
;;
esac
}
# ##############################################
# #################### MAIN ####################
# ##############################################
# ************ START evaluate args ************"
if [ "$1" != "" ]; then
setDestination
fi
# ************** END evaluate args **************"
RUN_FUNCTION=sshRun
$RUN_FUNCTION