From 0ec3973b0722b10238bd4fa84927817f2a7611b2 Mon Sep 17 00:00:00 2001 From: "Dr. Denis" Date: Mon, 9 Oct 2023 21:17:55 +0200 Subject: [PATCH] [OS Setup] Script for installing standard software to 22.04 (#57) Co-authored-by: Manuel M Co-authored-by: muritane <31107191+muritane@users.noreply.github.com> --- scripts/_RosTeamWs_Defines.bash | 12 +- scripts/_Team_Defines.bash | 4 + scripts/os_configure/install_software_20.bash | 314 +++++++++++------- scripts/os_configure/install_software_22.bash | 242 ++++++++++++++ .../os_configure/install_software_ros.bash | 34 +- .../os_configure/install_software_ros2.bash | 31 +- scripts/os_configure/vs-code_plugins.txt | 27 ++ .../os_configure/extend_to_bash_commands | 17 + templates/os_configure/extend_to_bashrc | 5 + 9 files changed, 533 insertions(+), 153 deletions(-) mode change 100644 => 100755 scripts/os_configure/install_software_20.bash create mode 100755 scripts/os_configure/install_software_22.bash create mode 100644 scripts/os_configure/vs-code_plugins.txt create mode 100644 templates/os_configure/extend_to_bash_commands create mode 100644 templates/os_configure/extend_to_bashrc diff --git a/scripts/_RosTeamWs_Defines.bash b/scripts/_RosTeamWs_Defines.bash index e5d9a6f4..c7fb648e 100755 --- a/scripts/_RosTeamWs_Defines.bash +++ b/scripts/_RosTeamWs_Defines.bash @@ -1,4 +1,5 @@ -# Copyright (c) 2021, Stogl Robotics Consulting UG (haftungsbeschränkt) +#!/usr/bin/env bash +# Copyright (c) 2022, Stogl Robotics Consulting UG (haftungsbeschränkt) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -30,6 +31,14 @@ if [ -z "$rtw_supported_ros_distributions" ]; then readonly rtw_supported_ros_distributions=("noetic" "foxy" "galactic" "humble" "iron" "rolling") fi +# Mapping of ubuntu version and supported ros distributions +if [ -z "$ubuntu_20_04_supported_ros_distributions" ]; then + readonly ubuntu_20_04_supported_ros_distributions=("noetic" "foxy" "galactic" "rolling") +fi +if [ -z "$ubuntu_22_04_supported_ros_distributions" ]; then + readonly ubuntu_22_04_supported_ros_distributions=("rolling" "humble") +fi + # This needs to be set for every branch # Check the set_supported_versions functions below and update as fit. RTW_BRANCH_ROS_DISTRO="rolling" @@ -349,6 +358,7 @@ function set_framework_default_paths { ROS2_CONTROL_CONTROLLER_TEMPLATES="$ROS2_CONTROL_TEMPLATES/controller" LICENSE_TEMPLATES="$FRAMEWORK_BASE_PATH/templates/licenses" DOCKER_TEMPLATES="$FRAMEWORK_BASE_PATH/templates/docker" + OS_CONFIGURE_TEMPLATES="$FRAMEWORK_BASE_PATH/templates/os_configure" } function is_valid_ros_distribution { diff --git a/scripts/_Team_Defines.bash b/scripts/_Team_Defines.bash index b1e160bd..2bb1214b 100644 --- a/scripts/_Team_Defines.bash +++ b/scripts/_Team_Defines.bash @@ -34,6 +34,10 @@ fi ## END: Framework definitions adjustable by users # BEGIN: Define aliases for standard internal functions +#cd to often used places +alias cd_ros_team_ws='cd $FRAMEWORK_BASE_PATH' +alias cd_rtw='cd $FRAMEWORK_BASE_PATH' +alias cd_rtw_scripts='cd $RosTeamWS_FRAMEWORK_SCRIPTS_PATH' alias setup_exports=RosTeamWS_setup_exports diff --git a/scripts/os_configure/install_software_20.bash b/scripts/os_configure/install_software_20.bash old mode 100644 new mode 100755 index de5cf863..3ee4c02d --- a/scripts/os_configure/install_software_20.bash +++ b/scripts/os_configure/install_software_20.bash @@ -1,196 +1,252 @@ -#!/usr/bin/bash +#!/usr/bin/env bash +# Copyright (c) 2022, Stogl Robotics Consulting UG (haftungsbeschränkt) # -# install_software_20.bash [computer_type:{office, robot, default:lab}] +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at # +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# install_software_20.bash [computer_type:{office, robot, default:basic}] script_own_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" > /dev/null && pwd )" SCRIPT_PATH=$script_own_dir +source "${SCRIPT_PATH}"/../../setup.bash + +if [ -z "$supported_computer_types" ]; then + readonly supported_computer_types=("basic" "office" "robot") +fi computer_type=$1 -if [ -z "$1" ] -then - computer_type="lab" - echo "Computer type not provided using default $computer_type" +# check if given computer_type is supported. If this is not the case, then inform user about supported types and +# let user chose which typ he would like. +if ! [[ " ${supported_computer_types[*]} " =~ " ${computer_type} " ]]; then + notify_user "The computer type ${computer_type} you have given is not supported." + echo -e "${TERMINAL_COLOR_USER_INPUT_DECISION} Chose one of the following:" + echo -e "${TERMINAL_COLOR_USER_INPUT_DECISION} basic -Standard pc. Basic utilities like development utilities (git, vscode, ...) and some additional tools." + echo -e "${TERMINAL_COLOR_USER_INPUT_DECISION} office -Used for office pcs. Basic utilities, additional tools and office related stuff." + echo -e "${TERMINAL_COLOR_USER_INPUT_DECISION} robot -Used for robot platforms. Basic utilities like development utilities (git, vscode, ...)." + select computer_type in basic office robot; + do + case "$computer_type" in + basic) + computer_type="basic" + break + ;; + office) + computer_type="office" + break + ;; + robot) + computer_type="robot" + break + ;; + esac + done + echo -n -e "${TERMINAL_COLOR_NC}" fi echo "Installing software for $computer_type computers. Press to continue." read ROS_VERSION=melodic -ROS2_VERSION=foxy +ROS2_VERSIONS=( "galactic" "rolling" ) -# Core tools -sudo apt update && sudo apt -y install curl gnupg2 lsb-release +### CORE TOOLS ### +sudo apt update sudo apt -y install ca-certificates curl gnupg gnupg2 lsb-release -#KDE Backports -sudo apt-add-repository -y ppa:kubuntu-ppa/backports -sudo apt update && sudo apt -y dist-upgrade && sudo apt -y autoremove +# Nala - better apt frontend +echo "deb http://deb.volian.org/volian/ scar main" | sudo tee /etc/apt/sources.list.d/volian-archive-scar-unstable.list +wget -qO - https://deb.volian.org/volian/scar.key | sudo tee /etc/apt/trusted.gpg.d/volian-archive-scar-unstable.gpg > /dev/null +sudo apt update +sudo apt -y install nala +nala --install-completion bash -### Useful tools -sudo apt -y install vim ssh git trash-cli htop unrar yakuake screen finger ksshaskpass kompare filelight -# Dolphin Plugins -sudo apt -y install kdesdk-kio-plugins kdesdk-scripts +# git stable upstream version +sudo add-apt-repository -y ppa:git-core/ppa +sudo apt update -if ([[ $computer_type != "robot" ]]) -then - sudo apt -y install recordmydesktop rdesktop gimp meshlab inkscape pdfposter unrar - sudo DEBIAN_FRONTEND=noninteractive apt -y install wireshark -# sudo apt -y install gvfs-bin gvfs-fuse gvfs-backends -fi +### BASIC TOOLS ### +sudo apt -y install neovim ssh git qgit trash-cli htop unrar yakuake screen finger ksshaskpass kompare filelight tldr thefuck ranger tree pre-commit # Useful libraries sudo apt -y install libxml2-dev libvlc-dev libmuparser-dev libudev-dev -if ([[ $computer_type != "robot" ]]) -then - # Latex - sudo apt -y install kile texlive-full texlive-lang-german kbibtex ktikz -fi - -# Python tools -sudo apt -y install python3-pip -sudo pip3 install --upgrade pip -sudo pip3 install virtualenv virtualenvwrapper notebook +### DEVELOPMENT TOOLS ### +# gh - Github CLI +curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \ +&& sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \ +&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \ +&& sudo apt update \ +&& sudo apt -y install gh +gh completion -s bash | tee "$HOME"/.local/share/bash-completion/completions/gh.bash > /dev/null + +# visual studio code +sudo snap install --classic code +# install all plugins for visual studio code +vs_code_plugin_file=$RosTeamWS_FRAMEWORK_OS_CONFIGURE_PATH/vs-code_plugins.txt +while read extension; do + # ignore empty lines or lines starting with "#" + [[ $extension =~ ^#.* ]] || [ -z "$extension" ] && continue + code --install-extension "${extension}" +done < "${vs_code_plugin_file}" + +# Docker +sudo apt-get update +sudo mkdir -p /etc/apt/keyrings +curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg +echo \ + "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \ + $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null +sudo apt-get update +sudo apt -y install docker-ce docker-ce-cli containerd.io docker-compose-plugin +sudo groupadd docker +sudo usermod -aG docker "$(whoami)" +# VirtualBox +sudo apt install virtualbox dkms virtualbox-guest-utils virtualbox-ext-pack +## ROS # ROS Packages bash $SCRIPT_PATH/install_software_ros.bash $ROS_VERSION # ROS2 Packages -bash $SCRIPT_PATH/install_software_ros2.bash $ROS2_VERSION +for ROS2_VERSION in "${ROS2_VERSIONS[@]}" +do + bash $SCRIPT_PATH/install_software_ros2.bash $ROS2_VERSION +done sudo rosdep init rosdep update -# if ([[ $computer_type == "lab" ]] || [[$computer_type == "robot" ]]) -# then -# bash $SCRIPT_PATH/configure_ROSTeamWS.bash $ROS_VERSION -# fi -# -# if ([[ $computer_type == "robot" ]]) -# then -# bash $SCRIPT_PATH/configure_robots.bash $ROS_VERSION -# fi +# ! They need to come after ros installation ! +# Python tools +sudo apt -y install python3-pip \ + python3-colcon-common-extensions \ + python3-flake8 \ + python3-flake8-blind-except \ + python3-flake8-builtins \ + python3-flake8-class-newline \ + python3-flake8-comprehensions \ + python3-flake8-deprecated \ + python3-flake8-docstrings \ + python3-flake8-import-order \ + python3-flake8-quotes \ + python3-pytest \ + python3-pytest-cov \ + python3-pytest-repeat \ + python3-pytest-rerunfailures \ + python3-rosdep \ + python3-rosdep2 \ + python3-setuptools \ + python3-vcstool \ + python3-pip \ + python3-virtualenv \ + python3-virtualenvwrapper \ + python3-notebook \ +pip3 install --upgrade pip + +# setup bash +cat "$OS_CONFIGURE_TEMPLATES/extend_to_bashrc" >> "$HOME/.bashrc" +cat "$OS_CONFIGURE_TEMPLATES/extend_to_bash_aliases" >> "$HOME/.bash_aliases" +cat "$OS_CONFIGURE_TEMPLATES/extend_to_bash_commands" >> "$HOME/.bash_commands" + +# setup git +commit_template_path="$HOME/.config/git" +template_name="commit-template.txt" +mkdir -p "$commit_template_path" +cp "$OS_CONFIGURE_TEMPLATES/$template_name" "$commit_template_path/." +git config --global core.editor "vim" +git config --global commit.template "$commit_template_path/$template_name" + +### NONE DEVELOPMENT RELATED TOOLS ### -if ([[ $computer_type == "office" ]]) -then +# Dolphin Plugins +sudo apt -y install kdesdk-scripts - sudo apt -y install pass +# Nextcloud +sudo apt -y install nextcloud-desktop -# sudo apt -y install redshift +### BACKPORTS ### +# KDE Backports +sudo apt-add-repository -y ppa:kubuntu-ppa/backports +sudo apt update +sudo apt -y dist-upgrade +sudo apt -y autoremove +########################## END BASIC SETUP ########################## - # Network manager - sudo apt -y install network-manager-openvpn network-manager-vpnc network-manager-ssh network-manager-openconnect +if [[ "${computer_type}" != "robot" ]] +then + sudo apt -y install recordmydesktop rdesktop gimp meshlab inkscape pdfposter unrar +fi + +if [[ "${computer_type}" == "office" ]] +then + ### CRYPTOPGRAPHY AND PASSWORD MANAGEMENT ### # Cryptography sudo apt -y install kleopatra scdaemon + # Passwordmanager + sudo apt -y install pass + + ### NETWORKING ### + # Network manager + sudo apt -y install network-manager-openvpn network-manager-vpnc network-manager-ssh network-manager-openconnect + + # Remote desktop + sudo apt -y install krdc + ## Network monitoring and debugging + # Wireshark + sudo DEBIAN_FRONTEND=noninteractive apt -y install wireshark + # debugging + sudo apt install nethogs nload net-tools + + ### ADDITIONAL DEVELOPMENT TOOLS ### # Code optimization and profiling sudo apt -y install valgrind kcachegrind hotspot heaptrack-gui sudo apt -y install linux-tools-generic linux-cloud-tools-generic # Kernel tools - - # Datensicherung -# sudo apt -y install kup bup - sudo apt -y install flac sudo add-apt-repository -y ppa:freecad-maintainers/freecad-daily sudo apt update sudo apt -y install freecad-daily spacenavd - # Nextcloud - sudo apt -y install nextcloud-desktop - - # VirtualBox - sudo sh -c 'echo "deb [arch=amd64] https://download.virtualbox.org/virtualbox/debian $(lsb_release -sc) contrib" > /etc/apt/sources.list.d/virtualbox.list' - wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add - - sudo apt update - sudo apt -y install virtualbox-6.1 dkms virtualbox-guest-utils virtualbox-ext-pack - - ## Messgengers - - # Telegram - sudo add-apt-repository ppa:atareao/telegram - sudo apt update - sudo apt -y install -f telegram - - # Hamsket - sudo apt -y install libappindicator3-1 - wget https://github.com/TheGoddessInari/hamsket/releases/download/0.6.2/hamsket_0.6.2_amd64.deb - sudo dpkg -i hamsket_0.6.2_amd64.deb - rm hamsket_0.6.2_amd64.deb - - # Spotify - curl -sS https://download.spotify.com/debian/pubkey_0D811D58.gpg | sudo apt-key add - - echo "deb http://repository.spotify.com stable non-free" | sudo tee /etc/apt/sources.list.d/spotify.list - sudo apt update - sudo apt -y install spotify-client - - # Noson - sudo add-apt-repository ppa:jlbarriere68/noson-app + # Tracing + sudo apt-add-repository ppa:lttng/stable-2.12 sudo apt update - sudo apt -y install noson-app + sudo apt -y install lttng-tools lttng-modules-dkms liblttng-ust-dev + sudo apt -y install python3-babeltrace python3-lttng python3-lttngust + sudo usermod -aG tracing "$(whoami)" + ### MANAGE PERSONAL INFORMATION # KDE-PIM sudo apt -y install kontact korganizer kmail kjots kaddressbook kdepim* - # Tools - sudo apt -y install krdc - + ### OFFICE TOOLS ### # Notes-taking sudo add-apt-repository ppa:pbek/qownnotes sudo apt update sudo apt -y install qownnotes + ### LANGUAGES ### # Language packs sudo apt -y install language-pack-de language-pack-de-base language-pack-kde-de aspell-de hunspell-de-de hyphen-de wogerman sudo apt -y install language-pack-hr language-pack-hr-base language-pack-kde-hr aspell-hr hunspell-hr hyphen-hr - ## Development Tools - - # GitHub CLI - curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo gpg --dearmor -o /usr/share/keyrings/githubcli-archive-keyring.gpg - echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null - sudo apt update - sudo apt -y install gh - - # Pre-commit - sudo pip3 install pre-commit - - sudo apt -y install gitk - - # Docker - curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg - echo \ - "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \ - $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null - sudo apt update - sudo apt -y install docker-ce docker-ce-cli containerd.io docker-compose - sudo groupadd docker - sudo usermod -aG docker `whoami` - - # Tracing - sudo apt-add-repository ppa:lttng/stable-2.12 - sudo apt update - sudo apt -y install lttng-tools lttng-modules-dkms liblttng-ust-dev - sudo apt -y install python3-babeltrace python3-lttng python3-lttngust - sudo usermod -aG tracing `whoami` - - # Tuxedo repositories - sudo sh -c 'echo "deb https://deb.tuxedocomputers.com/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/tuxedocomputers.list' - sudo sh -c 'echo "deb https://oibaf.tuxedocomputers.com/ubuntu $(lsb_release -sc) main" >> /etc/apt/sources.list.d/tuxedocomputers.list' - sudo sh -c 'echo "deb https://graphics.tuxedocomputers.com/ubuntu $(lsb_release -sc) main" >> /etc/apt/sources.list.d/tuxedocomputers.list' - sudo sh -c 'echo "deb https://kernel.tuxedocomputers.com/ubuntu $(lsb_release -sc) main" >> /etc/apt/sources.list.d/tuxedocomputers.list' - wget -O - http://deb.tuxedocomputers.com/0x54840598.pub.asc | sudo apt-key add - - sudo apt update - sudo apt -y install tuxedo-tomte tuxedo-control-center tuxedo-* - fi -sudo apt update && sudo apt -y dist-upgrade && sudo apt -y autoremove - +sudo apt update +sudo apt -y dist-upgrade +sudo apt -y autoremove -# Configs -# Yakuake +# log is created somehow +trash "${RosTeamWS_FRAMEWORK_OS_CONFIGURE_PATH}/log/" diff --git a/scripts/os_configure/install_software_22.bash b/scripts/os_configure/install_software_22.bash new file mode 100755 index 00000000..bb1a2d2c --- /dev/null +++ b/scripts/os_configure/install_software_22.bash @@ -0,0 +1,242 @@ +#!/usr/bin/env bash +# Copyright (c) 2022, Stogl Robotics Consulting UG (haftungsbeschränkt) +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# install_software_22.bash [computer_type:{office, robot, default:basic}] + +script_own_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" > /dev/null && pwd )" +SCRIPT_PATH=$script_own_dir +source "${SCRIPT_PATH}"/../../setup.bash + +if [ -z "$supported_computer_types" ]; then + readonly supported_computer_types=("basic" "office" "robot") +fi + +computer_type=$1 +# check if given computer_type is supported. If this is not the case, then inform user about supported types and +# let user chose which typ he would like. +if ! [[ " ${supported_computer_types[*]} " =~ " ${computer_type} " ]]; then + notify_user "The computer type ${computer_type} you have given is not supported." + echo -e "${TERMINAL_COLOR_USER_INPUT_DECISION} Chose one of the following:" + echo -e "${TERMINAL_COLOR_USER_INPUT_DECISION} basic -Standard pc. Basic utilities like development utilities (git, vscode, ...) and some additional tools." + echo -e "${TERMINAL_COLOR_USER_INPUT_DECISION} office -Used for office pcs. Basic utilities, additional tools and office related stuff." + echo -e "${TERMINAL_COLOR_USER_INPUT_DECISION} robot -Used for robot platforms. Basic utilities like development utilities (git, vscode, ...)." + select computer_type in basic office robot; + do + case "$computer_type" in + basic) + computer_type="basic" + break + ;; + office) + computer_type="office" + break + ;; + robot) + computer_type="robot" + break + ;; + esac + done + echo -n -e "${TERMINAL_COLOR_NC}" +fi + +echo "Installing software for $computer_type computers. Press to continue." +read + +ROS2_VERSIONS=( "humble" "rolling" ) + +### CORE TOOLS ### +sudo apt update +sudo apt -y install ca-certificates curl gnupg gnupg2 lsb-release + +# Nala - better apt frontend +echo "deb http://deb.volian.org/volian/ scar main" | sudo tee /etc/apt/sources.list.d/volian-archive-scar-unstable.list +wget -qO - https://deb.volian.org/volian/scar.key | sudo tee /etc/apt/trusted.gpg.d/volian-archive-scar-unstable.gpg > /dev/null +sudo apt update +sudo apt -y install nala +nala --install-completion bash + +# git stable upstream version +sudo add-apt-repository -y ppa:git-core/ppa +sudo apt update + +### BASIC TOOLS ### +sudo apt -y install neovim ssh git qgit trash-cli htop unrar yakuake screen finger ksshaskpass kompare filelight tldr thefuck ranger tree pre-commit + +# Useful libraries +sudo apt -y install libxml2-dev libvlc-dev libmuparser-dev libudev-dev + +### DEVELOPMENT TOOLS ### +# gh - Github CLI (it seems that gh needs to be install via apt to get access to .ssh keys) +sudo apt -y install gh +gh completion -s bash | tee "$HOME"/.local/share/bash-completion/completions/gh.bash > /dev/null + +# visual studio code +sudo snap install --classic code +# install all plugins for visual studio code +vs_code_plugin_file=$RosTeamWS_FRAMEWORK_OS_CONFIGURE_PATH/vs-code_plugins.txt +while read extension; do + # ignore empty lines or lines starting with "#" + [[ $extension =~ ^#.* ]] || [ -z "$extension" ] && continue + code --install-extension "${extension}" +done < "${vs_code_plugin_file}" + +# Docker +sudo apt-get update +sudo mkdir -p /etc/apt/keyrings +curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg +echo \ + "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \ + $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null +sudo apt-get update +sudo apt -y install docker-ce docker-ce-cli containerd.io docker-compose-plugin +sudo groupadd docker +sudo usermod -aG docker "$(whoami)" + +# VirtualBox +sudo apt -y install virtualbox dkms virtualbox-guest-utils virtualbox-ext-pack + +## ROS +# ROS2 Packages +for ROS2_VERSION in "${ROS2_VERSIONS[@]}" +do + bash $SCRIPT_PATH/install_software_ros2.bash $ROS2_VERSION +done + +sudo rosdep init +rosdep update + +# ! They need to come after ros installation ! +# Python tools +sudo apt -y install python3-pip \ + python3-colcon-common-extensions \ + python3-flake8 \ + python3-flake8-blind-except \ + python3-flake8-builtins \ + python3-flake8-class-newline \ + python3-flake8-comprehensions \ + python3-flake8-deprecated \ + python3-flake8-docstrings \ + python3-flake8-import-order \ + python3-flake8-quotes \ + python3-pytest \ + python3-pytest-cov \ + python3-pytest-repeat \ + python3-pytest-rerunfailures \ + python3-rosdep \ + python3-rosdep2 \ + python3-setuptools \ + python3-vcstool \ + python3-pip \ + python3-virtualenv \ + python3-virtualenvwrapper \ + python3-notebook \ +pip3 install --upgrade pip + +# setup bash +cat "$OS_CONFIGURE_TEMPLATES/extend_to_bashrc" >> "$HOME/.bashrc" +cat "$OS_CONFIGURE_TEMPLATES/extend_to_bash_aliases" >> "$HOME/.bash_aliases" +cat "$OS_CONFIGURE_TEMPLATES/extend_to_bash_commands" >> "$HOME/.bash_commands" + +# setup git +commit_template_path="$HOME/.config/git" +template_name="commit-template.txt" +mkdir -p "$commit_template_path" +cp "$OS_CONFIGURE_TEMPLATES/$template_name" "$commit_template_path/." +git config --global core.editor "vim" +git config --global commit.template "$commit_template_path/$template_name" + +### NONE DEVELOPMENT RELATED TOOLS ### + +# Dolphin Plugins +sudo apt -y install kdesdk-scripts + +# Nextcloud +sudo apt -y install nextcloud-desktop + +### BACKPORTS ### +# KDE Backports +sudo apt-add-repository -y ppa:kubuntu-ppa/backports +sudo apt update +sudo apt -y dist-upgrade +sudo apt -y autoremove + +########################## END BASIC SETUP ########################## + +if [[ "${computer_type}" != "robot" ]] +then + sudo apt -y install recordmydesktop rdesktop gimp meshlab inkscape pdfposter unrar +fi + +if [[ "${computer_type}" == "office" ]] +then + + ### CRYPTOPGRAPHY AND PASSWORD MANAGEMENT ### + # Cryptography + sudo apt -y install kleopatra scdaemon + # Passwordmanager + sudo apt -y install pass + + ### NETWORKING ### + # Network manager + sudo apt -y install network-manager-openvpn network-manager-vpnc network-manager-ssh network-manager-openconnect + + # Remote desktop + sudo apt -y install krdc + + ## Network monitoring and debugging + # Wireshark + sudo DEBIAN_FRONTEND=noninteractive apt -y install wireshark + # debugging + sudo apt install nethogs nload net-tools + + ### ADDITIONAL DEVELOPMENT TOOLS ### + # Code optimization and profiling + sudo apt -y install valgrind kcachegrind hotspot heaptrack-gui + sudo apt -y install linux-tools-generic linux-cloud-tools-generic # Kernel tools + + sudo apt -y install flac + + sudo add-apt-repository -y ppa:freecad-maintainers/freecad-daily + sudo apt update + sudo apt -y install freecad-daily spacenavd + + # Tracing + sudo apt -y install lttng-tools lttng-modules-dkms liblttng-ust-dev + sudo apt -y install python3-babeltrace python3-lttng python3-lttngust + sudo usermod -aG tracing "$(whoami)" + + ### MANAGE PERSONAL INFORMATION + # KDE-PIM + sudo apt -y install kontact korganizer kmail kjots kaddressbook kdepim* + + ### OFFICE TOOLS ### + # Notes-taking + sudo add-apt-repository ppa:pbek/qownnotes + sudo apt update + sudo apt -y install qownnotes + + ### LANGUAGES ### + # Language packs + sudo apt -y install language-pack-de language-pack-de-base language-pack-kde-de aspell-de hunspell-de-de hyphen-de wogerman + sudo apt -y install language-pack-hr language-pack-hr-base language-pack-kde-hr aspell-hr hunspell-hr hyphen-hr + +fi + +sudo apt update +sudo apt -y dist-upgrade +sudo apt -y autoremove +# log is created somehow +trash "${RosTeamWS_FRAMEWORK_OS_CONFIGURE_PATH}/log/" diff --git a/scripts/os_configure/install_software_ros.bash b/scripts/os_configure/install_software_ros.bash index a8d81fab..adbb799e 100644 --- a/scripts/os_configure/install_software_ros.bash +++ b/scripts/os_configure/install_software_ros.bash @@ -1,4 +1,20 @@ -#!/usr/bin/bash +#!/usr/bin/env bash +# Copyright (c) 2022, Stogl Robotics Consulting UG (haftungsbeschränkt) +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +script_own_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" > /dev/null && pwd )" +SCRIPT_PATH=$script_own_dir +source "$SCRIPT_PATH"/../../setup.bash #### ROS Repository if [[ ! -f "/etc/apt/sources.list.d/ros-latest.list" ]]; then @@ -27,7 +43,7 @@ sudo apt -y install ros-${ROS_DISTRO}-desktop-full ros-${ROS_DISTRO}-desktop ros # ROS: Useful tools sudo apt -y install python3-catkin-* -sudo apt install python3-catkin-lint python3-pip +sudo apt -y install python3-catkin-lint python3-pip sudo pip3 install osrf-pycommon sudo apt -y install python3-wstool sudo apt -y install python3-vcstool @@ -48,12 +64,6 @@ sudo apt -y install ros-${ROS_DISTRO}-moveit sudo apt -y install ros-${ROS_DISTRO}-moveit-* sudo apt -y install libmuparser-dev ros-${ROS_DISTRO}-brics-actuator ros-${ROS_DISTRO}-openrave ros-${ROS_DISTRO}-move-base sudo apt -y install ros-${ROS_DISTRO}-teleop-twist-joy ros-${ROS_DISTRO}-twist-mux -# Mit dem vorsicht auch: ros-${ROS_DISTRO}-schunk-* - -# INSTALL Released repos from KITRobotics -# sudo apt -y install ros-${ROS_DISTRO}-iirob-filters ros-${ROS_DISTRO}-force-torque-sensor ros-${ROS_DISTRO}-ati-force-torque -# sudo apt -y install ros-${ROS_DISTRO}-ipr-extern - # ROS Control sudo apt -y install ros-${ROS_DISTRO}-control-* @@ -70,11 +80,3 @@ sudo apt -y install ros-${ROS_DISTRO}-rosparam-handler ros-${ROS_DISTRO}-pcl-ros # TF2 Packages sudo apt -y install ros-${ROS_DISTRO}-tf2 ros-${ROS_DISTRO}-tf2-sensor-msgs - -# IKFast and OpenRAVE -# sudo add-apt-repository ppa:openrave/release -# sudo apt update -# sudo apt install openrave0.8-dp-ikfast - -# Add libraries for ROS packages -#sudo apt -y install libfcl-dev libfcl-0.5-dev diff --git a/scripts/os_configure/install_software_ros2.bash b/scripts/os_configure/install_software_ros2.bash index 0f3bdc7b..42fe3f36 100644 --- a/scripts/os_configure/install_software_ros2.bash +++ b/scripts/os_configure/install_software_ros2.bash @@ -1,5 +1,22 @@ -#!/usr/bin/bash +#!/usr/bin/env bash +# Copyright (c) 2022, Stogl Robotics Consulting UG (haftungsbeschränkt) +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + # based on https://index.ros.org/doc/ros2/Installation/Foxy/Linux-Development-Setup/ +script_own_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" > /dev/null && pwd )" +SCRIPT_PATH=$script_own_dir +source "$SCRIPT_PATH"/../../setup.bash ROS_DISTRO=$1 if [ -z "$1" ] @@ -10,9 +27,9 @@ then read fi -if [[ ! -f "/etc/apt/sources.list.d/ros2-latest.list" ]]; then - sudo sh -c 'echo "deb [arch=$(dpkg --print-architecture)] http://packages.ros.org/ros2/ubuntu $(lsb_release -cs) main" > /etc/apt/sources.list.d/ros2-latest.list' - curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add - +if [[ ! -f "/etc/apt/sources.list.d/ros2.list" ]]; then + sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg + echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(source /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null fi sudo apt update @@ -32,8 +49,7 @@ sudo apt -y install ros-${ROS_DISTRO}-desktop sudo apt install -y python3-colcon-common-extensions #Install colcon for workspace creation - -sudo apt install ccache +sudo apt -y install ccache sudo apt install python3-colcon-mixin colcon mixin add default https://raw.githubusercontent.com/colcon/colcon-mixin-repository/master/index.yaml @@ -43,7 +59,8 @@ colcon mixin update default sudo apt -y install ros-${ROS_DISTRO}-plotjuggler-ros # ros2_control -sudo apt -y install ros-${ROS_DISTRO}-forward-command-controller ros-${ROS_DISTRO}-joint-state-controller ros-${ROS_DISTRO}-joint-trajectory-controller ros-${ROS_DISTRO}-xacro +sudo apt -y install ros-${ROS_DISTRO}-forward-command-controller ros-${ROS_DISTRO}-joint-state-broadcaster ros-${ROS_DISTRO}-joint-trajectory-controller ros-${ROS_DISTRO}-xacro +sudo apt -y install ros-${ROS_DISTRO}-ros2-control ros-${ROS_DISTRO}-ros2-controllers ros-${ROS_DISTRO}-gazebo-ros2-control # MoveIt sudo apt -y install ros-${ROS_DISTRO}-geometric-shapes ros-${ROS_DISTRO}-moveit-msgs ros-${ROS_DISTRO}-moveit-resources ros-${ROS_DISTRO}-srdfdom ros-${ROS_DISTRO}-warehouse-ros diff --git a/scripts/os_configure/vs-code_plugins.txt b/scripts/os_configure/vs-code_plugins.txt new file mode 100644 index 00000000..c71361bf --- /dev/null +++ b/scripts/os_configure/vs-code_plugins.txt @@ -0,0 +1,27 @@ +# This file contains all the plugins which are installed in visual studio code as +# default. Everything starting with "#" is treated as comment and ignored. +# +# !!! SEPARATE EVERY PLUGIN WITH A NEWLINE !!! +# +cschlosser.doxdocgen +eamodio.gitlens +foxundermoon.shell-format +jeff-hykin.better-cpp-syntax +ms-azuretools.vscode-docker +ms-iot.vscode-ros +ms-python.python +ms-python.vscode-pylance +ms-toolsai.jupyter +ms-toolsai.jupyter-keymap +ms-toolsai.jupyter-renderers +ms-vscode-remote.remote-containers +ms-vscode-remote.remote-ssh +ms-vscode-remote.remote-ssh-edit +ms-vscode-remote.remote-wsl +ms-vscode.cmake-tools +ms-vscode.cpptools +ms-vscode.cpptools-extension-pack +ms-vscode.cpptools-themes +streetsidesoftware.code-spell-checker +timonwong.shellcheck +twxs.cmake diff --git a/templates/os_configure/extend_to_bash_commands b/templates/os_configure/extend_to_bash_commands new file mode 100644 index 00000000..e0a1a38d --- /dev/null +++ b/templates/os_configure/extend_to_bash_commands @@ -0,0 +1,17 @@ + +# mkdir -p DIR/SUBDIR && cd DIR/SUBDIR +function mkdircd () { + mkdir -p "$@" && eval cd "\"\$$#\""; +} + +# cd multiple levels up. +# expects a number n element N/{0}, which determines how many levels cd should go up. +# e.g. cdm 3 <==> cd ../../../ +cdm () { + if [[ $1 ]] && [ $1 -eq $1 ] && [ $1 -gt 0 ]; + then + cd $(printf "%0.s../" $(seq 1 $1)); + else + echo "cdn expects an integer >= 1 as input argument" + fi +} diff --git a/templates/os_configure/extend_to_bashrc b/templates/os_configure/extend_to_bashrc new file mode 100644 index 00000000..94847cf2 --- /dev/null +++ b/templates/os_configure/extend_to_bashrc @@ -0,0 +1,5 @@ + +# add usful self_defined commands to this file +if [ -f ~/.bash_commands ]; then + . ~/.bash_commands +fi