From c7bfcdd8d4c5c0cc39c8850d8adf94951ace0aa6 Mon Sep 17 00:00:00 2001 From: philippe117 Date: Tue, 26 May 2020 20:55:10 -0400 Subject: [PATCH 1/5] Ajoute l'option de passer en ssh --- script/_switch_https_ssh.sh | 13 +++++++++++++ script/install.sh | 19 +++++++++++++++++++ script/scrape_config.sh | 17 +++++++++++++++++ script/status.sh | 19 +++++++++++++++++++ script/update.sh | 20 ++++++++++++++++++++ 5 files changed, 88 insertions(+) create mode 100644 script/_switch_https_ssh.sh diff --git a/script/_switch_https_ssh.sh b/script/_switch_https_ssh.sh new file mode 100644 index 0000000..b2c49f3 --- /dev/null +++ b/script/_switch_https_ssh.sh @@ -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 diff --git a/script/install.sh b/script/install.sh index 9b1bd1d..327874b 100644 --- a/script/install.sh +++ b/script/install.sh @@ -38,6 +38,16 @@ source "$WSDIR/script/setup.sh" # Move to the workspace cd "$WSDIR" + +###################################### +## Set to ssh if needed +if [[ $FORCE_SSH == "true" ]] +then + echo "FORCE_SSH is true. Forcing ssh mode." + bash -c "source script/_switch_https_ssh.sh -s" +fi + + ###################################### ## Remove extra repos @@ -67,6 +77,15 @@ set +v ###################################### ## End + +###################################### +## Set back to https if needed +if [[ $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_EXTENTION # Move back to the original position diff --git a/script/scrape_config.sh b/script/scrape_config.sh index c2a2083..b4adf55 100644 --- a/script/scrape_config.sh +++ b/script/scrape_config.sh @@ -37,6 +37,15 @@ WSDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )/.." cd "$WSDIR" +###################################### +## Set to ssh if needed +if [[ $FORCE_SSH == "true" ]] +then + echo "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. @@ -73,6 +82,14 @@ fi #rm /tmp/sara_install_ws +###################################### +## Set back to https if needed +if [[ $FORCE_SSH == "true" ]] +then + bash -c "source script/_switch_https_ssh.sh -h" +fi + + ###################################### ## End diff --git a/script/status.sh b/script/status.sh index ca2ee1d..f252bb3 100644 --- a/script/status.sh +++ b/script/status.sh @@ -35,6 +35,16 @@ source "$WSDIR/script/setup.sh" # Move to the workspace cd "$WSDIR" + +###################################### +## Set to ssh if needed +if [[ $FORCE_SSH == "true" ]] +then + echo "FORCE_SSH is true. Forcing ssh mode." + bash -c "source script/_switch_https_ssh.sh -s" +fi + + ###################################### ## Status report @@ -60,6 +70,15 @@ echo "*" echo -e "*****************************************\n\n" ###################################### + +###################################### +## Set back to https if needed +if [[ $FORCE_SSH == "true" ]] +then + bash -c "source script/_switch_https_ssh.sh -h" +fi + + ## End # Move back to the original position diff --git a/script/update.sh b/script/update.sh index 5b081bc..33b8093 100644 --- a/script/update.sh +++ b/script/update.sh @@ -39,6 +39,15 @@ source "$WSDIR/script/setup.sh" cd "$WSDIR" +###################################### +## Set to ssh if needed +if [[ $FORCE_SSH == "true" ]] +then + echo "FORCE_SSH is true. Forcing ssh mode." + bash -c "source script/_switch_https_ssh.sh -s" +fi + + ###################################### ## Update all packages @@ -55,6 +64,17 @@ set +v ###################################### ## End + + +###################################### +## Set back to https if needed +if [[ $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_EXTENTION # Move back to the original position From 04b8b7d96b3f8729ce4a6b80cc0416badf3b1694 Mon Sep 17 00:00:00 2001 From: philippe117 Date: Tue, 26 May 2020 21:31:21 -0400 Subject: [PATCH 2/5] Ajoute l'information sur ssh dans le readme. --- script/README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/script/README.md b/script/README.md index c296e7d..46c19aa 100644 --- a/script/README.md +++ b/script/README.md @@ -62,3 +62,8 @@ 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 FORCE_SSH=true. +To make this permanent, add this line to your .bashrc: +```FORCE_SSH=true``` From 6da42460a424894d628b57fa4c89f63c3a488688 Mon Sep 17 00:00:00 2001 From: philippe117 Date: Wed, 27 May 2020 15:13:11 -0400 Subject: [PATCH 3/5] Clarifie l'utilisation de SSH dans le README --- script/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/script/README.md b/script/README.md index 46c19aa..4b65c5d 100644 --- a/script/README.md +++ b/script/README.md @@ -67,3 +67,4 @@ Use catkin to build the workspace. To use ssh instead of https, you need to set FORCE_SSH=true. To make this permanent, add this line to your .bashrc: ```FORCE_SSH=true``` +Note that when forcing ssh, the .rosinstall file will still show https but ssh will be used nevertheless. From 46853aeacd3a98b0c0fac37bee913b4a05c98bea Mon Sep 17 00:00:00 2001 From: Raphael Date: Thu, 28 May 2020 22:39:04 -0400 Subject: [PATCH 4/5] Rename to include SARA_ in variable Namespace concerns --- script/README.md | 4 ++-- script/install.sh | 6 +++--- script/scrape_config.sh | 6 +++--- script/status.sh | 6 +++--- script/update.sh | 6 +++--- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/script/README.md b/script/README.md index 4b65c5d..e8845ca 100644 --- a/script/README.md +++ b/script/README.md @@ -64,7 +64,7 @@ Use catkin to build the workspace. 1. ```CATKIN_MAKE_SARA``` # Using ssh -To use ssh instead of https, you need to set FORCE_SSH=true. +To use ssh instead of https, you need to set SARA_FORCE_SSH=true. To make this permanent, add this line to your .bashrc: -```FORCE_SSH=true``` +```SARA_FORCE_SSH=true``` Note that when forcing ssh, the .rosinstall file will still show https but ssh will be used nevertheless. diff --git a/script/install.sh b/script/install.sh index 43c9189..7784b2d 100644 --- a/script/install.sh +++ b/script/install.sh @@ -54,9 +54,9 @@ cd "$WSDIR" ###################################### ## Set to ssh if needed -if [[ $FORCE_SSH == "true" ]] +if [[ $SARA_FORCE_SSH == "true" ]] then - echo "FORCE_SSH is true. Forcing ssh mode." + echo "SARA_FORCE_SSH is true. Forcing ssh mode." bash -c "source script/_switch_https_ssh.sh -s" fi @@ -93,7 +93,7 @@ set +v ###################################### ## Set back to https if needed -if [[ $FORCE_SSH == "true" ]] +if [[ $SARA_FORCE_SSH == "true" ]] then bash -c "source script/_switch_https_ssh.sh -h" fi diff --git a/script/scrape_config.sh b/script/scrape_config.sh index 3e5a36d..5aeacbc 100644 --- a/script/scrape_config.sh +++ b/script/scrape_config.sh @@ -52,9 +52,9 @@ cd "$WSDIR" ###################################### ## Set to ssh if needed -if [[ $FORCE_SSH == "true" ]] +if [[ $SARA_FORCE_SSH == "true" ]] then - echo "FORCE_SSH is true. Forcing ssh mode." + echo "SARA_FORCE_SSH is true. Forcing ssh mode." bash -c "source script/_switch_https_ssh.sh -s" fi @@ -97,7 +97,7 @@ fi ###################################### ## Set back to https if needed -if [[ $FORCE_SSH == "true" ]] +if [[ $SARA_FORCE_SSH == "true" ]] then bash -c "source script/_switch_https_ssh.sh -h" fi diff --git a/script/status.sh b/script/status.sh index 71ddc97..d7e6482 100644 --- a/script/status.sh +++ b/script/status.sh @@ -51,9 +51,9 @@ cd "$WSDIR" ###################################### ## Set to ssh if needed -if [[ $FORCE_SSH == "true" ]] +if [[ $SARA_FORCE_SSH == "true" ]] then - echo "FORCE_SSH is true. Forcing ssh mode." + echo "SARA_FORCE_SSH is true. Forcing ssh mode." bash -c "source script/_switch_https_ssh.sh -s" fi @@ -86,7 +86,7 @@ echo -e "*****************************************\n\n" ###################################### ## Set back to https if needed -if [[ $FORCE_SSH == "true" ]] +if [[ $SARA_FORCE_SSH == "true" ]] then bash -c "source script/_switch_https_ssh.sh -h" fi diff --git a/script/update.sh b/script/update.sh index 78ce806..7bf0ed7 100644 --- a/script/update.sh +++ b/script/update.sh @@ -54,9 +54,9 @@ cd "$WSDIR" ###################################### ## Set to ssh if needed -if [[ $FORCE_SSH == "true" ]] +if [[ $SARA_FORCE_SSH == "true" ]] then - echo "FORCE_SSH is true. Forcing ssh mode." + echo "SARA_FORCE_SSH is true. Forcing ssh mode." bash -c "source script/_switch_https_ssh.sh -s" fi @@ -81,7 +81,7 @@ set +v ###################################### ## Set back to https if needed -if [[ $FORCE_SSH == "true" ]] +if [[ $SARA_FORCE_SSH == "true" ]] then bash -c "source script/_switch_https_ssh.sh -h" fi From 75d942a70891df9194fb4df167aee2d35bae5506 Mon Sep 17 00:00:00 2001 From: philippe117 Date: Thu, 28 May 2020 22:59:24 -0400 Subject: [PATCH 5/5] Corrige un bug avec SCRAPE qui assumait l'utilisation de https --- script/scrape_config.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/script/scrape_config.sh b/script/scrape_config.sh index 5aeacbc..06343bd 100644 --- a/script/scrape_config.sh +++ b/script/scrape_config.sh @@ -74,9 +74,9 @@ 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 @@ -84,9 +84,9 @@ 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