From 1a9e689b8c013c63e02a9863cdb3f6b79b99510a Mon Sep 17 00:00:00 2001 From: Oleg Kalachev Date: Wed, 8 May 2024 20:09:09 +0300 Subject: [PATCH] Disable exiting on error in init scripts --- builder/assets/hardware_setup.sh | 2 -- builder/assets/init_rpi.sh | 21 +++++++++------------ 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/builder/assets/hardware_setup.sh b/builder/assets/hardware_setup.sh index c61ea8e69..350bd96e2 100755 --- a/builder/assets/hardware_setup.sh +++ b/builder/assets/hardware_setup.sh @@ -15,8 +15,6 @@ # https://www.raspberrypi.com/documentation/computers/configuration.html -set -e # Exit immidiately on non-zero result - ################################################## # Configure hardware interfaces ################################################## diff --git a/builder/assets/init_rpi.sh b/builder/assets/init_rpi.sh index b0da7c661..bc9061ea9 100755 --- a/builder/assets/init_rpi.sh +++ b/builder/assets/init_rpi.sh @@ -13,26 +13,23 @@ # copies or substantial portions of the Software. # -set -e # Exit immidiately on non-zero result - echo "--- Fix home directory permissions" chmod +rx /home/pi NEW_SSID='clover-'$(head -c 100 /dev/urandom | xxd -ps -c 100 | sed -e "s/[^0-9]//g" | cut -c 1-4) echo "--- Creating Wi-Fi AP with SSID=${NEW_SSID}" -nmcli con add type wifi ifname wlan0 mode ap con-name clover ssid $NEW_SSID autoconnect true -nmcli con modify clover 802-11-wireless.band bg -# nmcli con modify clover 802-11-wireless.channel 6 -nmcli con modify clover ipv4.method shared ipv4.address 192.168.11.1/24 -nmcli con modify clover ipv6.method disabled -nmcli con modify clover wifi-sec.key-mgmt wpa-psk -nmcli con modify clover wifi-sec.psk "cloverwifi" -systemctl disable dnsmasq # disable dnsmasq to avoid conflicts with NetworkManager's dnsmasq +nmcli con add type wifi ifname wlan0 mode ap con-name clover ssid $NEW_SSID autoconnect true \ +&& nmcli con modify clover 802-11-wireless.band bg \ +&& nmcli con modify clover ipv4.method shared ipv4.address 192.168.11.1/24 \ +&& nmcli con modify clover ipv6.method disabled \ +&& nmcli con modify clover wifi-sec.key-mgmt wpa-psk \ +&& nmcli con modify clover wifi-sec.psk "cloverwifi" \ +&& systemctl disable dnsmasq # disable dnsmasq to avoid conflicts with NetworkManager's dnsmasq NEW_HOSTNAME=$(echo ${NEW_SSID} | tr '[:upper:]' '[:lower:]') 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 +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 "--- Enable ROS services"