Skip to content

Commit

Permalink
Revert "Improved code style via shellcheck"
Browse files Browse the repository at this point in the history
This reverts commit 826b75d.
  • Loading branch information
GeoffClements committed Dec 4, 2024
1 parent baf6089 commit 076628a
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions tools/modules/system/manage_odroid_board.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ module_options+=(
# @description Select optimised board configuration
#
function module_select_xuodroid() {
local -r board_list=("Odroid XU4" "Odroid XU3" "Odroid XU3 Lite" "Odroid HC1/HC2")
local -r board_id=("xu4" "xu3" "xu3l" "hc1")
local -r env_file=/boot/armbianEnv.txt
local board_list=("Odroid XU4" "Odroid XU3" "Odroid XU3 Lite" "Odroid HC1/HC2")
local board_id=("xu4" "xu3" "xu3l" "hc1")
local -a list
local state
local current_board
current_board=$(grep -oP '^board_name=\K.*' ${env_file})

local env_file=/boot/armbianEnv.txt
local current_board=$(grep -oP '^board_name=\K.*' ${env_file})
local target_board=${current_board}

for board_num in $(seq 0 $((${#board_list[@]} - 1))); do
Expand All @@ -28,16 +28,15 @@ function module_select_xuodroid() {
list+=("${board_id[${board_num}]}" "${board_list[${board_num}]}" "${state}")
done

if target_board=$($DIALOG --notags --title "Select optimised board configuration" \
--radiolist "" 10 42 4 "${list[@]}" 3>&1 1>&2 2>&3); then
target_board=$($DIALOG --notags --title "Select optimised board configuration" --radiolist "" 10 42 4 "${list[@]}" 3>&1 1>&2 2>&3)
if [[ $? == 0 ]]; then
sed -i "s/^board_name=.*/board_name=${target_board}/" ${env_file} 2> /dev/null && \
grep -q "^board_name=${target_board}" ${env_file} 2>/dev/null || \
echo "board_name=${target_board}" >> ${env_file}
sed -i "s/^BOARD_NAME.*/BOARD_NAME=\"Odroid ${target_board^^}\"/" /etc/armbian-release

if $DIALOG --title " Reboot required " --yes-button "Reboot" --no-button "Cancel" --yesno \
"A reboot is required to apply the changes. Shall we reboot now?" 7 34; then
reboot
fi
$DIALOG --title " Reboot required " --yes-button "Reboot" \
--no-button "Cancel" --yesno "A reboot is required to apply the changes. Shall we reboot now?" 7 34
[[ $? == 0 ]] && reboot
fi
}

0 comments on commit 076628a

Please sign in to comment.