From 751736d41a3b313dc9773206efcfa20d4dbc7257 Mon Sep 17 00:00:00 2001 From: Habetdin Date: Thu, 7 Mar 2019 10:32:30 +0300 Subject: [PATCH] Update ros_install.sh 1. Fix grep filter: ROS key has "ROS Builder " uid and it did not match old "ROS builder" pattern, should match the new one. 2. Add curl support: Previous version was hardcoded to use only the wget without any fallback option, while wiki entry about the script offers curl usage too. --- ros_install.sh | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/ros_install.sh b/ros_install.sh index 7b61196..7559b37 100755 --- a/ros_install.sh +++ b/ros_install.sh @@ -65,9 +65,23 @@ if [ ! -e /etc/apt/sources.list.d/ros-latest.list ]; then fi echo "[Download the ROS keys]" -roskey=`apt-key list | grep "ROS builder"` +roskey=$(apt-key list | grep "ROS Builder") if [ -z "$roskey" ]; then - wget --quiet https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -O - | sudo apt-key add - + if [ -n "$(command -v wget)" ]; then + tool="wget --quiet -O -" + elif [ -n "$(command -v curl)" ]; then + tool="curl --silent" + else + tool="" + fi + if [ -n "$tool" ]; then + $tool "https://raw.githubusercontent.com/ros/rosdistro/master/ros.key" | sudo apt-key add - + else + echo "Error: curl or wget not found" + fi + unset tool +else + echo "ROS key is already installed" fi echo "[Update & upgrade the package]"