From c5a3fff2b8804b99a2bf2137dee9114b69dabd98 Mon Sep 17 00:00:00 2001 From: emmanuelkring Date: Wed, 10 Jun 2020 01:44:13 +0200 Subject: [PATCH 01/10] fix issue #8 --- scripts/fresh_install.sh | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/scripts/fresh_install.sh b/scripts/fresh_install.sh index 69fe16a..41cb3bc 100755 --- a/scripts/fresh_install.sh +++ b/scripts/fresh_install.sh @@ -13,8 +13,8 @@ function check-pkg-installed echo "Please specify package name" 1>&2 exit -1 else - if `apt list --installed 2>/dev/null | grep -iqwe ^$1/`; then - if `apt list 2>/dev/null | grep -iqwe ^$1/`; then + if ! `apt list --installed 2>/dev/null | grep -iqwe ^$1`; then + if ! `apt list 2>/dev/null | grep -iqwe ^$1`; then echo "Package $1 does not exist" 1>&2 exit -1 fi @@ -27,20 +27,10 @@ function check-pkg-installed function install-pkg { - if [ $# -eq 0 ]; then - echo "Please specify package name" 1>&2 - exit -1 + if check-pkg-installed $1 -eq 0; then + sudo apt-get install $1 else - if `apt list --installed 2>/dev/null | grep -iqwe ^$1/`; then - if `apt list 2>/dev/null | grep -iqwe ^$1/`; then - echo "Package $1 does not exist" 1>&2 - exit -1 - else - sudo apt-get install $1 - fi - else - echo "$1 already installed." - fi + echo "$1 already installed." fi } From 279b7c6f6426193717c4cb0a6b7c72553e25fd09 Mon Sep 17 00:00:00 2001 From: emmanuelkring Date: Wed, 10 Jun 2020 02:02:44 +0200 Subject: [PATCH 02/10] faster lookup for existing packages with apt-cache --- scripts/fresh_install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/fresh_install.sh b/scripts/fresh_install.sh index 41cb3bc..55f9e0a 100755 --- a/scripts/fresh_install.sh +++ b/scripts/fresh_install.sh @@ -14,7 +14,7 @@ function check-pkg-installed exit -1 else if ! `apt list --installed 2>/dev/null | grep -iqwe ^$1`; then - if ! `apt list 2>/dev/null | grep -iqwe ^$1`; then + if [[ -z `apt-cache search --names-only ^$1` ]]; then echo "Package $1 does not exist" 1>&2 exit -1 fi From c742e262fb4c8b053af025d765f7efb912286d95 Mon Sep 17 00:00:00 2001 From: emmanuelkring Date: Wed, 10 Jun 2020 02:12:07 +0200 Subject: [PATCH 03/10] fix issue #1 --- scripts/fresh_install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/fresh_install.sh b/scripts/fresh_install.sh index 55f9e0a..a56655e 100755 --- a/scripts/fresh_install.sh +++ b/scripts/fresh_install.sh @@ -68,4 +68,4 @@ else fi #ROS compilation utils -install-pkgs python-catkin-tools python-wstool +install-pkgs python-catkin-tools python-wstool python-pip From ce6bf3f6783c096a7a412b2ddfd11f65b19bf6c5 Mon Sep 17 00:00:00 2001 From: emmanuelkring Date: Wed, 10 Jun 2020 03:24:33 +0200 Subject: [PATCH 04/10] add noetic compatibility --- scripts/fresh_install.sh | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/scripts/fresh_install.sh b/scripts/fresh_install.sh index a56655e..5bfa6bc 100755 --- a/scripts/fresh_install.sh +++ b/scripts/fresh_install.sh @@ -44,7 +44,11 @@ function install-pkgs #MAIN------------------------ ubuntu_release=$(get-ubuntu-release) -if [[ $ubuntu_release == *"18.04"* ]]; then +PYTHON=python +if [[ $ubuntu_release == *"20.04"* ]]; then + ROS_DISTRO="noetic" + PYTHON=python3 +elif [[ $ubuntu_release == *"18.04"* ]]; then ROS_DISTRO="melodic" elif [[ $ubuntu_release == *"16.04"* ]]; then ROS_DISTRO="kinetic" @@ -59,13 +63,18 @@ if check-pkg-installed ros-$ROS_DISTRO-desktop -eq 0; then sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116 sudo apt update sudo apt install ros-$ROS_DISTRO-desktop + install-pkg $PYTHON-rosdep sudo rosdep init rosdep update - sudo apt install python-wstool python-catkin-tools echo "ROS $ROS_DISTRO installed." else echo "ROS $ROS_DISTRO already installed." fi -#ROS compilation utils -install-pkgs python-catkin-tools python-wstool python-pip +#ROS compilation utils and pip +install-pkgs $PYTHON-wstool $PYTHON-pip +if [[ $ROS_DISTRO == "noetic" ]]; then + $PYTHON -m pip install --user git+https://github.com/catkin/catkin_tools.git +else + install-pkg $PYTHON-catkin-tools +fi From cb41934035b453c3f4ea83d80206fa7d789c5961 Mon Sep 17 00:00:00 2001 From: emmanuelkring Date: Wed, 10 Jun 2020 03:26:14 +0200 Subject: [PATCH 05/10] update key --- scripts/fresh_install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/fresh_install.sh b/scripts/fresh_install.sh index 5bfa6bc..6d57796 100755 --- a/scripts/fresh_install.sh +++ b/scripts/fresh_install.sh @@ -60,7 +60,7 @@ fi #ROS install if check-pkg-installed ros-$ROS_DISTRO-desktop -eq 0; then sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list' - sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116 + sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654 sudo apt update sudo apt install ros-$ROS_DISTRO-desktop install-pkg $PYTHON-rosdep From 77469d48f675a73f8fc8ac35312da42240ffc454 Mon Sep 17 00:00:00 2001 From: emmanuelkring Date: Wed, 10 Jun 2020 03:30:45 +0200 Subject: [PATCH 06/10] fix indentation --- scripts/fresh_install.sh | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/scripts/fresh_install.sh b/scripts/fresh_install.sh index 6d57796..002a0fd 100755 --- a/scripts/fresh_install.sh +++ b/scripts/fresh_install.sh @@ -36,9 +36,9 @@ function install-pkg function install-pkgs { - for pkg in $*; do - install-pkg $pkg - done + for pkg in $*; do + install-pkg $pkg + done } #MAIN------------------------ @@ -46,29 +46,29 @@ function install-pkgs ubuntu_release=$(get-ubuntu-release) PYTHON=python if [[ $ubuntu_release == *"20.04"* ]]; then - ROS_DISTRO="noetic" - PYTHON=python3 + ROS_DISTRO="noetic" + PYTHON=python3 elif [[ $ubuntu_release == *"18.04"* ]]; then - ROS_DISTRO="melodic" + ROS_DISTRO="melodic" elif [[ $ubuntu_release == *"16.04"* ]]; then - ROS_DISTRO="kinetic" + ROS_DISTRO="kinetic" else - echo "Ubuntu release not supported: $ubuntu_release" - exit -1 + echo "Ubuntu release not supported: $ubuntu_release" + exit -1 fi #ROS install if check-pkg-installed ros-$ROS_DISTRO-desktop -eq 0; then - sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list' - sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654 - sudo apt update - sudo apt install ros-$ROS_DISTRO-desktop - install-pkg $PYTHON-rosdep - sudo rosdep init - rosdep update - echo "ROS $ROS_DISTRO installed." + sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list' + sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654 + sudo apt update + sudo apt install ros-$ROS_DISTRO-desktop + install-pkg $PYTHON-rosdep + sudo rosdep init + rosdep update + echo "ROS $ROS_DISTRO installed." else - echo "ROS $ROS_DISTRO already installed." + echo "ROS $ROS_DISTRO already installed." fi #ROS compilation utils and pip From cf3c26e0896bd8cd33438aac821d8f479971520e Mon Sep 17 00:00:00 2001 From: emmanuelkring Date: Wed, 10 Jun 2020 03:50:12 +0200 Subject: [PATCH 07/10] additional fix for issue #8 --- scripts/fresh_install.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/fresh_install.sh b/scripts/fresh_install.sh index 002a0fd..a25799e 100755 --- a/scripts/fresh_install.sh +++ b/scripts/fresh_install.sh @@ -57,11 +57,12 @@ else exit -1 fi +sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list' +sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654 +sudo apt update + #ROS install if check-pkg-installed ros-$ROS_DISTRO-desktop -eq 0; then - sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list' - sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654 - sudo apt update sudo apt install ros-$ROS_DISTRO-desktop install-pkg $PYTHON-rosdep sudo rosdep init From e448f7811467234e6e98952b906832499acd0521 Mon Sep 17 00:00:00 2001 From: emmanuelkring Date: Wed, 10 Jun 2020 04:13:07 +0200 Subject: [PATCH 08/10] add -y option --- scripts/fresh_install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/fresh_install.sh b/scripts/fresh_install.sh index a25799e..09aca87 100755 --- a/scripts/fresh_install.sh +++ b/scripts/fresh_install.sh @@ -28,7 +28,7 @@ function check-pkg-installed function install-pkg { if check-pkg-installed $1 -eq 0; then - sudo apt-get install $1 + sudo apt-get install -y $1 else echo "$1 already installed." fi @@ -63,7 +63,7 @@ sudo apt update #ROS install if check-pkg-installed ros-$ROS_DISTRO-desktop -eq 0; then - sudo apt install ros-$ROS_DISTRO-desktop + sudo apt install -y ros-$ROS_DISTRO-desktop install-pkg $PYTHON-rosdep sudo rosdep init rosdep update From 4250c94ce828f5cfd8b59305594c93cc296feaff Mon Sep 17 00:00:00 2001 From: emmanuelkring Date: Wed, 10 Jun 2020 15:00:10 +0200 Subject: [PATCH 09/10] fix for installing dependencies on ubuntu 20.04 --- scripts/install_dependencies.sh | 44 +++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 16 deletions(-) diff --git a/scripts/install_dependencies.sh b/scripts/install_dependencies.sh index 2007c0f..6944063 100755 --- a/scripts/install_dependencies.sh +++ b/scripts/install_dependencies.sh @@ -15,32 +15,44 @@ if roscd skiros2; then fi # Python Dependencies +PIP="python$ROS_PYTHON_VERSION -m pip" if roscd skiros2; then - cd .. && python$ROS_PYTHON_VERSION -m pip install -r requirements.txt --user + cd .. && $PIP install -r requirements.txt --user fi if roscd skills_sandbox; then - python$ROS_PYTHON_VERSION -m pip install -r requirements.txt --user + $PIP install -r requirements.txt --user + if [[ $ROS_PYTHON_VERSION == 3 ]]; then + $PIP install --upgrade git+https://github.com/kivy/kivy + fi fi if roscd vision; then - python$ROS_PYTHON_VERSION -m pip install -r requirements.txt --user + $PIP install -r requirements.txt --user + if [[ $ROS_PYTHON_VERSION == 3 ]]; then + $PIP install --upgrade git+https://github.com/emmanuelkring/pypcd.git + fi fi if roscd low_level_logics; then - python$ROS_PYTHON_VERSION -m pip install -r requirements.txt --user + $PIP install -r requirements.txt --user fi # Install realsense drivers +# Currently not available on Ubuntu 20.04 # Get distribution environment variables -. /etc/lsb-release -export repo="http://realsense-hw-public.s3.amazonaws.com/Debian/apt-repo" -export repo_check="$repo $DISTRIB_CODENAME main" -export repo_add="$repo main" -if ! grep -q "^deb .*$repo_check" /etc/apt/sources.list /etc/apt/sources.list.d/*; then\ - sudo apt-key adv --keyserver keys.gnupg.net --recv-key F6E65AC044F831AC80A06380C8B3A55A6F3EFCDE - sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key F6E65AC044F831AC80A06380C8B3A55A6F3EFCDE - sudo add-apt-repository "$repo_add" -u +if [[ $ROS_PYTHON_VERSION == 2 ]]; then + . /etc/lsb-release + export repo="http://realsense-hw-public.s3.amazonaws.com/Debian/apt-repo" + export repo_check="$repo $DISTRIB_CODENAME main" + export repo_add="$repo main" + if ! grep -q "^deb .*$repo_check" /etc/apt/sources.list /etc/apt/sources.list.d/*; then\ + sudo apt-key adv --keyserver keys.gnupg.net --recv-key F6E65AC044F831AC80A06380C8B3A55A6F3EFCDE + sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key F6E65AC044F831AC80A06380C8B3A55A6F3EFCDE + sudo add-apt-repository "$repo_add" -u + else + echo "Realsense repo exists already." + fi + + sudo apt update + sudo apt install librealsense2-dkms librealsense2-utils librealsense2-dev else - echo "Realsense repo exists already." + echo "WARNING: realsense drivers are currently not available for this platform" fi - -sudo apt update -sudo apt install librealsense2-dkms librealsense2-utils librealsense2-dev From 9fe0d58e9e0345bc462b4ad744f57c8bbbb839e4 Mon Sep 17 00:00:00 2001 From: Emmanuel Kring Date: Wed, 10 Jun 2020 16:14:01 +0200 Subject: [PATCH 10/10] change order of installation to avoid error --- scripts/install_dependencies.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install_dependencies.sh b/scripts/install_dependencies.sh index 6944063..e2e65cb 100755 --- a/scripts/install_dependencies.sh +++ b/scripts/install_dependencies.sh @@ -20,16 +20,16 @@ if roscd skiros2; then cd .. && $PIP install -r requirements.txt --user fi if roscd skills_sandbox; then - $PIP install -r requirements.txt --user if [[ $ROS_PYTHON_VERSION == 3 ]]; then $PIP install --upgrade git+https://github.com/kivy/kivy fi + $PIP install -r requirements.txt --user fi if roscd vision; then - $PIP install -r requirements.txt --user if [[ $ROS_PYTHON_VERSION == 3 ]]; then $PIP install --upgrade git+https://github.com/emmanuelkring/pypcd.git fi + $PIP install -r requirements.txt --user fi if roscd low_level_logics; then $PIP install -r requirements.txt --user