Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions script/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,9 @@ Delete all packages in the workspace.
Use catkin to build the workspace.
### usage
1. ```CATKIN_MAKE_SARA```

# Using ssh
To use ssh instead of https, you need to set SARA_FORCE_SSH=true.
To make this permanent, add this line to your .bashrc:
```SARA_FORCE_SSH=true```
Note that when forcing ssh, the .rosinstall file will still show https but ssh will be used nevertheless.
13 changes: 13 additions & 0 deletions script/_switch_https_ssh.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash
while getopts "sh" arg; do
case $arg in
s)
# Switch to ssh
sed "s/https:\/\/github\.com\/walkingmachine/git@github\.com\:WalkingMachine/g" src/.rosinstall > /tmp/sara_install && mv /tmp/sara_install src/.rosinstall
;;
h)
# Switch to https
sed "s/git@github\.com\:WalkingMachine/https:\/\/github\.com\/walkingmachine/g" src/.rosinstall > /tmp/sara_install && mv /tmp/sara_install src/.rosinstall
;;
esac
done
19 changes: 19 additions & 0 deletions script/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,16 @@ source "$WSDIR/script/setup.sh"
# Move to the workspace
cd "$WSDIR"


######################################
## Set to ssh if needed
if [[ $SARA_FORCE_SSH == "true" ]]
then
echo "SARA_FORCE_SSH is true. Forcing ssh mode."
bash -c "source script/_switch_https_ssh.sh -s"
fi


######################################
## Remove extra repos

Expand Down Expand Up @@ -80,6 +90,15 @@ set +v
######################################
## End


######################################
## Set back to https if needed
if [[ $SARA_FORCE_SSH == "true" ]]
then
bash -c "source script/_switch_https_ssh.sh -h"
fi


# Get the right setup for the shell
source $WSDIR/devel/setup.$SHELL_EXTENSION
# Move back to the original position
Expand Down
29 changes: 23 additions & 6 deletions script/scrape_config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,15 @@ fi
cd "$WSDIR"


######################################
## Set to ssh if needed
if [[ $SARA_FORCE_SSH == "true" ]]
then
echo "SARA_FORCE_SSH is true. Forcing ssh mode."
bash -c "source script/_switch_https_ssh.sh -s"
fi


######################################
## Scrape all packages using wstool and some gawk magics.

Expand All @@ -65,19 +74,19 @@ echo "By Branch:"
wstool info -t src --data-only | sed -r 's/\ [XLVCM][XLVCM]?\ /\ /' | sed 's/([^(]*)/\ /'g | tac > /tmp/sara_install_ws
gawk 'BEGIN { FS = " " } ; $2=="git" {print "- "$2":\n\
local-name: "$1"\n\
uri: https://"$5"\n\
version: "$3}' /tmp/sara_install_ws > src/.rosinstall

uri: "$5"\n\
version: "$3}' /tmp/sara_install_ws > /tmp/sara_install_ws2
sed "s/github.com\//https:\/\/github.com\//g" /tmp/sara_install_ws2 > src/.rosinstall
echo "here is a summary of all packages in src:"
gawk 'BEGIN { FS = " " } ; $2=="git" {print " - "$1" "$3""}' /tmp/sara_install_ws | column -t
else
echo "By commit:"
wstool info -t src --only=scmtype,localname,revision,uri | tr , \ | tac > /tmp/sara_install_ws
gawk '$2=="git" {print "- "$1":\n\
local-name: "$2"\n\
uri: https://"$4"\n\
version: "$3}' /tmp/sara_install_ws > src/.rosinstall

uri: "$4"\n\
version: "$3}' /tmp/sara_install_ws > /tmp/sara_install_ws2
sed "s/github.com\//https:\/\/github.com\//g" /tmp/sara_install_ws2 > src/.rosinstall
echo "here is a summary of all packages in src:"
gawk '$2=="git" {print " - "$2" ("$3")"}' /tmp/sara_install_ws

Expand All @@ -86,6 +95,14 @@ fi
#rm /tmp/sara_install_ws


######################################
## Set back to https if needed
if [[ $SARA_FORCE_SSH == "true" ]]
then
bash -c "source script/_switch_https_ssh.sh -h"
fi


######################################
## End

Expand Down
19 changes: 19 additions & 0 deletions script/status.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,16 @@ source "$WSDIR/script/setup.sh"
# Move to the workspace
cd "$WSDIR"


######################################
## Set to ssh if needed
if [[ $SARA_FORCE_SSH == "true" ]]
then
echo "SARA_FORCE_SSH is true. Forcing ssh mode."
bash -c "source script/_switch_https_ssh.sh -s"
fi


######################################
## Status report

Expand All @@ -73,6 +83,15 @@ echo "*"
echo -e "*****************************************\n\n"
######################################


######################################
## Set back to https if needed
if [[ $SARA_FORCE_SSH == "true" ]]
then
bash -c "source script/_switch_https_ssh.sh -h"
fi


## End

# Move back to the original position
Expand Down
20 changes: 20 additions & 0 deletions script/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,15 @@ source "$WSDIR/script/setup.sh"
cd "$WSDIR"


######################################
## Set to ssh if needed
if [[ $SARA_FORCE_SSH == "true" ]]
then
echo "SARA_FORCE_SSH is true. Forcing ssh mode."
bash -c "source script/_switch_https_ssh.sh -s"
fi


######################################
## Update all packages

Expand All @@ -68,6 +77,17 @@ set +v
######################################
## End



######################################
## Set back to https if needed
if [[ $SARA_FORCE_SSH == "true" ]]
then
bash -c "source script/_switch_https_ssh.sh -h"
fi



# Get the right setup for the shell
source $WSDIR/devel/setup.$SHELL_EXTENSION
# Move back to the original position
Expand Down