Skip to content

Commit

Permalink
Disable exiting on error in init scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
okalachev committed May 8, 2024
1 parent 1e2f92f commit 1a9e689
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
2 changes: 0 additions & 2 deletions builder/assets/hardware_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@

# https://www.raspberrypi.com/documentation/computers/configuration.html

set -e # Exit immidiately on non-zero result

##################################################
# Configure hardware interfaces
##################################################
Expand Down
21 changes: 9 additions & 12 deletions builder/assets/init_rpi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 1a9e689

Please sign in to comment.