Last active
March 4, 2020 15:02
-
-
Save VedantParanjape/27b36bc760d046af4300dad399710c88 to your computer and use it in GitHub Desktop.
Installation script for ROS WS 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/bin/sh | |
#### check if rosserial is installed ######################################## | |
dpkg -s "ros-kinetic-rosserial" &> /dev/null | |
if [ $? -eq 0 ] | |
then | |
echo -e "\e[42mrosserial is INSTALLED!\e[49m" | |
else | |
echo -e "\e[101mrosserial is NOT INSTALLED!\e[49m" | |
echo -e "\e[101mINSTALLING rosserial!\e[49m" | |
sudo apt install ros-kinetic-rosserial | |
fi | |
############################################################################# | |
#### check if directory ros20_ws exists, and take necessary actions ######### | |
cd $HOME | |
if [ -d "$HOME/ros20_ws" ] | |
then | |
echo -e "\e[101mdirectory $HOME/ros20_ws/ already EXISTS.\e[49m" | |
read -p "Press [Y]es to DELETE the folder, [N]o to EXIT the setup: " optionvar | |
if [ "$optionvar" == "Yes" ] || [ "$optionvar" == "yes" ] | |
then | |
echo -e "\e[101mREMOVING $HOME/ros20_ws/\e[49m" | |
rm -r -f $HOME/ros20_ws/ | |
else | |
exit 9999 | |
fi | |
fi | |
echo -e "\e[42mcreating directory $HOME/ros20_ws\e[49m" | |
mkdir -p $HOME/ros20_ws/src | |
############################################################################# | |
#### catkin make ############################################################ | |
cd $HOME/ros20_ws | |
catkin_make | |
############################################################################# | |
#### clone ros codes in $ROS_WORKSPACE/src and check if it passed ########### | |
cd $HOME/ros20_ws/src | |
echo -e "\e[42mcloning repository into sra20\e[49m" | |
git clone https://github.com/VedantParanjape/ROS-Workshop-ROS-Codes.git sra20 | |
if [ ! -d "$HOME/ros20_ws/src/sra20" ] | |
then | |
echo -e "\e[101mcloning sra20 failed.\e[49m" | |
sleep 3 | |
fi | |
############################################################################# | |
#### catkin make and add source command to bashrc ########################### | |
cd $HOME/ros20_ws | |
catkin_make | |
source $HOME/ros20_ws/devel/setup.bash | |
echo "source $HOME/ros20_ws/devel/setup.bash" >> $HOME/.bashrc | |
cd $HOME | |
############################################################################ | |
#### clone esp codes in $HOME and check if it passed ####################### | |
if [ -d "$HOME/ros20_esp_codes" ] | |
then | |
echo -e "\e[101mdirectory $HOME/ros20_esp_codes/ already EXISTS.\e[49m" | |
echo -e "\e[101mREMOVING directory $HOME/ros20_esp_codes.\e[49m" | |
rm -r -f $HOME/ros20_esp_codes/ | |
fi | |
echo -e "\e[42mcloning repository into ros20_esp_codes\e[49m" | |
git clone https://github.com/VedantParanjape/ROS-Workshop-ESP32-Codes.git ros20_esp_codes | |
if [ ! -d "$HOME/ros20_esp_codes" ] | |
then | |
echo -e "\e[101mcloning ros20_esp_codes failed.\e[49m" | |
sleep 3 | |
fi | |
############################################################################ | |
#### check if everything is installed correctly ############################ | |
if [ -d "$HOME/ros20_esp_codes" ] && [ -d "$HOME/ros20_ws/src/sra20" ] | |
then | |
clear | |
echo -e "\e[42mall files INSTALLED correctly\e[49m" | |
else | |
clear | |
echo -e "\e[101mall files NOT INSTALLED correctly, rerun the script\e[49m" | |
fi | |
############################################################################ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment