安装脚本文件

 

#echo "\033[33mif the dependence file is not exist, show the error and write the log to install-apollo.log. But still continue the install \033[0m" > ${LOGfile}
#echo "yellow color is successful flags" > $LOGfile
#echo "red color  is error flags" >> $LOGfile
#Do you want to continue? [Y/n]
#Press [ENTER] to continue or ctrl-c to cancel adding it
echo "                                                                  ";
echo "                                                                  ";
echo -e "\033[31;46mPlease make sure that you have installed CUDA and nvidia driver before running!\033[0m"
answer=y
read -p "Do you want to continue?[y/n]:" response
if [ $response = $answer ];then  
#mirror replace
sudo mv /etc/apt/sources.list /etc/apt/sources.list.backup
sudo cp sources.list /etc/apt/sources.list
# update
sudo apt-get -y update
if [ "$?" -eq "0" ];then
    echo -e "\033[33m sudo apt-get update ok~! \033[0m"
else
    echo -e "\033[31m Error: sudo apt-get update failed~! \033[0m"
fi

#cmake
sudo apt-get -y install build-essential cmake cmake-qt-gui libvtk6-dev
if [ "$?" -eq "0" ];then
    echo -e "\033[33m sudo apt-get install build-essential cmake cmake-qt-gui ok~! \033[0m"
else
    echo -e "\033[31m Error: sudo apt-get install build-essential cmake cmake-qt-gui failed~! \033[0m"
fi

echo -e "\033[33mstart to install the map needed\033[0m"

#地图:
sudo apt-get -y install gcc make mesa-common-dev freeglut3-dev libglu1-mesa-dev libeigen3-dev libgsl0-dev libproj-dev libann-dev  libboost-dev libboost-filesystem-dev libboost-system-dev libboost-thread-dev libboost-chrono-dev
if [ "$?" -eq "0" ];then
    echo -e "\033[33m  apt-get install gcc make mesa-common-dev  ok~! \033[0m"
else
    echo -e "\033[31m Error: sudo apt-get install gcc make mesa-common-dev failed~! \033[0m"
fi

#echo "\033[33mSuccessful to install the map needed\033[0m"

#caffe
echo -e "\033[33mstart to install the caffe needed\033[0m"
sudo apt-get -y install libatlas-base-dev libsnappy-dev libleveldb-dev liblmdb-dev libgflags-dev libhdf5-openmpi-dev
if [ "$?" -eq "0" ];then
    echo -e "\033[33m sudo apt-get install libatlas-base-dev  ok~! \033[0m"
else
    echo -e "\033[31m Error: sudo apt-get install libatlas-base-dev failed~! \033[0m"
fi

#echo "\033[33mSuccessful to install the caffe needed\033[0m"

#apollo
sudo apt-get -y install libglfw3-dev libglew-dev
if [ "$?" -eq "0" ];then
    echo -e "\033[33m sudo apt-get install libglfw3-dev libglew-dev ok~! \033[0m"
else
    echo -e "\033[31m Error: sudo apt-get install libglfw3-dev libglew-dev failed~! \033[0m"
fi

#install pcl first
echo -e "\033[33mstart to install the PCL\033[0m"

sudo add-apt-repository -y ppa:v-launchpad-jochen-sprickerhof-de/pcl
if [ "$?" -eq "0" ];then
    echo -e "\033[33m sudo add-apt-repository ppa:v-launchpad-jochen-sprickerhof-de/pcl  ok~! \033[0m"
else
    echo -e "\033[31m Error: sudo add-apt-repository ppa:v-launchpad-jochen-sprickerhof-de/pcl failed~! \033[0m"
fi

sudo apt-get -y update
if [ "$?" -eq "0" ];then
    echo -e "\033[33m sudo apt-get update  ok~! \033[0m"
else
    echo -e "\033[31m Error: sudo apt-get update failed~! \033[0m"
fi

sudo apt-get -y install libpcl-dev
if [ "$?" -eq "0" ];then
    echo -e "\033[33m sudo apt-get install libpcl-dev  ok~! \033[0m"
else
    echo -e "\033[31m Error: sudo apt-get install libpcl-dev failed~! \033[0m"
fi

#echo "\033[33mSuccessful to install the PCL\033[0m"
#install ros-kinetic

echo -e "\033[33mstart to install the ROS-kinetic\033[0m"

sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
if [ "$?" -eq "0" ];then
    echo -e "\033[33m sudo sh -c  ok~! \033[0m"
else
    echo -e "\033[31m Error: sudo sh -c failed~! \033[0m"
fi

sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
if [ "$?" -eq "0" ];then
    echo -e "\033[33m sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key 0xB01FA116  ok~! \033[0m"
else
    echo -e "\033[31m Error: sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key 0xB01FA116 failed~! \033[0m"
fi

sudo apt-get -y update
if [ "$?" -eq "0" ];then
    echo -e "\033[33m sudo apt-get update  ok~! \033[0m"
else
    echo -e "\033[31m Error: sudo apt-get update failed~! \033[0m"
fi

sudo apt-get -y install ros-kinetic-desktop-full
if [ "$?" -eq "0" ];then
    echo -e "\033[33m sudo apt-get install ros-kinetic-desktop-full  ok~! \033[0m"
else
    echo -e "\033[31m Error: sudo apt-get install ros-kinetic-desktop-full failed~! \033[0m"
fi

sudo apt -y install ros-kinetic-network-interface

echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc
if [ "$?" -eq "0" ];then
    echo -e "\033[33m  echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc  ok~! \033[0m"
else
    echo -e "\033[31m Error: echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc failed~! \033[0m"
fi

mkdir -p ~/catkin_ws/src

cat bash.rc | while read line
do
    echo $line >> ~/.bashrc
done
source ~/.bashrc


if [ "$?" -eq "0" ];then
    echo -e "\033[33m configure environment variable ok~! \033[0m"
else
    echo -e "\033[31m configure environment viriable failed~! \033[0m"
fi
cd ~/catkin_ws
catkin_make
if [ "$?" -eq "0" ];then
    echo -e "\033[33m catkin_make ok~! \033[0m"
else
    echo -e "\033[31m catkin_make failed~! \033[0m"
fi
cd -
source ~/.bashrc
if [ "$?" -eq "0" ];then
    echo -e "\033[33m source ~/.bashrc  ok~! \033[0m"
else
    echo -e "\033[31m Error: source ~/.bashrc failed~! \033[0m"
fi

#echo "\033[33mSuccessful to install the ROS-kinetic\033[0m"

#next install dependence library. first check the file is exist or not.
#if the dependence file is not exist, show the error and write the log to install-apollo.log. But still continue the install.
echo -e "\033[33mstart to install the LCM-1.3.0\033[0m"
sudo apt-get -y install build-essential autoconf automake autopoint libglib2.0-dev libtool openjdk-8-jdk python-dev
if [ "$?" -eq "0" ];then
    echo -e "\033[33m sudo apt-get install build-essential autoconf automake autopoint libglib2.0-dev libtool openjdk-8-jdk python-dev  ok~! \033[0m"
else
    echo -e "\033[31m Error: sudo apt-get install build-essential autoconf automake autopoint libglib2.0-dev libtool openjdk-8-jdk python-dev failed~! \033[0m"
fi

tar -zxvf lcm-1.3.0.tar.gz    
if [ "$?" -eq "0" ];then
    echo -e "\033[33m unpack file lcm-1.3.0.tar.gz ok~! \033[0m"
else
    echo -e "\033[31m Error:unPack file failed~! \033[0m"
fi

cd lcm-1.3.0
if [ "$?" -eq "0" ];then
    echo -e "\033[33m cd lcm-1.3.0  ok~! \033[0m"
else
    echo -e "\033[31m Error: cd lcm-1.3.0 failed~! \033[0m"
fi
chmod 777 bootstrap.sh
if [ "$?" -eq "0" ];then
    echo -e "\033[33m chmod 777 bootstrap.sh  ok~! \033[0m"
else
    echo -e "\033[31m Error: chmod 777 bootstrap.sh failed~! \033[0m"
fi

./bootstrap.sh
if [ "$?" -eq "0" ];then
    echo -e "\033[33m ./bootstrap.sh  ok~! \033[0m"
else
    echo -e "\033[31m Error: ./bootstrap.sh failed~! \033[0m"
fi

./configure
if [ "$?" -eq "0" ];then
    echo -e "\033[33m ./configure  ok~! \033[0m"
else
    echo -e "\033[31m Error: ./configure failed~! \033[0m"
fi

sudo make
if [ "$?" -eq "0" ];then
    echo -e "\033[33m sudo make ok~! \033[0m"
else
    echo -e "\033[31m Error: sudo make failed~! \033[0m"
fi

sudo make install
if [ "$?" -eq "0" ];then
    echo -e "\033[33m sudo make install  ok~! \033[0m"
else
    echo -e "\033[31m Error: sudo make install failed~! \033[0m"
fi

cd ..
if [ "$?" -eq "0" ];then
    echo -e "\033[33m cd ..  ok~! \033[0m"
else
    echo -e "\033[31m Error: cd .. failed~! \033[0m"
fi

#install glog-master
echo -e "\033[33mstart to install the glog-master\033[0m"
unzip glog-master.zip
if [ "$?" -eq "0" ];then
    echo -e "\033[33m unpack file glog-master.zip ok~! \033[0m"
else
    echo -e "\033[31m Error:unPack file glog-master.zip failed~! \033[0m"
fi

cd glog-master
if [ "$?" -eq "0" ];then
    echo -e "\033[33m cd glog-master  ok~! \033[0m"
else
    echo -e "\033[31m Error: cd glog-master failed~! \033[0m"
fi

sudo cmake ./
if [ "$?" -eq "0" ];then
    echo -e "\033[33m sudo cmake ./  ok~! \033[0m"
else
    echo -e "\033[31m Error: sudo cmake ./ failed~! \033[0m"
fi

sudo make
if [ "$?" -eq "0" ];then
    echo -e "\033[33m sudo make  ok~! \033[0m"
else
    echo -e "\033[31m Error: sudo make failed~! \033[0m"
fi

sudo make install
if [ "$?" -eq "0" ];then
    echo -e "\033[33m sudo make install  ok~! \033[0m"
else
    echo -e "\033[31m Error: sudo make install failed~! \033[0m"
fi

cd ..
if [ "$?" -eq "0" ];then
    echo -e "\033[33m cd ..  ok~! \033[0m"
else
    echo -e "\033[31m Error: cd .. failed~! \033[0m"
fi

echo -e "\033[33mstart to install the curlpp-master\033[0m"
unzip curlpp-master.zip
if [ "$?" -eq "0" ];then
    echo -e "\033[33m unpack file curlpp-master.zip ok~! \033[0m"
else
    echo -e "\033[31m Error:unPack file curlpp-master.zip failed~! \033[0m"
fi

cd curlpp-master
if [ "$?" -eq "0" ];then
    echo -e "\033[33m  cd curlpp-master ok~! \033[0m"
else
    echo -e "\033[31m Error: cd curlpp-master failed~! \033[0m"
fi

mkdir build
if [ "$?" -eq "0" ];then
    echo -e "\033[33m mkdir build  ok~! \033[0m"
else
    echo -e "\033[31m Error: mkdir build failed~! \033[0m"
fi

cd build
if [ "$?" -eq "0" ];then
    echo -e "\033[33m cd build  ok~! \033[0m"
else
    echo -e "\033[31m Error: cd build failed~! \033[0m"
fi

sudo cmake ./..
if [ "$?" -eq "0" ];then
    echo -e "\033[33m sudo cmake ./..  ok~! \033[0m"
else
    echo -e "\033[31m Error: sudo cmake ./.. failed~! \033[0m"
fi

sudo make
if [ "$?" -eq "0" ];then
    echo -e "\033[33m sudo make  ok~! \033[0m"
else
    echo -e "\033[31m Error: sudo make failed~! \033[0m"
fi

sudo make install
if [ "$?" -eq "0" ];then
    echo -e "\033[33m sudo make install  ok~! \033[0m"
else
    echo -e "\033[31m Error: sudo make install failed~! \033[0m"
fi

cd .. #out build
if [ "$?" -eq "0" ];then
    echo -e "\033[33m cd ..  ok~! \033[0m"
else
    echo -e "\033[31m Error: cd .. failed~! \033[0m"
fi

cd .. #out curlpp-master
if [ "$?" -eq "0" ];then
    echo -e "\033[33m cd ..  ok~! \033[0m"
else
    echo -e "\033[31m Error: cd .. failed~! \033[0m"
fi


echo -e "\033[33mstart to install the googletest-master\033[0m"
unzip googletest-master.zip
if [ "$?" -eq "0" ];then
    echo -e "\033[33m unpack file googletest-master.zip ok~! \033[0m"
else
    echo -e "\033[31m Error:unPack file googletest-master.zip failed~! \033[0m"
fi

cd googletest-master
if [ "$?" -eq "0" ];then
    echo -e "\033[33m cd googletest-master  ok~! \033[0m"
else
    echo -e "\033[31m Error: cd googletest-master failed~! \033[0m"
fi

mkdir build
if [ "$?" -eq "0" ];then
    echo -e "\033[33m mkdir build  ok~! \033[0m"
else
    echo -e "\033[31m Error: mkdir build failed~! \033[0m"
fi

cd build
if [ "$?" -eq "0" ];then
    echo -e "\033[33m mkdir build  ok~! \033[0m"
else
    echo -e "\033[31m Error: mkdir build failed~! \033[0m"
fi

sudo cmake ..
if [ "$?" -eq "0" ];then
    echo -e "\033[33m  sudo cmake .. ok~! \033[0m"
else
    echo -e "\033[31m Error: sudo cmake .. failed~! \033[0m"
fi

sudo make
if [ "$?" -eq "0" ];then
    echo -e "\033[33m sudo make  ok~! \033[0m"
else
    echo -e "\033[31m Error: sudo make failed~! \033[0m"
fi

sudo make install
if [ "$?" -eq "0" ];then
    echo -e "\033[33m sudo make install  ok~! \033[0m"
else
    echo -e "\033[31m Error: sudo make install failed~! \033[0m"
fi

cd .. #out build
if [ "$?" -eq "0" ];then
    echo -e "\033[33m cd ..  ok~! \033[0m"
else
    echo -e "\033[31m Error: cd .. failed~! \033[0m"
fi

cd .. #out googletest-master
if [ "$?" -eq "0" ];then
    echo -e "\033[33m   ok~! \033[0m"
else
    echo -e "\033[31m Error:  failed~! \033[0m"
fi


echo -e "\033[33mstart to install the protobuf-cpp-3.4.1\033[0m"
#EDD 将/home/jjuv/mapgroup/for-apollo/protobuf-3.4.1/src/google/protobuf/stubs/strutil.h map_util.h  stringprintf.h 拷贝到local/include/google/proto。。/stubs
unzip protobuf-cpp-3.4.1.zip
if [ "$?" -eq "0" ];then
    echo -e "\033[33m unpack file protobuf-cpp-3.4.1.zip ok~! \033[0m"
else
    echo -e "\033[31m Error:unPack file protobuf-cpp-3.4.1.zip failed~! \033[0m"
fi

cd protobuf-3.4.1
if [ "$?" -eq "0" ];then
    echo -e "\033[33m cd protobuf-3.4.1  ok~! \033[0m"
else
    echo -e "\033[31m Error: cd protobuf-3.4.1 failed~! \033[0m"
fi

./autogen.sh
if [ "$?" -eq "0" ];then
    echo -e "\033[33m ./autogen.sh  ok~! \033[0m"
else
    echo -e "\033[31m Error: ./autogen.sh failed~! \033[0m"
fi

sudo ./configure
if [ "$?" -eq "0" ];then
    echo -e "\033[33m sudo ./configure  ok~! \033[0m"
else
    echo -e "\033[31m Error: sudo ./configure failed~! \033[0m"
fi

sudo make
if [ "$?" -eq "0" ];then
    echo -e "\033[33m sudo make  ok~! \033[0m"
else
    echo -e "\033[31m Error: sudo make failed~! \033[0m"
fi

make check
if [ "$?" -eq "0" ];then
    echo -e "\033[33m   ok~! \033[0m"
else
    echo -e "\033[31m Error:  failed~! \033[0m"
fi

sudo make install
if [ "$?" -eq "0" ];then
    echo -e "\033[33m sudo make install   ok~! \033[0m"
else
    echo -e "\033[31m Error: sudo make install  failed~! \033[0m"
fi

sudo ldconfig # refresh shared library cache
if [ "$?" -eq "0" ];then
    echo -e "\033[33m sudo ldconfig   ok~! \033[0m"
else
    echo -e "\033[31m Error: sudo ldconfig  failed~! \033[0m"
fi

sudo cp src/google/protobuf/stubs/strutil.h  /usr/local/include/google/protobuf/stubs
if [ "$?" -eq "0" ];then
    echo -e "\033[33m sudo cp src/google/protobuf/stubs/strutil.h  /usr/local/include/google/protobuf/stubs  ok~! \033[0m"
else
    echo -e "\033[31m Error: sudo cp src/google/protobuf/stubs/strutil.h  /usr/local/include/google/protobuf/stubs  failed~! \033[0m"
fi

sudo cp src/google/protobuf/stubs/map_util.h  /usr/local/include/google/protobuf/stubs
if [ "$?" -eq "0" ];then
    echo -e "\033[33m sudo cp src/google/protobuf/stubs/map_util.h  /usr/local/include/google/protobuf/stubs  ok~! \033[0m"
else
    echo -e "\033[31m Error: sudo cp src/google/protobuf/stubs/map_util.h  /usr/local/include/google/protobuf/stubs failed~! \033[0m"
fi

sudo cp src/google/protobuf/stubs/stringprintf.h  /usr/local/include/google/protobuf/stubs
if [ "$?" -eq "0" ];then
    echo -e "\033[33m sudo cp src/google/protobuf/stubs/stringprintf.h  /usr/local/include/google/protobuf/stubs  ok~! \033[0m"
else
    echo -e "\033[31m Error: sudo cp src/google/protobuf/stubs/stringprintf.h  /usr/local/include/google/protobuf/stubs failed~! \033[0m"
fi

cd .. #out protobuf-cpp-3.4.1
if [ "$?" -eq "0" ];then
    echo -e "\033[33m cd ..  ok~! \033[0m"
else
    echo -e "\033[31m Error: cd .. failed~! \033[0m"
fi

echo -e "\033[33mstart to install the fileqpOASES-3.2.1\033[0m"
unzip qpOASES-3.2.1.zip
if [ "$?" -eq "0" ];then
    echo -e "\033[33m unpack file qpOASES-3.2.1.zip ok~! \033[0m"
else
    echo -e "\033[31m Error:unPack file qpOASES-3.2.1.zip failed~! \033[0m"
fi

cd qpOASES-3.2.1
if [ "$?" -eq "0" ];then
    echo -e "\033[33m cd qpOASES-3.2.1  ok~! \033[0m"
else
    echo -e "\033[31m Error: cd qpOASES-3.2.1  failed~! \033[0m"
fi
sudo cmake ./
if [ "$?" -eq "0" ];then
    echo -e "\033[33m sudo cmake ./  ok~! \033[0m"
else
    echo -e "\033[31m Error: sudo cmake ./ failed~! \033[0m"
fi

sudo make
if [ "$?" -eq "0" ];then
    echo -e "\033[33m sudo make  ok~! \033[0m"
else
    echo -e "\033[31m Error: sudo make failed~! \033[0m"
fi

sudo make install
if [ "$?" -eq "0" ];then
    echo -e "\033[33m sudo make install  ok~! \033[0m"
else
    echo -e "\033[31m Error: sudo make install failed~! \033[0m"
fi

cd .. #out protobuf-cpp-3.4.1
if [ "$?" -eq "0" ];then
    echo -e "\033[33m cd ..  ok~! \033[0m"
else
    echo -e "\033[31m Error: cd .. failed~! \033[0m"
fi

echo -e "\033[33mstart to install the opencv-3.2.0\033[0m"
tar -zxvf opencv-3.2.0.tar.gz    
if [ "$?" -eq "0" ];then
    echo -e "\033[33m unpack file opencv-3.2.0.tar.gz ok~! \033[0m"
else
    echo -e "\033[31m Error:unPack opencv-3.2.0.tar.gz file failed~! \033[0m"
fi

cd opencv-3.2.0
if [ "$?" -eq "0" ];then
    echo -e "\033[33m cd opencv-3.2.0  ok~! \033[0m"
else
    echo -e "\033[31m Error: cd opencv-3.2.0 failed~! \033[0m"
fi
sudo cmake ./ -DWITH_CUDA=OFF
if [ "$?" -eq "0" ];then
    echo -e "\033[33m sudo cmake ./  ok~! \033[0m"
else
    echo -e "\033[31m Error: sudo cmake ./  failed~! \033[0m"
fi

sudo make -j10
if [ "$?" -eq "0" ];then
    echo -e "\033[33m sudo make  ok~! \033[0m"
else
    echo -e "\033[31m Error: sudo make failed~! \033[0m"
fi
sudo make install
if [ "$?" -eq "0" ];then
    echo -e "\033[33m sudo make install  ok~! \033[0m"
else
    echo -e "\033[31m Error: sudo make install failed~! \033[0m"
fi

cd .. #out opencv-3.2.0
if [ "$?" -eq "0" ];then
    echo -e "\033[33m cd ..  ok~! \033[0m"
else
    echo -e "\033[31m Error: cd .. failed~! \033[0m"
fi

echo -e "\033[33mstart to install the Ipopt-3.12.8.tgz\033[0m"
tar -zxvf Ipopt-3.12.8.tgz    
if [ "$?" -eq "0" ];then
    echo -e "\033[33m unpack file Ipopt-3.12.8.tgz ok~! \033[0m"
else
    echo -e "\033[31m Error:unPack file failed~! \033[0m"
fi

cd Ipopt-3.12.8
if [ "$?" -eq "0" ];then
    echo -e "\033[33m cd Ipopt-3.12.8  ok~! \033[0m"
else
    echo -e "\033[31m Error: cd Ipopt-3.12.8 failed~! \033[0m"
fi

./configure
if [ "$?" -eq "0" ];then
    echo -e "\033[33m ./configure  ok~! \033[0m"
else
    echo -e "\033[31m Error: ./configure failed~! \033[0m"
fi
sudo make
if [ "$?" -eq "0" ];then
    echo -e "\033[33m sudo make  ok~! \033[0m"
else
    echo -e "\033[31m Error:  failed~! \033[0m"
fi

sudo make install
if [ "$?" -eq "0" ];then
    echo -e "\033[33m sudo make install  ok~! \033[0m"
else
    echo -e "\033[31m Error: sudo make install failed~! \033[0m"
fi

sudo cp -r lib/. /usr/local/lib
if [ "$?" -eq "0" ];then
    echo -e "\033[33m sudo cp -r lib/. /usr/local/lib  ok~! \033[0m"
else
    echo -e "\033[31m Error: sudo cp -r lib/. /usr/local/lib failed~! \033[0m"
fi

sudo cp -r include/. /usr/local/include
if [ "$?" -eq "0" ];then
    echo -e "\033[33m sudo cp -r include/. /usr/local/include  ok~! \033[0m"
else
    echo -e "\033[31m Error: sudo cp -r include/. /usr/local/include failed~! \033[0m"
fi

cd .. #out Ipopt-3.12.8
if [ "$?" -eq "0" ];then
    echo -e "\033[33m cd ..  ok~! \033[0m"
else
    echo -e "\033[31m Error: cd .. failed~! \033[0m"
fi

export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH  
if [ "$?" -eq "0" ];then
    echo -e "\033[33m export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH  ok~! \033[0m"
else
    echo -e "\033[31m Error: export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH  failed~! \033[0m"
fi

sudo ldconfig  
if [ "$?" -eq "0" ];then
    echo -e "\033[33m sudo ldconfig  ok~! \033[0m"
else
    echo -e "\033[31m Error: sudo ldconfig failed~! \033[0m"
fi

#configure cuda
echo "export PATH=\"/usr/local/cuda/bin:\$PATH\"" >> /etc/profile
echo "export LD_LIBRARY_PATH=\"/usr/local/cuda/lib64:\$LD_LIBRARY_PATH\"" >> /etc/profile
sudo ldconfig

if [ "$?" -eq "0" ];then
    echo -e "\033[33m cuda configuration ok~! \033[0m"
else
    echo -e "\033[31m Error: cuda configuration failed~! \033[0m"
fi
#install ccache.
sudo apt-get -y install  ccache
if [ "$?" -eq "0" ];then
    echo -e "\033[33m sudo apt-get install  ccache  ok~! \033[0m"
else
    echo -e "\033[31m Error: sudo apt-get install  ccache failed~! \033[0m"
fi

#install caffe
echo -e "\033[33mstart to install the caffe and copy to home! \033[0m"
tar -zxvf caffe.tar.gz
cd caffe
if [ "$?" -eq "0" ];then
    echo -e "\033[33m cd caffe   ok~! \033[0m"
else
    echo -e "\033[31m Error: cd caffe  failed~! \033[0m"
fi

mkdir build
if [ "$?" -eq "0" ];then
    echo -e "\033[33m mkdir build  ok~! \033[0m"
else
    echo -e "\033[31m Error: mkdir build failed~! \033[0m"
fi

cd build
if [ "$?" -eq "0" ];then
    echo -e "\033[33m cd build  ok~! \033[0m"
else
    echo -e "\033[31m Error: cd build failed~! \033[0m"
fi

sudo cmake ../.
if [ "$?" -eq "0" ];then
    echo -e "\033[33m sudo cmake ../.  ok~! \033[0m"
else
    echo -e "\033[31m Error: sudo cmake ../. failed~! \033[0m"
fi

sudo make all
if [ "$?" -eq "0" ];then
    echo -e "\033[33m sudo make all  ok~! \033[0m"
else
    echo -e "\033[31m Error: sudo make all failed~! \033[0m"
fi

cd ..
if [ "$?" -eq "0" ];then
    echo -e "\033[33m cd ..  ok~! \033[0m"
else
    echo -e "\033[31m Error: cd .. failed~! \033[0m"
fi

cd ..
if [ "$?" -eq "0" ];then
    echo -e "\033[33m cd ..  ok~! \033[0m"
else
    echo -e "\033[31m Error: cd .. failed~! \033[0m"
fi


cp -r caffe ~/


if [ "$?" -eq "0" ];then
    echo -e "\033[33m sudo cp -r caffe ~/.  ok~! \033[0m"
else
    echo -e "\033[31m Error: sudo cp -r caffe ~/. failed~! \033[0m"
fi

sudo chown $USER ~/catkin_ws -R

sudo chown $USER ~/caffe -R

#planning upgrade

#planning upgrade

sudo apt -y install autoconf automake libtool libadolc-dev

if [ "$?" -eq "0" ];then
    echo -e "\033[33m autoconf automake libtool install ok~! \033[0m"
else
    echo -e "\033[31m Error: autoconf automake libtool install failed~! \033[0m"
fi

unzip ColPack.zip

cd ColPack

mkdir build/cmake/mywork && cd build/cmake/mywork

cmake .. -DCMAKE_INSTALL_PREFIX:PATH=/usr/local

make -j8

if [ "$?" -eq "0" ];then
    echo -e "\033[33m make Colpack ok~! \033[0m"
else
    echo -e "\033[31m Error: make ColPack failed~! \033[0m"
fi

sudo make install

if [ "$?" -eq "0" ];then
    echo -e "\033[33m Installing Colpack ok~! \033[0m"
else
    echo -e "\033[31m Error: Installing ColPack failed~! \033[0m"
fi

cd ../../../..


unzip osqp.zip && cd osqp-contrib-master

sudo cp -r ./osqp /usr/include/

cd osqp && sudo cp ./libosqp.a /usr/lib

sudo cp ./libosqp.so /usr/lib

if [ "$?" -eq "0" ];then
    echo -e "\033[33m Installing osqp ok~! \033[0m"
else
    echo -e "\033[31m Error: Installing osqp failed~! \033[0m"
fi

cd ../..

unzip rss.zip && cd rss/include

sudo cp -r ./rss /usr/local/include && cd .. && sudo cp -r ./lib/* /usr/local/lib

if [ "$?" -eq "0" ];then
    echo -e "\033[33m Installing rss ok~! \033[0m"
else
    echo -e "\033[31m Error: Installing rss failed~! \033[0m"
fi

cd ..

tar -zxvf abseil-cpp-20190808.tar.gz
if [ "$?" -eq "0" ];then
    echo -e "\033[33m unpack file curlpp-master.zip ok~! \033[0m"
else
    echo -e "\033[31m Error:unPack file curlpp-master.zip failed~! \033[0m"
fi

cd abseil-cpp-20190808
if [ "$?" -eq "0" ];then
    echo -e "\033[33m  cd curlpp-master ok~! \033[0m"
else
    echo -e "\033[31m Error: cd curlpp-master failed~! \033[0m"
fi

mkdir build
if [ "$?" -eq "0" ];then
    echo -e "\033[33m mkdir build  ok~! \033[0m"
else
    echo -e "\033[31m Error: mkdir build failed~! \033[0m"
fi

cd build
if [ "$?" -eq "0" ];then
    echo -e "\033[33m cd build  ok~! \033[0m"
else
    echo -e "\033[31m Error: cd build failed~! \033[0m"
fi

sudo cmake ./..
if [ "$?" -eq "0" ];then
    echo -e "\033[33m sudo cmake ./..  ok~! \033[0m"
else
    echo -e "\033[31m Error: sudo cmake ./.. failed~! \033[0m"
fi

sudo make
if [ "$?" -eq "0" ];then
    echo -e "\033[33m sudo make  ok~! \033[0m"
else
    echo -e "\033[31m Error: sudo make failed~! \033[0m"
fi

sudo make install
if [ "$?" -eq "0" ];then
    echo -e "\033[33m sudo make install  ok~! \033[0m"
else
    echo -e "\033[31m Error: sudo make install failed~! \033[0m"
fi

cd .. #out build
if [ "$?" -eq "0" ];then
    echo -e "\033[33m cd ..  ok~! \033[0m"
else
    echo -e "\033[31m Error: cd .. failed~! \033[0m"
fi

cd .. #out abseil-cpp-20190808
if [ "$?" -eq "0" ];then
    echo -e "\033[33m cd ..  ok~! \033[0m"
else
    echo -e "\033[31m Error: cd .. failed~! \033[0m"
fi


tar -zxvf gperftools.tar.gz
if [ "$?" -eq "0" ];then
    echo -e "\033[33m unpack file gperftools.tar.gz ok~! \033[0m"
else
    echo -e "\033[31m Error:unPack file gperftools.tar.gz failed~! \033[0m"
fi

cd gperftools
if [ "$?" -eq "0" ];then
    echo -e "\033[33m  cd gperftools ok~! \033[0m"
else
    echo -e "\033[31m Error: cd gperftools failed~! \033[0m"
fi

./autogen.sh
if [ "$?" -eq "0" ];then
    echo -e "\033[33m ./autogen.sh  ok~! \033[0m"
else
    echo -e "\033[31m Error: ./autogen.sh failed~! \033[0m"
fi

./configure
if [ "$?" -eq "0" ];then
    echo -e "\033[33m configure  ok~! \033[0m"
else
    echo -e "\033[31m Error: configure failed~! \033[0m"
fi

sudo make
if [ "$?" -eq "0" ];then
    echo -e "\033[33m sudo make  ok~! \033[0m"
else
    echo -e "\033[31m Error: sudo make failed~! \033[0m"
fi

sudo make install
if [ "$?" -eq "0" ];then
    echo -e "\033[33m sudo make install  ok~! \033[0m"
else
    echo -e "\033[31m Error: sudo make install failed~! \033[0m"
fi

cd .. #gperftools
if [ "$?" -eq "0" ];then
    echo -e "\033[33m cd ..  ok~! \033[0m"
else
    echo -e "\033[31m Error: cd .. failed~! \033[0m"
fi

tar -zxvf libtorchcpu.tar.gz
if [ "$?" -eq "0" ];then
    echo -e "\033[33m unpack file libtorchcpu ok~! \033[0m"
else
    echo -e "\033[31m Error:unPack file libtorchcpu.tar.gz failed~! \033[0m"
fi

cd libtorchcpu
if [ "$?" -eq "0" ];then
    echo -e "\033[33m  cd libtorchcpu ok~! \033[0m"
else
    echo -e "\033[31m Error: cd libtorchcpu failed~! \033[0m"
fi

sudo cp -r ./ATen /usr/local/include/
sudo cp -r ./c10 /usr/local/include/
sudo cp -r ./pybind11 /usr/local/include/
sudo cp -r ./torch /usr/local/include/
sudo cp ./libc10.so /usr/local/lib/
sudo cp ./libtorch.so /usr/local/lib/
sudo cp ./libgomp-753e6e92.so.1.so /usr/local/lib/

cd .. #libtorchcpu
if [ "$?" -eq "0" ];then
    echo -e "\033[33m cd ..  ok~! \033[0m"
else
    echo -e "\033[31m Error: cd .. failed~! \033[0m"
fi

#install camera
sudo apt-get -y install libraw1394-11 libgtkmm-2.4-1v5 libglademm-2.4-1v5 libgtkglextmm-x11-1.2-dev libgtkglextmm-x11-1.2 libusb-1.0-0 libglademm-2.4-dev ffmpeg
if [ "$?" -eq "0" ];then
    echo -e "\033[33m library installed  ok~! \033[0m"
else
    echo -e "\033[31m Error: library installation failed~! \033[0m"
fi
tar -zxvf flycapture2-2.12.3.2-amd64.tar.gz
cd flycapture2-2.12.3.2-amd64
sudo sh install_flycapture.sh
sudo mv /etc/apt/sources.list.backup /etc/apt/sources.list
fi

 

展开阅读全文
©️2019 CSDN 皮肤主题: 技术黑板 设计师: CSDN官方博客
应支付0元
点击重新获取
扫码支付

支付成功即可阅读