mirror of
https://github.com/CopterExpress/clover.git
synced 2026-05-26 21:19:35 +00:00
image_builder: add echo_stamp to other files
This commit is contained in:
@@ -2,10 +2,32 @@
|
||||
|
||||
set -e
|
||||
|
||||
echo -e "\033[0;31m\033[1m$(date) | #1 Change boot partition\033[0m\033[0m"
|
||||
echo_stamp() {
|
||||
|
||||
# STATIC FUNCTION
|
||||
# TEMPLATE: echo_stamp <TEXT> <TYPE>
|
||||
# TYPE: SUCCESS, ERROR, INFO
|
||||
|
||||
# More info there https://www.shellhacks.com/ru/bash-colors/
|
||||
|
||||
TEXT="$(date) | $1"
|
||||
TEXT="\e[1m$TEXT\e[0m" # BOLD
|
||||
|
||||
case "$2" in
|
||||
SUCCESS)
|
||||
TEXT="\e[32m${TEXT}\e[0m";; # GREEN
|
||||
ERROR)
|
||||
TEXT="\e[31m${TEXT}\e[0m";; # RED
|
||||
*)
|
||||
TEXT="\e[34m${TEXT}\e[0m";; # BLUE
|
||||
esac
|
||||
echo -e ${TEXT}
|
||||
}
|
||||
|
||||
echo_stamp "#1 Change boot partition"
|
||||
|
||||
sed -i 's/root=[^ ]*/root=\/dev\/mmcblk0p2/' /boot/cmdline.txt
|
||||
sed -i 's/.* \/boot vfat defaults 0 2$/\/dev\/mmcblk0p1 \/boot vfat defaults 0 2/' /etc/fstab
|
||||
sed -i 's/.* \/ ext4 defaults,noatime 0 1$/\/dev\/mmcblk0p2 \/ ext4 defaults,noatime 0 1/' /etc/fstab
|
||||
|
||||
echo -e "\033[0;31m\033[1m$(date) | End of change boot partition\033[0m\033[0m"
|
||||
echo_stamp "End of change boot partition"
|
||||
|
||||
@@ -1,39 +1,61 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Exit immidiately on non-zero result
|
||||
set -e
|
||||
|
||||
#
|
||||
# Script for image configure
|
||||
# @urpylka Artem Smirnov
|
||||
#
|
||||
|
||||
# Exit immidiately on non-zero result
|
||||
set -e
|
||||
|
||||
echo_stamp() {
|
||||
|
||||
# STATIC FUNCTION
|
||||
# TEMPLATE: echo_stamp <TEXT> <TYPE>
|
||||
# TYPE: SUCCESS, ERROR, INFO
|
||||
|
||||
# More info there https://www.shellhacks.com/ru/bash-colors/
|
||||
|
||||
TEXT="$(date) | $1"
|
||||
TEXT="\e[1m$TEXT\e[0m" # BOLD
|
||||
|
||||
case "$2" in
|
||||
SUCCESS)
|
||||
TEXT="\e[32m${TEXT}\e[0m";; # GREEN
|
||||
ERROR)
|
||||
TEXT="\e[31m${TEXT}\e[0m";; # RED
|
||||
*)
|
||||
TEXT="\e[34m${TEXT}\e[0m";; # BLUE
|
||||
esac
|
||||
echo -e ${TEXT}
|
||||
}
|
||||
|
||||
##################################################
|
||||
# Configure hardware interfaces
|
||||
##################################################
|
||||
|
||||
# 1. Enable sshd
|
||||
echo -e "\033[0;31m\033[1m$(date) | #1 Turn on sshd\033[0m\033[0m"
|
||||
echo_stamp "#1 Turn on sshd"
|
||||
touch /boot/ssh
|
||||
# /usr/bin/raspi-config nonint do_ssh 0
|
||||
|
||||
# 2. Enable GPIO
|
||||
echo -e "\033[0;31m\033[1m$(date) | #2 GPIO enabled by default\033[0m\033[0m"
|
||||
echo_stamp "#2 GPIO enabled by default"
|
||||
|
||||
# 3. Enable I2C
|
||||
echo -e "\033[0;31m\033[1m$(date) | #3 Turn on I2C\033[0m\033[0m"
|
||||
echo_stamp "#3 Turn on I2C"
|
||||
/usr/bin/raspi-config nonint do_i2c 0
|
||||
|
||||
# 4. Enable SPI
|
||||
echo -e "\033[0;31m\033[1m$(date) | #4 Turn on SPI\033[0m\033[0m"
|
||||
echo_stamp "#4 Turn on SPI"
|
||||
/usr/bin/raspi-config nonint do_spi 0
|
||||
|
||||
# 5. Enable raspicam
|
||||
echo -e "\033[0;31m\033[1m$(date) | #5 Turn on raspicam\033[0m\033[0m"
|
||||
echo_stamp "#5 Turn on raspicam"
|
||||
/usr/bin/raspi-config nonint do_camera 0
|
||||
|
||||
# 6. Enable hardware UART
|
||||
echo -e "\033[0;31m\033[1m$(date) | #6 Turn on UART\033[0m\033[0m"
|
||||
echo_stamp "#6 Turn on UART"
|
||||
# Temporary solution
|
||||
# https://github.com/RPi-Distro/raspi-config/pull/75
|
||||
/usr/bin/raspi-config nonint do_serial 1
|
||||
@@ -46,9 +68,9 @@ echo -e "\033[0;31m\033[1m$(date) | #6 Turn on UART\033[0m\033[0m"
|
||||
|
||||
# 7. Enable V4L driver http://robocraft.ru/blog/electronics/3158.html
|
||||
#echo "bcm2835-v4l2" >> /etc/modules
|
||||
echo -e "\033[0;31m\033[1m$(date) | #7 Turn on v4l2 driver\033[0m\033[0m"
|
||||
echo_stamp "#7 Turn on v4l2 driver"
|
||||
if ! grep -q "^bcm2835-v4l2" /etc/modules;
|
||||
then printf "bcm2835-v4l2\n" >> /etc/modules
|
||||
fi
|
||||
|
||||
echo -e "\033[0;31m\033[1m$(date) | End of configure hardware interfaces\033[0m\033[0m"
|
||||
echo_stamp "End of configure hardware interfaces"
|
||||
|
||||
@@ -1,11 +1,33 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
##################################################################################################################################
|
||||
# Image initialisation
|
||||
##################################################################################################################################
|
||||
|
||||
set -e
|
||||
|
||||
echo_stamp() {
|
||||
|
||||
# STATIC FUNCTION
|
||||
# TEMPLATE: echo_stamp <TEXT> <TYPE>
|
||||
# TYPE: SUCCESS, ERROR, INFO
|
||||
|
||||
# More info there https://www.shellhacks.com/ru/bash-colors/
|
||||
|
||||
TEXT="$(date) | $1"
|
||||
TEXT="\e[1m$TEXT\e[0m" # BOLD
|
||||
|
||||
case "$2" in
|
||||
SUCCESS)
|
||||
TEXT="\e[32m${TEXT}\e[0m";; # GREEN
|
||||
ERROR)
|
||||
TEXT="\e[31m${TEXT}\e[0m";; # RED
|
||||
*)
|
||||
TEXT="\e[34m${TEXT}\e[0m";; # BLUE
|
||||
esac
|
||||
echo -e ${TEXT}
|
||||
}
|
||||
|
||||
# Add apt key to allow local mirror usage during image build
|
||||
#wget -O - ftp://192.168.0.10/coex-mirror.gpg | apt-key add -
|
||||
# Generate a backup of the original source.list
|
||||
@@ -13,7 +35,7 @@ set -e
|
||||
# Add the local mirror as the first priority repository
|
||||
#wget -O - ftp://192.168.0.10/coex-mirror.list 2>/dev/null | cat - /etc/apt/sources.list > /var/sources.list && mv /var/sources.list /etc/apt/sources.list
|
||||
|
||||
echo -e "\033[0;31m\033[1m$(date) | #1 apt cache update\033[0m\033[0m"
|
||||
echo_stamp "#1 apt cache update"
|
||||
|
||||
# Clean repostory cache
|
||||
apt-get clean -qq > /dev/null
|
||||
@@ -21,15 +43,15 @@ apt-get clean -qq > /dev/null
|
||||
apt-get update -qq > /dev/null
|
||||
# && apt upgrade -y
|
||||
|
||||
echo -e "\033[0;31m\033[1m$(date) | #2 Write clever information\033[0m\033[0m"
|
||||
echo_stamp "#2 Write clever information"
|
||||
|
||||
# Clever image version
|
||||
echo "$1" >> /etc/clever_version
|
||||
# Origin image file name
|
||||
echo "${2%.*}" >> /etc/clever_origin
|
||||
|
||||
echo -e "\033[0;31m\033[1m$(date) | #1 Write magic script to /etc/rc.local\033[0m\033[0m"
|
||||
echo_stamp "#3 Write magic script to /etc/rc.local"
|
||||
MAGIC_SCRIPT="sudo /root/init_rpi.sh && sudo sed -i '/sudo \\\/root\\\/init_rpi.sh/d' /etc/rc.local && sudo reboot"
|
||||
sed -i "19a${MAGIC_SCRIPT}" /etc/rc.local
|
||||
|
||||
echo -e "\033[0;31m\033[1m$(date) | #3 End initialisation of image\033[0m\033[0m"
|
||||
echo_stamp "#4 End initialisation of image"
|
||||
|
||||
@@ -1,9 +1,31 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo -e "\033[0;31m\033[1m$(date) | #1 Rename SSID\033[0m\033[0m"
|
||||
echo_stamp() {
|
||||
|
||||
# STATIC FUNCTION
|
||||
# TEMPLATE: echo_stamp <TEXT> <TYPE>
|
||||
# TYPE: SUCCESS, ERROR, INFO
|
||||
|
||||
# More info there https://www.shellhacks.com/ru/bash-colors/
|
||||
|
||||
TEXT="$(date) | $1"
|
||||
TEXT="\e[1m$TEXT\e[0m" # BOLD
|
||||
|
||||
case "$2" in
|
||||
SUCCESS)
|
||||
TEXT="\e[32m${TEXT}\e[0m";; # GREEN
|
||||
ERROR)
|
||||
TEXT="\e[31m${TEXT}\e[0m";; # RED
|
||||
*)
|
||||
TEXT="\e[34m${TEXT}\e[0m";; # BLUE
|
||||
esac
|
||||
echo -e ${TEXT}
|
||||
}
|
||||
|
||||
echo_stamp "#1 Rename SSID"
|
||||
sudo sed -i.OLD "s/CLEVER/CLEVER-$(head -c 100 /dev/urandom | xxd -ps -c 100 | sed -e 's/[^0-9]//g' | cut -c 1-4)/g" /etc/wpa_supplicant/wpa_supplicant.conf
|
||||
|
||||
echo -e "\033[0;31m\033[1m$(date) | #2 Harware setup\033[0m\033[0m"
|
||||
echo_stamp "#2 Harware setup"
|
||||
/root/hardware_setup.sh
|
||||
|
||||
echo -e "\033[0;31m\033[1m$(date) | #3 End of network installation\033[0m\033[0m"
|
||||
|
||||
@@ -2,7 +2,29 @@
|
||||
|
||||
set -e
|
||||
|
||||
echo -e "\033[0;31m\033[1m$(date) | #1 Write to /etc/wpa_supplicant/wpa_supplicant.conf\033[0m\033[0m"
|
||||
echo_stamp() {
|
||||
|
||||
# STATIC FUNCTION
|
||||
# TEMPLATE: echo_stamp <TEXT> <TYPE>
|
||||
# TYPE: SUCCESS, ERROR, INFO
|
||||
|
||||
# More info there https://www.shellhacks.com/ru/bash-colors/
|
||||
|
||||
TEXT="$(date) | $1"
|
||||
TEXT="\e[1m$TEXT\e[0m" # BOLD
|
||||
|
||||
case "$2" in
|
||||
SUCCESS)
|
||||
TEXT="\e[32m${TEXT}\e[0m";; # GREEN
|
||||
ERROR)
|
||||
TEXT="\e[31m${TEXT}\e[0m";; # RED
|
||||
*)
|
||||
TEXT="\e[34m${TEXT}\e[0m";; # BLUE
|
||||
esac
|
||||
echo -e ${TEXT}
|
||||
}
|
||||
|
||||
echo_stamp "#1 Write to /etc/wpa_supplicant/wpa_supplicant.conf"
|
||||
|
||||
# TODO: Use wpa_cli insted direct file edit
|
||||
echo "
|
||||
@@ -17,13 +39,13 @@ network={
|
||||
auth_alg=OPEN
|
||||
}" >> /etc/wpa_supplicant/wpa_supplicant.conf
|
||||
|
||||
echo -e "\033[0;31m\033[1m$(date) | #2 Write STATIC to /etc/dhcpcd.conf\033[0m\033[0m"
|
||||
echo_stamp "#2 Write STATIC to /etc/dhcpcd.conf"
|
||||
|
||||
echo "
|
||||
interface wlan0
|
||||
static ip_address=192.168.11.1/24" >> /etc/dhcpcd.conf
|
||||
|
||||
echo -e "\033[0;31m\033[1m$(date) | #3 Write dhcp-config to /etc/dnsmasq.conf\033[0m\033[0m"
|
||||
echo_stamp "#3 Write dhcp-config to /etc/dnsmasq.conf"
|
||||
|
||||
echo "
|
||||
interface=wlan0
|
||||
@@ -36,8 +58,8 @@ domain-needed
|
||||
quiet-dhcp6
|
||||
" >> /etc/dnsmasq.conf
|
||||
|
||||
#echo -e "\033[0;31m\033[1m$(date) | #4 Write magic script for rename SSID to /etc/rc.local\033[0m\033[0m"
|
||||
#echo_stamp "#4 Write magic script for rename SSID to /etc/rc.local"
|
||||
#RENAME_SSID="sudo sed -i.OLD \"s/CLEVER/CLEVER-\$(head -c 100 /dev/urandom | xxd -ps -c 100 | sed -e 's/[^0-9]//g' | cut -c 1-4)/g\" /etc/wpa_supplicant/wpa_supplicant.conf && sudo sed -i '/sudo sed/d' /etc/rc.local && sudo reboot"
|
||||
#sed -i "19a$RENAME_SSID" /etc/rc.local
|
||||
|
||||
echo -e "\033[0;31m\033[1m$(date) | #5 End of network installation\033[0m\033[0m"
|
||||
echo_stamp "#5 End of network installation"
|
||||
|
||||
@@ -1,28 +1,50 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
##################################################################################################################################
|
||||
# ROS for user pi
|
||||
##################################################################################################################################
|
||||
|
||||
# ros http://wiki.ros.org/action/fullsearch/ROSberryPi/Installing%20ROS%20Kinetic%20on%20the%20Raspberry%20Pi
|
||||
|
||||
echo -e "\033[0;31m\033[1m$(date) | Installing ROS\033[0m\033[0m"
|
||||
set -e
|
||||
|
||||
echo -e "\033[0;31m\033[1m$(date) | #1 Installing dirmngr & add key to apt-key\033[0m\033[0m"
|
||||
echo_stamp() {
|
||||
|
||||
# STATIC FUNCTION
|
||||
# TEMPLATE: echo_stamp <TEXT> <TYPE>
|
||||
# TYPE: SUCCESS, ERROR, INFO
|
||||
|
||||
# More info there https://www.shellhacks.com/ru/bash-colors/
|
||||
|
||||
TEXT="$(date) | $1"
|
||||
TEXT="\e[1m$TEXT\e[0m" # BOLD
|
||||
|
||||
case "$2" in
|
||||
SUCCESS)
|
||||
TEXT="\e[32m${TEXT}\e[0m";; # GREEN
|
||||
ERROR)
|
||||
TEXT="\e[31m${TEXT}\e[0m";; # RED
|
||||
*)
|
||||
TEXT="\e[34m${TEXT}\e[0m";; # BLUE
|
||||
esac
|
||||
echo -e ${TEXT}
|
||||
}
|
||||
|
||||
echo_stamp "Installing ROS"
|
||||
|
||||
echo_stamp "#1 Installing dirmngr & add key to apt-key"
|
||||
|
||||
apt-get install --no-install-recommends -y -qq dirmngr=2.1.18-8~deb9u2 > /dev/null
|
||||
apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116
|
||||
|
||||
echo "deb http://packages.ros.org/ros/ubuntu stretch main" > /etc/apt/sources.list.d/ros-latest.list
|
||||
|
||||
echo -e "\033[0;31m\033[1m$(date) | #2 apt update && apt upgrade\033[0m\033[0m"
|
||||
echo_stamp "#2 apt update && apt upgrade"
|
||||
|
||||
apt-get update -qq > /dev/null
|
||||
# && apt upgrade -y
|
||||
|
||||
echo -e "\033[0;31m\033[1m$(date) | #3 Installing wget, unzip, python-rosdep, python-rosinstall-generator, python-wstool, python-rosinstall, build-essential, cmake\033[0m\033[0m"
|
||||
echo_stamp "#3 Installing wget, unzip, python-rosdep, python-rosinstall-generator, python-wstool, python-rosinstall, build-essential, cmake"
|
||||
|
||||
apt-get install --no-install-recommends -y -qq \
|
||||
python-rosdep=0.12.2-1 \
|
||||
@@ -32,7 +54,7 @@ apt-get install --no-install-recommends -y -qq \
|
||||
build-essential=12.3 \
|
||||
> /dev/null
|
||||
|
||||
echo -e "\033[0;31m\033[1m$(date) | #4 rosdep init && rosdep update\033[0m\033[0m"
|
||||
echo_stamp "#4 rosdep init && rosdep update"
|
||||
|
||||
# bootstrap rosdep
|
||||
rosdep init && rosdep update
|
||||
@@ -40,14 +62,14 @@ rosdep init && rosdep update
|
||||
# If $3 = false, then discover packages
|
||||
if [ "$3" = "false" ];
|
||||
then
|
||||
echo -e "\033[0;31m\033[1m$(date) | #5 Preparing ros_comm packages to kinetic-ros_comm-wet.rosinstall\033[0m\033[0m"
|
||||
echo_stamp "#5 Preparing ros_comm packages to kinetic-ros_comm-wet.rosinstall"
|
||||
|
||||
# create ros catkin workspace
|
||||
mkdir -p /home/pi/ros_catkin_ws && cd /home/pi/ros_catkin_ws \
|
||||
&& rosinstall_generator ros_comm --rosdistro kinetic --deps --wet-only --tar > kinetic-ros_comm-wet.rosinstall \
|
||||
&& wstool init src kinetic-ros_comm-wet.rosinstall
|
||||
|
||||
echo -e "\033[0;31m\033[1m$(date) | #6 Preparing other ROS-packages to kinetic-custom_ros.rosinstall\033[0m\033[0m"
|
||||
echo_stamp "#6 Preparing other ROS-packages to kinetic-custom_ros.rosinstall"
|
||||
|
||||
cd /home/pi/ros_catkin_ws \
|
||||
&& rosinstall_generator \
|
||||
@@ -56,13 +78,13 @@ then
|
||||
&& wstool merge -t src kinetic-custom_ros.rosinstall \
|
||||
&& wstool update -t src
|
||||
else
|
||||
echo -e "\033[0;31m\033[1m$(date) | #5 Creating manual ros_catkin_ws\033[0m\033[0m"
|
||||
echo_stamp "#5 Creating manual ros_catkin_ws"
|
||||
|
||||
mkdir -p /home/pi/ros_catkin_ws && cd /home/pi/ros_catkin_ws \
|
||||
&& wstool init src kinetic-ros-coex.rosinstall
|
||||
fi
|
||||
|
||||
echo -e "\033[0;31m\033[1m$(date) | #7 Installing dependencies apps with rosdep\033[0m\033[0m"
|
||||
echo_stamp "#7 Installing dependencies apps with rosdep"
|
||||
cd /home/pi/ros_catkin_ws
|
||||
# There is a risk that umount will fail
|
||||
set +e
|
||||
@@ -76,54 +98,54 @@ do
|
||||
# If no problems detected
|
||||
if [[ $? == 0 ]]
|
||||
then
|
||||
echo -e "\033[0;31m\033[1m$(date) | Successfull rosdep install\033[0m\033[0m"
|
||||
echo_stamp "Successfull rosdep install" "SUCCESS"
|
||||
# Set flag
|
||||
install_ok=true
|
||||
# Exit loop
|
||||
break
|
||||
fi
|
||||
# Unmount has failed
|
||||
echo -e "\033[0;31m\033[1m$(date) | Rosdep installation failed\033[0m\033[0m"
|
||||
echo_stamp "Rosdep installation failed" "ERROR"
|
||||
# Wait for some time
|
||||
sleep 2
|
||||
done
|
||||
set -e
|
||||
# Jenkins job will fail if this condition is not true
|
||||
[[ "$install_ok" == true ]]
|
||||
echo -e "\033[0;31m\033[1m$(date) | End of rosdep install\033[0m\033[0m"
|
||||
echo_stamp "End of rosdep install"
|
||||
|
||||
echo -e "\033[0;31m\033[1m$(date) | #8 Refactoring usb_cam in SRC\033[0m\033[0m"
|
||||
echo_stamp "#8 Refactoring usb_cam in SRC"
|
||||
|
||||
sed -i '/#define __STDC_CONSTANT_MACROS/a\#define PIX_FMT_RGB24 AV_PIX_FMT_RGB24\n#define PIX_FMT_YUV422P AV_PIX_FMT_YUV422P' /home/pi/ros_catkin_ws/src/usb_cam/src/usb_cam.cpp
|
||||
|
||||
echo -e "\033[0;31m\033[1m$(date) | #9 Installing GeographicLib datasets\033[0m\033[0m"
|
||||
echo_stamp "#9 Installing GeographicLib datasets"
|
||||
|
||||
/home/pi/ros_catkin_ws/src/mavros/mavros/scripts/install_geographiclib_datasets.sh
|
||||
|
||||
#echo -e "\033[0;31m\033[1m$(date) | #11 Building light packages on 2 threads\033[0m\033[0m"
|
||||
#echo_stamp "#11 Building light packages on 2 threads"
|
||||
|
||||
# Build the catkin Workspace
|
||||
#cd /home/pi/ros_catkin_ws && ./src/catkin/bin/catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release -j2 --install-space /opt/ros/kinetic --pkg actionlib actionlib_msgs angles async_web_server_cpp bond bond_core bondcpp bondpy camera_calibration_parsers camera_info_manager catkin class_loader cmake_modules cpp_common diagnostic_msgs diagnostic_updater dynamic_reconfigure eigen_conversions gencpp geneus genlisp genmsg gennodejs genpy geographic_msgs geometry_msgs geometry2 image_transport libmavconn mavlink mavros_msgs message_filters message_generation message_runtime mk nav_msgs nodelet orocos_kdl pluginlib python_orocos_kdl ros ros_comm rosapi rosauth rosbag rosbag_migration_rule rosbag_storage rosbash rosboost_cfg rosbridge_library rosbridge_server rosbridge_suite rosbuild rosclean rosconsole rosconsole_bridge roscpp roscpp_serialization roscpp_traits roscreate rosgraph rosgraph_msgs roslang roslaunch roslib roslint roslisp roslz4 rosmake rosmaster rosmsg rosnode rosout rospack rosparam rospy rospy_tutorials rosserial rosserial_client rosserial_msgs rosserial_python rosservice rostest rostime rostopic rosunit roswtf sensor_msgs smclib std_msgs std_srvs stereo_msgs tf tf2 tf2_bullet tf2_eigen tf2_geometry_msgs tf2_kdl tf2_msgs tf2_py tf2_ros tf2_sensor_msgs tf2_tools topic_tools trajectory_msgs urdf urdf_parser_plugin usb_cam uuid_msgs visualization_msgs xmlrpcpp
|
||||
|
||||
#echo -e "\033[0;31m\033[1m$(date) | #12 Building heavy packages\033[0m\033[0m"
|
||||
#echo_stamp "#12 Building heavy packages"
|
||||
|
||||
# This command uses less threads to avoid Raspberry Pi freeze
|
||||
# Build the catkin Workspace
|
||||
#cd /home/pi/ros_catkin_ws && ./src/catkin/bin/catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release -j1 --install-space /opt/ros/kinetic --pkg mavros opencv3 cv_bridge cv_camera mavros_extras web_video_server
|
||||
|
||||
echo -e "\033[0;31m\033[1m$(date) | #10 Building packages on 1 thread\033[0m\033[0m"
|
||||
echo_stamp "#10 Building packages on 1 thread"
|
||||
|
||||
# Install builded packages
|
||||
# WARNING: A major bug was found when using --pkg option (catkin_make_isolated doesn't install environment files)
|
||||
# TODO: Can we increase threads number with HDD swap?
|
||||
cd /home/pi/ros_catkin_ws && ./src/catkin/bin/catkin_make_isolated --install -j4 -DCMAKE_BUILD_TYPE=Release --install-space /opt/ros/kinetic
|
||||
|
||||
echo -e "\033[0;31m\033[1m$(date) | #11 Remove build_isolated & devel_isolated from ros_catkin_ws\033[0m\033[0m"
|
||||
echo_stamp "#11 Remove build_isolated & devel_isolated from ros_catkin_ws"
|
||||
|
||||
rm -rf /home/pi/ros_catkin_ws/build_isolated /home/pi/ros_catkin_ws/devel_isolated
|
||||
chown -Rf pi:pi /home/pi/ros_catkin_ws
|
||||
|
||||
echo -e "\033[0;31m\033[1m$(date) | #12 Creating catkin_ws & Installing CLEVER-BUNDLE\033[0m\033[0m"
|
||||
echo_stamp "#12 Creating catkin_ws & Installing CLEVER-BUNDLE"
|
||||
|
||||
git clone $1 /home/pi/catkin_ws/src/clever \
|
||||
&& cd /home/pi/catkin_ws/src/clever \
|
||||
@@ -138,11 +160,11 @@ git clone $1 /home/pi/catkin_ws/src/clever \
|
||||
&& systemctl enable roscore \
|
||||
&& systemctl enable clever
|
||||
|
||||
echo -e "\033[0;31m\033[1m$(date) | #13 Change permissions for catkin_ws\033[0m\033[0m"
|
||||
echo_stamp "#13 Change permissions for catkin_ws"
|
||||
|
||||
chown -Rf pi:pi /home/pi/catkin_ws
|
||||
|
||||
echo -e "\033[0;31m\033[1m$(date) | #14 Setup ROS environment\033[0m\033[0m"
|
||||
echo_stamp "#14 Setup ROS environment"
|
||||
|
||||
cat <<EOF | tee -a /home/pi/.bashrc > /dev/null
|
||||
LANG=C.UTF-8
|
||||
@@ -153,7 +175,7 @@ source /opt/ros/kinetic/setup.bash
|
||||
source /home/pi/catkin_ws/devel/setup.bash
|
||||
EOF
|
||||
|
||||
#echo -e "\033[0;31m\033[1m$(date) | #14 Removing local apt mirror\033[0m\033[0m"
|
||||
#echo_stamp "#14 Removing local apt mirror"
|
||||
# Restore original sources.list
|
||||
#mv /var/sources.list.bak /etc/apt/sources.list
|
||||
# Clean apt cache
|
||||
@@ -161,4 +183,4 @@ apt-get clean -qq > /dev/null
|
||||
# Remove local mirror repository key
|
||||
#apt-key del COEX-MIRROR
|
||||
|
||||
echo -e "\033[0;31m\033[1m$(date) | END of ROS INSTALLATION\033[0m\033[0m"
|
||||
echo_stamp "END of ROS INSTALLATION"
|
||||
|
||||
@@ -1,12 +1,34 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
##################################################################################################################################
|
||||
# Image software installation
|
||||
##################################################################################################################################
|
||||
|
||||
echo -e "\033[0;31m\033[1m$(date) | #1 Software installing\033[0m\033[0m"
|
||||
set -e
|
||||
|
||||
echo_stamp() {
|
||||
|
||||
# STATIC FUNCTION
|
||||
# TEMPLATE: echo_stamp <TEXT> <TYPE>
|
||||
# TYPE: SUCCESS, ERROR, INFO
|
||||
|
||||
# More info there https://www.shellhacks.com/ru/bash-colors/
|
||||
|
||||
TEXT="$(date) | $1"
|
||||
TEXT="\e[1m$TEXT\e[0m" # BOLD
|
||||
|
||||
case "$2" in
|
||||
SUCCESS)
|
||||
TEXT="\e[32m${TEXT}\e[0m";; # GREEN
|
||||
ERROR)
|
||||
TEXT="\e[31m${TEXT}\e[0m";; # RED
|
||||
*)
|
||||
TEXT="\e[34m${TEXT}\e[0m";; # BLUE
|
||||
esac
|
||||
echo -e ${TEXT}
|
||||
}
|
||||
|
||||
echo_stamp "#1 Software installing"
|
||||
|
||||
# TODO: Use dnsmasq instead of isc-dhcp-server
|
||||
apt-get install --no-install-recommends -y -qq \
|
||||
@@ -30,7 +52,7 @@ apt-get install --no-install-recommends -y -qq \
|
||||
libpoco-dev=1.7.6+dfsg1-5+deb9u1 \
|
||||
> /dev/null
|
||||
|
||||
echo -e "\033[0;31m\033[1m$(date) | #2 Adding mjpg-streamer at /home/pi\033[0m\033[0m"
|
||||
echo_stamp "#2 Adding mjpg-streamer at /home/pi"
|
||||
# https://github.com/jacksonliam/mjpg-streamer
|
||||
|
||||
git clone https://github.com/jacksonliam/mjpg-streamer.git /home/pi/mjpg-streamer \
|
||||
@@ -39,11 +61,11 @@ git clone https://github.com/jacksonliam/mjpg-streamer.git /home/pi/mjpg-streame
|
||||
&& make install \
|
||||
&& chown -Rf pi:pi /home/pi/mjpg-streamer
|
||||
|
||||
echo -e "\033[0;31m\033[1m$(date) | Add .vimrc\033[0m\033[0m"
|
||||
echo_stamp "Add .vimrc"
|
||||
|
||||
# vim settings
|
||||
echo "set mouse-=a
|
||||
syntax on
|
||||
" > /home/pi/.vimrc
|
||||
|
||||
echo -e "\033[0;31m\033[1m$(date) | End of network installation\033[0m\033[0m"
|
||||
echo_stamp "End of network installation"
|
||||
|
||||
Reference in New Issue
Block a user