Skip to content

Commit 2e92137

Browse files
authored
Merge pull request #851 from liamcottle/build-script-suffix
build script should check for firmware type suffix
2 parents f9b2613 + 58ed14d commit 2e92137

File tree

1 file changed

+23
-4
lines changed

1 file changed

+23
-4
lines changed

build.sh

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,17 @@ get_pio_envs_containing_string() {
2424
done
2525
}
2626

27+
# $1 should be the string to find (case insensitive)
28+
get_pio_envs_ending_with_string() {
29+
shopt -s nocasematch
30+
envs=($(get_pio_envs))
31+
for env in "${envs[@]}"; do
32+
if [[ "$env" == *${1} ]]; then
33+
echo $env
34+
fi
35+
done
36+
}
37+
2738
# build firmware for the provided pio env in $1
2839
build_firmware() {
2940

@@ -85,6 +96,14 @@ build_all_firmwares_matching() {
8596
done
8697
}
8798

99+
# firmwares ending with $1 will be built
100+
build_all_firmwares_by_suffix() {
101+
envs=($(get_pio_envs_ending_with_string "$1"))
102+
for env in "${envs[@]}"; do
103+
build_firmware $env
104+
done
105+
}
106+
88107
build_repeater_firmwares() {
89108

90109
# # build specific repeater firmwares
@@ -96,7 +115,7 @@ build_repeater_firmwares() {
96115
# build_firmware "RAK_4631_Repeater"
97116

98117
# build all repeater firmwares
99-
build_all_firmwares_matching "repeater"
118+
build_all_firmwares_by_suffix "_repeater"
100119

101120
}
102121

@@ -115,8 +134,8 @@ build_companion_firmwares() {
115134
# build_firmware "t1000e_companion_radio_ble"
116135

117136
# build all companion firmwares
118-
build_all_firmwares_matching "companion_radio_usb"
119-
build_all_firmwares_matching "companion_radio_ble"
137+
build_all_firmwares_by_suffix "_companion_radio_usb"
138+
build_all_firmwares_by_suffix "_companion_radio_ble"
120139

121140
}
122141

@@ -127,7 +146,7 @@ build_room_server_firmwares() {
127146
# build_firmware "RAK_4631_room_server"
128147

129148
# build all room server firmwares
130-
build_all_firmwares_matching "room_server"
149+
build_all_firmwares_by_suffix "_room_server"
131150

132151
}
133152

0 commit comments

Comments
 (0)