From 1b191d9cf08523eb57973d5e0d122c99d49e9441 Mon Sep 17 00:00:00 2001 From: Oleg Kalachev Date: Thu, 18 Apr 2024 06:49:46 +0300 Subject: [PATCH] Major build scripts cleanup Including removing echo_stamp, which is not needed --- builder/assets/hardware_setup.sh | 36 ++++------------- builder/assets/init_rpi.sh | 32 +++------------ builder/image-build.sh | 40 +++++------------- builder/image-init.sh | 35 ++++------------ builder/image-network.sh | 33 ++------------- builder/image-ros.sh | 69 +++++++++----------------------- builder/image-software.sh | 59 +++++++++------------------ builder/image-validate.sh | 9 +++-- builder/test/tests.sh | 2 +- 9 files changed, 75 insertions(+), 240 deletions(-) diff --git a/builder/assets/hardware_setup.sh b/builder/assets/hardware_setup.sh index 868de1be..ddb49f2c 100755 --- a/builder/assets/hardware_setup.sh +++ b/builder/assets/hardware_setup.sh @@ -15,52 +15,32 @@ set -e # Exit immidiately on non-zero result -echo_stamp() { - # TEMPLATE: echo_stamp - # TYPE: SUCCESS, ERROR, INFO - - # More info there https://www.shellhacks.com/ru/bash-colors/ - - TEXT="$(date '+[%Y-%m-%d %H:%M:%S]') $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_stamp "#1 Turn on sshd" +echo "--- Enable sshd" touch /boot/ssh # /usr/bin/raspi-config nonint do_ssh 0 # 2. Enable GPIO -echo_stamp "#2 GPIO enabled by default" +echo "--- GPIO enabled by default" # 3. Enable I2C -echo_stamp "#3 Turn on I2C" +echo "--- Enable I2C" /usr/bin/raspi-config nonint do_i2c 0 # 4. Enable SPI -echo_stamp "#4 Turn on SPI" +echo "--- Enable SPI" /usr/bin/raspi-config nonint do_spi 0 # 5. Enable raspicam -echo_stamp "#5 Turn on raspicam" +echo "--- Enable raspicam" /usr/bin/raspi-config nonint do_camera 0 # 6. Enable hardware UART -echo_stamp "#6 Turn on UART" +echo "--- Enable UART" # Temporary solution # https://github.com/RPi-Distro/raspi-config/pull/75 /usr/bin/raspi-config nonint do_serial 1 @@ -74,9 +54,7 @@ systemctl disable hciuart.service # 7. Enable V4L driver http://robocraft.ru/blog/electronics/3158.html #echo "bcm2835-v4l2" >> /etc/modules -echo_stamp "#7 Turn on v4l2 driver" +echo "--- Enable v4l2 driver" if ! grep -q "^bcm2835-v4l2" /etc/modules; then printf "bcm2835-v4l2\n" >> /etc/modules fi - -echo_stamp "#8 End of configure hardware interfaces" diff --git a/builder/assets/init_rpi.sh b/builder/assets/init_rpi.sh index 69505152..6eea1111 100755 --- a/builder/assets/init_rpi.sh +++ b/builder/assets/init_rpi.sh @@ -15,28 +15,8 @@ set -e # Exit immidiately on non-zero result -echo_stamp() { - # TEMPLATE: echo_stamp - # TYPE: SUCCESS, ERROR, INFO - - # More info there https://www.shellhacks.com/ru/bash-colors/ - - TEXT="$(date '+[%Y-%m-%d %H:%M:%S]') $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} -} - NEW_SSID='clover-'$(head -c 100 /dev/urandom | xxd -ps -c 100 | sed -e "s/[^0-9]//g" | cut -c 1-4) -echo_stamp "Setting SSID to ${NEW_SSID}" +echo "--- Setting SSID to ${NEW_SSID}" # TODO: Use wpa_cli insted direct file edit # FIXME: We rely on raspberrypi-net-mods to copy our file to /etc/wpa_supplicant. # This is not very reliable, but seems to fix our rfkill problem. @@ -57,19 +37,17 @@ network={ EOF NEW_HOSTNAME=$(echo ${NEW_SSID} | tr '[:upper:]' '[:lower:]') -echo_stamp "Setting hostname to $NEW_HOSTNAME" +echo "--- Setting hostname to $NEW_HOSTNAME" hostnamectl set-hostname $NEW_HOSTNAME sed -i 's/127\.0\.1\.1.*/127.0.1.1\t'${NEW_HOSTNAME}' '${NEW_HOSTNAME}'.local/g' /etc/hosts # .local (mdns) hostname added to make it accesable when wlan and ethernet interfaces are down -echo_stamp "Enable ROS services" +echo "--- Enable ROS services" systemctl enable roscore systemctl enable clover -echo_stamp "Harware setup" +echo "--- Harware setup" /root/hardware_setup.sh -echo_stamp "Remove init scripts" +echo "--- Remove init scripts" rm /root/init_rpi.sh /root/hardware_setup.sh - -echo_stamp "End of initialization of the image" diff --git a/builder/image-build.sh b/builder/image-build.sh index 534157eb..ba82e7ff 100755 --- a/builder/image-build.sh +++ b/builder/image-build.sh @@ -13,7 +13,7 @@ # copies or substantial portions of the Software. # -set -e # Exit immidiately on non-zero result +set -ex # exit on error, echo commands # https://www.raspberrypi.org/software/operating-systems/#raspberry-pi-os-32-bit SOURCE_IMAGE="https://downloads.raspberrypi.org/raspios_lite_armhf/images/raspios_lite_armhf-2021-05-28/2021-05-07-raspios-buster-armhf-lite.zip" @@ -22,33 +22,13 @@ export DEBIAN_FRONTEND=${DEBIAN_FRONTEND:='noninteractive'} export LANG=${LANG:='C.UTF-8'} export LC_ALL=${LC_ALL:='C.UTF-8'} -echo_stamp() { - # TEMPLATE: echo_stamp - # TYPE: SUCCESS, ERROR, INFO - - # More info there https://www.shellhacks.com/ru/bash-colors/ - - TEXT="$(date '+[%Y-%m-%d %H:%M:%S]') $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} -} - BUILDER_DIR="/builder" REPO_DIR="${BUILDER_DIR}/repo" SCRIPTS_DIR="${REPO_DIR}/builder" IMAGES_DIR="${REPO_DIR}/images" -[[ ! -d ${SCRIPTS_DIR} ]] && (echo_stamp "Directory ${SCRIPTS_DIR} doesn't exist" "ERROR"; exit 1) -[[ ! -d ${IMAGES_DIR} ]] && mkdir ${IMAGES_DIR} && echo_stamp "Directory ${IMAGES_DIR} was created successful" "SUCCESS" +[[ ! -d ${SCRIPTS_DIR} ]] && (echo "Error: directory ${SCRIPTS_DIR} doesn't exist"; exit 1) +[[ ! -d ${IMAGES_DIR} ]] && mkdir ${IMAGES_DIR} && echo "Directory ${IMAGES_DIR} was created successful" if [[ -z ${TRAVIS_TAG} ]]; then IMAGE_VERSION="$(cd ${REPO_DIR}; git log --format=%h -1)"; else IMAGE_VERSION="${TRAVIS_TAG}"; fi # IMAGE_VERSION="${TRAVIS_TAG:=$(cd ${REPO_DIR}; git log --format=%h -1)}" @@ -64,15 +44,15 @@ get_image() { local RPI_IMAGE_NAME=$(echo ${RPI_ZIP_NAME} | sed 's/zip/img/') if [ ! -e "${BUILD_DIR}/${RPI_ZIP_NAME}" ]; then - echo_stamp "Downloading original Linux distribution" + echo "--- Downloading original Linux distribution" wget --progress=dot:giga -O ${BUILD_DIR}/${RPI_ZIP_NAME} $2 - echo_stamp "Downloading complete" "SUCCESS" \ - else echo_stamp "Linux distribution already donwloaded"; fi + echo "--- Downloading complete" "SUCCESS" + else + echo "Linux distribution already downloaded" + fi - echo_stamp "Unzipping Linux distribution image" \ - && unzip -p ${BUILD_DIR}/${RPI_ZIP_NAME} ${RPI_IMAGE_NAME} > $1 \ - && echo_stamp "Unzipping complete" "SUCCESS" \ - || (echo_stamp "Unzipping was failed!" "ERROR"; exit 1) + echo "--- Unzipping Linux distribution image" + unzip -p ${BUILD_DIR}/${RPI_ZIP_NAME} ${RPI_IMAGE_NAME} > $1 } get_image ${IMAGE_PATH} ${SOURCE_IMAGE} diff --git a/builder/image-init.sh b/builder/image-init.sh index 51985e80..273d99db 100755 --- a/builder/image-init.sh +++ b/builder/image-init.sh @@ -12,50 +12,29 @@ # copies or substantial portions of the Software. # -set -e # Exit immidiately on non-zero result - -echo_stamp() { - # TEMPLATE: echo_stamp - # TYPE: SUCCESS, ERROR, INFO - - # More info there https://www.shellhacks.com/ru/bash-colors/ - - TEXT="$(date '+[%Y-%m-%d %H:%M:%S]') $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 "Write Clover information" +set -ex # exit on error, echo commands +echo "--- Write Clover information" # Clover image version echo "$1" >> /etc/clover_version # Origin image file name echo "${2%.*}" >> /etc/clover_origin -echo_stamp "Write magic script to /etc/rc.local" +echo "--- 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 # It needs for autosizer.sh & maybe that is correct -echo_stamp "Change boot partition" +echo "--- 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_stamp "Set max space for syslogs" +echo "--- Set max space for syslogs" # https://unix.stackexchange.com/questions/139513/how-to-clear-journalctl sed -i 's/#SystemMaxUse=/SystemMaxUse=200M/' /etc/systemd/journald.conf -echo_stamp "Move /etc/ld.so.preload out of the way" +echo "--- Move /etc/ld.so.preload out of the way" mv /etc/ld.so.preload /etc/ld.so.preload.disabled-for-build -echo_stamp "End of init image" +echo "--- End of init image" diff --git a/builder/image-network.sh b/builder/image-network.sh index 7394b250..7ac32450 100755 --- a/builder/image-network.sh +++ b/builder/image-network.sh @@ -12,43 +12,20 @@ # copies or substantial portions of the Software. # -set -e # Exit immidiately on non-zero result - -echo_stamp() { - # TEMPLATE: echo_stamp - # TYPE: SUCCESS, ERROR, INFO - - # More info there https://www.shellhacks.com/ru/bash-colors/ - - TEXT="$(date '+[%Y-%m-%d %H:%M:%S]') $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 STATIC to /etc/dhcpcd.conf" +set -ex # exit on error, echo commands +echo "--- Write static to /etc/dhcpcd.conf" cat << EOF >> /etc/dhcpcd.conf interface wlan0 static ip_address=192.168.11.1/24 EOF -echo_stamp "#2 Set wpa_supplicant country" - +echo "--- Set wpa_supplicant country" cat << EOF >> /etc/wpa_supplicant/wpa_supplicant.conf country=GB EOF -echo_stamp "#3 Write dhcp-config to /etc/dnsmasq.conf" - +echo "--- Write dhcp-config to /etc/dnsmasq.conf" cat << EOF >> /etc/dnsmasq.conf interface=wlan0 address=/clover/coex/192.168.11.1 @@ -59,5 +36,3 @@ bogus-priv domain-needed quiet-dhcp6 EOF - -echo_stamp "#4 End of network installation" diff --git a/builder/image-ros.sh b/builder/image-ros.sh index 02dfdecc..11dbe45c 100755 --- a/builder/image-ros.sh +++ b/builder/image-ros.sh @@ -15,35 +15,9 @@ set -ex # exit on error, echo commands -REPO=$1 -REF=$2 -INSTALL_ROS_PACK_SOURCES=$3 -DISCOVER_ROS_PACK=$4 -NUMBER_THREADS=$5 - # Current ROS distribution ROS_DISTRO=noetic -echo_stamp() { - # TEMPLATE: echo_stamp - # TYPE: SUCCESS, ERROR, INFO - - # More info there https://www.shellhacks.com/ru/bash-colors/ - - TEXT="$(date '+[%Y-%m-%d %H:%M:%S]') $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} -} - # https://gist.github.com/letmaik/caa0f6cc4375cbfcc1ff26bd4530c2a3 # https://github.com/travis-ci/travis-build/blob/master/lib/travis/build/templates/header.sh my_travis_retry() { @@ -69,24 +43,24 @@ my_travis_retry() { } # TODO: 'kinetic-rosdep-clover.yaml' should add only if we use our repo? -echo_stamp "Init rosdep" +echo "--- Init rosdep" my_travis_retry rosdep init # FIXME: Re-add this after missing packages are built echo "yaml file:///etc/ros/rosdep/${ROS_DISTRO}-rosdep-clover.yaml" >> /etc/ros/rosdep/sources.list.d/10-clover.list my_travis_retry rosdep update -echo_stamp "Populate rosdep for ROS user" +echo "--- Populate rosdep for ROS user" my_travis_retry sudo -u pi rosdep update export ROS_IP='127.0.0.1' # needed for running tests -# echo_stamp "Reconfiguring Clover repository for simplier unshallowing" +# echo "Reconfiguring Clover repository for simplier unshallowing" cd /home/pi/catkin_ws/src/clover git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*" # This is sort of a hack to force "custom" packages to be installed - the ones built by COEX, linked against OpenCV 4.2 # I **wish** OpenCV would not be such a mess, but, well, here we are. -echo_stamp "Installing OpenCV 4.2-compatible ROS packages" +echo "--- Installing OpenCV 4.2-compatible ROS packages" apt install -y --no-install-recommends \ ros-${ROS_DISTRO}-compressed-image-transport=1.14.0-0buster \ ros-${ROS_DISTRO}-cv-bridge=1.15.0-0buster \ @@ -100,10 +74,10 @@ ros-${ROS_DISTRO}-cv-camera \ ros-${ROS_DISTRO}-image-publisher \ ros-${ROS_DISTRO}-web-video-server -echo_stamp "Installing libboost-dev" # https://travis-ci.org/github/CopterExpress/clover/jobs/766318908#L6536 +echo "--- Installing libboost-dev" # https://travis-ci.org/github/CopterExpress/clover/jobs/766318908#L6536 my_travis_retry apt-get install -y --no-install-recommends libboost-dev libboost-all-dev -echo_stamp "Build and install Clover" +echo "--- Build and install Clover" cd /home/pi/catkin_ws # Don't try to install gazebo_ros my_travis_retry rosdep install -y --from-paths src --ignore-src --rosdistro ${ROS_DISTRO} --os=debian:buster \ @@ -115,12 +89,12 @@ source /opt/ros/${ROS_DISTRO}/setup.bash catkin_make -j2 -DCMAKE_BUILD_TYPE=RelWithDebInfo source devel/setup.bash -echo_stamp "Install clever package (for backwards compatibility)" +echo "--- Install clever package (for backwards compatibility)" cd /home/pi/catkin_ws/src/clover/builder/assets/clever ./setup.py install rm -rf build # remove build artifacts -echo_stamp "Build Clover documentation" +echo "--- Build Clover documentation" cd /home/pi/catkin_ws/src/clover builder/assets/install_gitbook.sh gitbook install @@ -129,7 +103,7 @@ gitbook build rm -rf _book/assets && ln -s ../docs/assets _book/assets touch node_modules/CATKIN_IGNORE docs/CATKIN_IGNORE _book/CATKIN_IGNORE clover/www/CATKIN_IGNORE apps/CATKIN_IGNORE # ignore documentation files by catkin -echo_stamp "Installing additional ROS packages" +echo "--- Installing additional ROS packages" my_travis_retry apt-get install -y --no-install-recommends \ ros-${ROS_DISTRO}-rosbridge-suite \ ros-${ROS_DISTRO}-rosserial \ @@ -143,35 +117,35 @@ my_travis_retry apt-get install -y --no-install-recommends \ ros-${ROS_DISTRO}-stereo-msgs # TODO move GeographicLib datasets to Mavros debian package -echo_stamp "Install GeographicLib datasets (needed for mavros)" \ +echo "--- Install GeographicLib datasets (needed for mavros)" \ && wget -qO- https://raw.githubusercontent.com/mavlink/mavros/master/mavros/scripts/install_geographiclib_datasets.sh | bash -echo_stamp "Running tests" +echo "--- Running tests" cd /home/pi/catkin_ws # FIXME: Investigate failing tests catkin_make run_tests #&& catkin_test_results -echo_stamp "Change permissions for catkin_ws" +echo "--- Change permissions for catkin_ws" chown -Rf pi:pi /home/pi/catkin_ws -echo_stamp "Update www" +echo "--- Update www" sudo -u pi sh -c ". devel/setup.sh && rosrun clover www" -echo_stamp "Make \$HOME/examples symlink" +echo "--- Make \$HOME/examples symlink" ln -s "$(catkin_find clover examples --first-only)" /home/pi chown -Rf pi:pi /home/pi/examples -echo_stamp "Make systemd services symlinks" +echo "--- Make systemd services symlinks" ln -s /home/pi/catkin_ws/src/clover/builder/assets/clover.service /lib/systemd/system/ ln -s /home/pi/catkin_ws/src/clover/builder/assets/roscore.service /lib/systemd/system/ # validate [ -f /lib/systemd/system/clover.service ] [ -f /lib/systemd/system/roscore.service ] -echo_stamp "Make udev rules symlink" +echo "--- Make udev rules symlink" ln -s "$(catkin_find clover udev --first-only)"/* /lib/udev/rules.d/ -echo_stamp "Setup ROS environment" +echo "--- Setup ROS environment" cat << EOF >> /home/pi/.bashrc LANG='C.UTF-8' LC_ALL='C.UTF-8' @@ -180,12 +154,5 @@ source /opt/ros/${ROS_DISTRO}/setup.bash source /home/pi/catkin_ws/devel/setup.bash EOF -#echo_stamp "Removing local apt mirror" -# Restore original sources.list -#mv /var/sources.list.bak /etc/apt/sources.list -# Clean apt cache +echo "--- Clean apt cache" apt-get clean -qq > /dev/null -# Remove local mirror repository key -#apt-key del COEX-MIRROR - -echo_stamp "END of ROS INSTALLATION" diff --git a/builder/image-software.sh b/builder/image-software.sh index 8b61bb66..a86d5290 100755 --- a/builder/image-software.sh +++ b/builder/image-software.sh @@ -12,27 +12,7 @@ # copies or substantial portions of the Software. # -set -e # Exit immidiately on non-zero result - -echo_stamp() { - # TEMPLATE: echo_stamp - # TYPE: SUCCESS, ERROR, INFO - - # More info there https://www.shellhacks.com/ru/bash-colors/ - - TEXT="$(date '+[%Y-%m-%d %H:%M:%S]') $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} -} +set -ex # exit on error, echo commands # https://gist.github.com/letmaik/caa0f6cc4375cbfcc1ff26bd4530c2a3 # https://github.com/travis-ci/travis-build/blob/master/lib/travis/build/templates/header.sh @@ -57,11 +37,10 @@ my_travis_retry() { return $result } -echo_stamp "Increase apt retries" - +echo "--- Increase apt retries" echo "APT::Acquire::Retries \"3\";" > /etc/apt/apt.conf.d/80-retries -echo_stamp "Install apt keys & repos" +echo "--- Install apt keys & repos" # TODO: This STDOUT consist 'OK' apt-get update \ @@ -70,17 +49,17 @@ apt-get update \ echo "deb http://packages.ros.org/ros/ubuntu buster main" > /etc/apt/sources.list.d/ros-latest.list -wget -O - 'http://packages.coex.tech/key.asc' | apt-key add - +wget -O - 'http://packages.coex.tech/key.asc' | apt-key add - echo 'deb http://packages.coex.tech buster main' >> /etc/apt/sources.list -echo_stamp "Update apt cache" +echo "--- Update apt cache" # TODO: FIX ERROR: /usr/bin/apt-key: 596: /usr/bin/apt-key: cannot create /dev/null: Permission denied apt-get update # && apt upgrade -y # Let's retry fetching those packages several times, just in case -echo_stamp "Software installing" +echo "--- Install software" my_travis_retry apt-get install --no-install-recommends -y cmake-data=3.13.4-1 cmake=3.13.4-1 # FIXME: using older CMake due to https://travis-ci.org/github/CopterExpress/clover/jobs/764367665#L6984 my_travis_retry apt-get install --no-install-recommends -y \ unzip \ @@ -121,7 +100,7 @@ python3-opencv sed -i "s/updates_available//" /usr/share/byobu/status/status # sed -i "s/updates_available//" /home/pi/.byobu/status -echo_stamp "Installing pip" +echo "--- Installing pip" curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py curl https://bootstrap.pypa.io/pip/2.7/get-pip.py -o get-pip2.py python3 get-pip.py @@ -130,12 +109,12 @@ rm get-pip.py get-pip2.py #my_travis_retry pip install --upgrade pip #my_travis_retry pip3 install --upgrade pip -echo_stamp "Make sure both pip and pip3 are installed" +echo "--- Make sure both pip and pip3 are installed" pip --version pip3 --version -echo_stamp "Install and enable Butterfly (web terminal)" -echo_stamp "Workaround for tornado >= 6.0 breaking butterfly" +echo "--- Install and enable Butterfly (web terminal)" +echo "Workaround for tornado >= 6.0 breaking butterfly" export CRYPTOGRAPHY_DONT_BUILD_RUST=1 my_travis_retry pip3 install cryptography==3.4.6 # https://stackoverflow.com/a/68472128/6850197 my_travis_retry pip3 install pyOpenSSL==20.0.1 @@ -144,16 +123,16 @@ my_travis_retry pip3 install butterfly my_travis_retry pip3 install butterfly[systemd] systemctl enable butterfly.socket -echo_stamp "Install ws281x library" +echo "--- Install ws281x library" my_travis_retry pip3 install --prefer-binary rpi_ws281x -echo_stamp "Setup Monkey" +echo "--- Setup Monkey" mv /etc/monkey/sites/default /etc/monkey/sites/default.orig mv /root/monkey /etc/monkey/sites/default sed -i 's/SymLink Off/SymLink On/' /etc/monkey/monkey.conf systemctl enable monkey.service -echo_stamp "Install Node.js" +echo "--- Install Node.js" cd /home/pi wget --no-verbose https://nodejs.org/dist/v10.15.0/node-v10.15.0-linux-armv6l.tar.gz tar -xzf node-v10.15.0-linux-armv6l.tar.gz @@ -161,28 +140,26 @@ cp -R node-v10.15.0-linux-armv6l/* /usr/local/ rm -rf node-v10.15.0-linux-armv6l/ rm node-v10.15.0-linux-armv6l.tar.gz -echo_stamp "Installing ptvsd" +echo "--- Installing ptvsd" my_travis_retry pip install ptvsd my_travis_retry pip3 install ptvsd -echo_stamp "Installing pyzbar" +echo "--- Installing pyzbar" my_travis_retry pip install pyzbar my_travis_retry pip3 install pyzbar -echo_stamp "Add .vimrc" +echo "--- Add .vimrc" cat << EOF > /home/pi/.vimrc set mouse-=a syntax on autocmd BufNewFile,BufRead *.launch set syntax=xml EOF -echo_stamp "Change default keyboard layout to US" +echo "--- Change default keyboard layout to US" sed -i 's/XKBLAYOUT="gb"/XKBLAYOUT="us"/g' /etc/default/keyboard -echo_stamp "Attempting to kill dirmngr" +echo "--- Attempting to kill dirmngr" gpgconf --kill dirmngr # dirmngr is only used by apt-key, so we can safely kill it. # We ignore pkill's exit value as well. pkill -9 -f dirmngr || true - -echo_stamp "End of software installation" diff --git a/builder/image-validate.sh b/builder/image-validate.sh index cf11647c..e96a6181 100755 --- a/builder/image-validate.sh +++ b/builder/image-validate.sh @@ -12,9 +12,10 @@ # copies or substantial portions of the Software. # -set -ex +set -ex # exit on error, echo commands -echo "Run image tests" + +echo "--- Run image tests" export ROS_DISTRO='noetic' export ROS_IP='127.0.0.1' @@ -35,9 +36,9 @@ systemctl stop roscore apt-cache show gst-rtsp-launch apt-cache show openvpn -echo "Move /etc/ld.so.preload back to its original position" +echo "--- Move /etc/ld.so.preload back to its original position" mv /etc/ld.so.preload.disabled-for-build /etc/ld.so.preload -echo "Largest packages installed" +echo "--- Largest packages installed" sudo -E sh -c 'apt-get install -y debian-goodies' dpigs -H -n 100 diff --git a/builder/test/tests.sh b/builder/test/tests.sh index 1d0ccc18..57f2e0b4 100755 --- a/builder/test/tests.sh +++ b/builder/test/tests.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -set -ex +set -ex # exit on error, echo commands # TODO: validate versions