Skip to content

Commit 79d99f5

Browse files
skip raspi deps/config if not on raspi platform
1 parent f7e1293 commit 79d99f5

4 files changed

Lines changed: 55 additions & 21 deletions

File tree

backend

Submodule backend updated 63 files

scripts/pi-setup/install-pi-dependencies.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,16 @@ source "$SCRIPT_DIR/utils.sh"
2323

2424
print_start_of_script
2525

26+
if ! is_running_on_raspberry_pi; then
27+
if is_running_in_wsl; then
28+
print_script_step "Skipping Raspberry Pi dependencies (running in WSL)"
29+
else
30+
print_script_step "Skipping Raspberry Pi dependencies (not running on Raspberry Pi)"
31+
fi
32+
print_end_of_script
33+
exit 0
34+
fi
35+
2636
print_script_step "Silence user prompts about reboot and service restart required (script will prompt user to reboot in the end)"
2737
sudo sed -i "s/#\$nrconf{kernelhints} = -1;/\$nrconf{kernelhints} = -1;/g" /etc/needrestart/needrestart.conf
2838
sudo sed -i "s/#\$nrconf{restart} = 'i';/\$nrconf{restart} = 'a';/" /etc/needrestart/needrestart.conf

scripts/ubuntu/2-machine-cofiguration.sh

Lines changed: 33 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,11 @@ sudo groupadd docker
3333
sudo usermod -a -G docker $USER
3434
sudo service docker restart
3535

36-
# Setup Wifi
37-
print_script_step "Create System Service for wpa_suppliant"
38-
printf "\n Writing: /etc/systemd/system/dbus-fi.w1.wpa_supplicant1.service"
39-
cat << EOF | sudo tee /etc/systemd/system/dbus-fi.w1.wpa_supplicant1.service
36+
# Setup Wifi (Raspberry Pi only)
37+
if is_running_on_raspberry_pi; then
38+
print_script_step "Create System Service for wpa_suppliant"
39+
printf "\n Writing: /etc/systemd/system/dbus-fi.w1.wpa_supplicant1.service"
40+
cat << EOF | sudo tee /etc/systemd/system/dbus-fi.w1.wpa_supplicant1.service
4041
[Unit]
4142
Description=WPA supplicant
4243
Before=network.target
@@ -53,30 +54,42 @@ ExecStart=/sbin/wpa_supplicant -u -s -i $WLAN_INTERFACE -c /etc/wpa_supplicant/w
5354
WantedBy=multi-user.target
5455
Alias=dbus-fi.w1.wpa_supplicant1.service
5556
EOF
56-
sudo systemctl daemon-reload
57-
sudo systemctl enable dbus-fi.w1.wpa_supplicant1
58-
59-
WPA_SUPPLICANT_FILE=/etc/wpa_supplicant/wpa_supplicant.conf
60-
WPA_SUPPLICANT_SETTINGS=(
61-
"ctrl_interface=DIR=/run/wpa_supplicant"
62-
"update_config=1"
63-
)
64-
printf "\n Updating: $WPA_SUPPLICANT_FILE\n"
65-
sudo touch "$WPA_SUPPLICANT_FILE"
66-
for setting in ${WPA_SUPPLICANT_SETTINGS[@]}; do
67-
echo " setting: $setting"
68-
grep -qxF "$setting" "$WPA_SUPPLICANT_FILE" || echo "$setting" | sudo tee -a "$WPA_SUPPLICANT_FILE"
69-
done
57+
sudo systemctl daemon-reload
58+
sudo systemctl enable dbus-fi.w1.wpa_supplicant1
59+
60+
WPA_SUPPLICANT_FILE=/etc/wpa_supplicant/wpa_supplicant.conf
61+
WPA_SUPPLICANT_SETTINGS=(
62+
"ctrl_interface=DIR=/run/wpa_supplicant"
63+
"update_config=1"
64+
)
65+
printf "\n Updating: $WPA_SUPPLICANT_FILE\n"
66+
sudo touch "$WPA_SUPPLICANT_FILE"
67+
for setting in ${WPA_SUPPLICANT_SETTINGS[@]}; do
68+
echo " setting: $setting"
69+
grep -qxF "$setting" "$WPA_SUPPLICANT_FILE" || echo "$setting" | sudo tee -a "$WPA_SUPPLICANT_FILE"
70+
done
71+
elif is_running_in_wsl; then
72+
print_script_step "Skipping WiFi configuration (running in WSL)"
73+
else
74+
print_script_step "Skipping WiFi configuration (not running on Raspberry Pi)"
75+
fi
7076

7177
# Setup Network
7278
print_script_step "Accept Router Advertisements on network interfaces"
7379
SYSCTL_FILE=/etc/sysctl.conf
7480
SYSCTL_SETTINGS=(
7581
"net.ipv6.conf.eth0.accept_ra=2"
7682
"net.ipv6.conf.eth0.accept_ra_rt_info_max_plen=64"
77-
"net.ipv6.conf.$WLAN_INTERFACE.accept_ra=2"
78-
"net.ipv6.conf.$WLAN_INTERFACE.accept_ra_rt_info_max_plen=64"
7983
)
84+
85+
# WLAN sysctl settings are only relevant on Raspberry Pi
86+
if is_running_on_raspberry_pi; then
87+
SYSCTL_SETTINGS+=(
88+
"net.ipv6.conf.$WLAN_INTERFACE.accept_ra=2"
89+
"net.ipv6.conf.$WLAN_INTERFACE.accept_ra_rt_info_max_plen=64"
90+
)
91+
fi
92+
8093
printf "\n Updating: $SYSCTL_FILE\n"
8194
sudo touch "$SYSCTL_FILE"
8295
for setting in ${SYSCTL_SETTINGS[@]}; do

scripts/utils.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,3 +112,14 @@ check_installation_prerequisites()
112112
exit 1
113113
fi
114114
}
115+
116+
is_running_on_raspberry_pi()
117+
{
118+
[ -f /sys/firmware/devicetree/base/model ] && \
119+
grep -qi "raspberry pi" /sys/firmware/devicetree/base/model 2>/dev/null
120+
}
121+
122+
is_running_in_wsl()
123+
{
124+
grep -qi microsoft /proc/version 2>/dev/null
125+
}

0 commit comments

Comments
 (0)