From fe28d912f37d5c3a24c7bbedfbbdba37ef83629f Mon Sep 17 00:00:00 2001 From: Geoff Clements Date: Mon, 2 Dec 2024 18:25:41 +0000 Subject: [PATCH 1/7] Add Odroid board selection --- tools/json/config.system.json | 10 +++++ tools/modules/system/manage_odroid_board.sh | 42 +++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 tools/modules/system/manage_odroid_board.sh diff --git a/tools/json/config.system.json b/tools/json/config.system.json index 675afc6d..42080686 100644 --- a/tools/json/config.system.json +++ b/tools/json/config.system.json @@ -332,6 +332,16 @@ "status": "Stable", "author": "@viraniac @igorpecovnik", "condition": "[ -d /boot/dtb/ ] && [ -f /boot/armbianEnv.txt ]" + }, + { + "id": "SYODD", + "description": "Select Odroid board configuration", + "command": [ + "manage_odroid_board" + ], + "status": "Preview", + "author": "", + "condition": "[ -f /etc/armbian-release ] && grep -q \"^BOARDFAMILY=odroidxu4\" /etc/armbian-release" } ] } diff --git a/tools/modules/system/manage_odroid_board.sh b/tools/modules/system/manage_odroid_board.sh new file mode 100644 index 00000000..ed5e3bd0 --- /dev/null +++ b/tools/modules/system/manage_odroid_board.sh @@ -0,0 +1,42 @@ +module_options+=( +["manage_odroid_board,author"]="" +["manage_odroid_board,ref_link"]="" +["manage_odroid_board,feature"]="Odroid board" +["manage_odroid_board,desc"]="Select optimised Odroid board configuration" +["manage_odroid_board,example"]="manage_odroid_board" +["manage_odroid_board,status"]="Preview" +) +# +# @description Select optimised board configuration +# +function manage_odroid_board() { + 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 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 + if [[ "${board_id[${board_num}]}" == "${current_board}" ]]; then + state=on + else + state=off + fi + list+=("${board_id[${board_num}]}" "${board_list[${board_num}]}" "${state}") + done + + target_board=$($DIALOG --notags --title "Select optimised board configuration" --radiolist "" 10 43 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 + + $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 +} From 0274058d9cadd67674bfe7989bce81ff6abcab59 Mon Sep 17 00:00:00 2001 From: Geoff Clements Date: Mon, 2 Dec 2024 18:40:04 +0000 Subject: [PATCH 2/7] Set status to review --- tools/modules/system/manage_odroid_board.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/modules/system/manage_odroid_board.sh b/tools/modules/system/manage_odroid_board.sh index ed5e3bd0..13238ef2 100644 --- a/tools/modules/system/manage_odroid_board.sh +++ b/tools/modules/system/manage_odroid_board.sh @@ -4,7 +4,7 @@ module_options+=( ["manage_odroid_board,feature"]="Odroid board" ["manage_odroid_board,desc"]="Select optimised Odroid board configuration" ["manage_odroid_board,example"]="manage_odroid_board" -["manage_odroid_board,status"]="Preview" +["manage_odroid_board,status"]="review" ) # # @description Select optimised board configuration @@ -28,7 +28,7 @@ function manage_odroid_board() { list+=("${board_id[${board_num}]}" "${board_list[${board_num}]}" "${state}") done - target_board=$($DIALOG --notags --title "Select optimised board configuration" --radiolist "" 10 43 4 "${list[@]}" 3>&1 1>&2 2>&3) + 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 || \ From 1a079f5436312ff05b02e942d1618df45b45af06 Mon Sep 17 00:00:00 2001 From: Geoff Clements Date: Tue, 3 Dec 2024 19:15:26 +0000 Subject: [PATCH 3/7] Add author, layout fixes. --- tools/json/config.system.json | 2 +- tools/modules/system/manage_odroid_board.sh | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/tools/json/config.system.json b/tools/json/config.system.json index 42080686..fae77c84 100644 --- a/tools/json/config.system.json +++ b/tools/json/config.system.json @@ -337,7 +337,7 @@ "id": "SYODD", "description": "Select Odroid board configuration", "command": [ - "manage_odroid_board" + "module_select_xuodroid" ], "status": "Preview", "author": "", diff --git a/tools/modules/system/manage_odroid_board.sh b/tools/modules/system/manage_odroid_board.sh index 13238ef2..96f08e73 100644 --- a/tools/modules/system/manage_odroid_board.sh +++ b/tools/modules/system/manage_odroid_board.sh @@ -1,16 +1,16 @@ module_options+=( -["manage_odroid_board,author"]="" -["manage_odroid_board,ref_link"]="" -["manage_odroid_board,feature"]="Odroid board" -["manage_odroid_board,desc"]="Select optimised Odroid board configuration" -["manage_odroid_board,example"]="manage_odroid_board" -["manage_odroid_board,status"]="review" + ["manage_odroid_board,author"]="Geoff Clements" + ["manage_odroid_board,ref_link"]="" + ["manage_odroid_board,feature"]="Odroid board" + ["manage_odroid_board,desc"]="Select optimised Odroid board configuration" + ["manage_odroid_board,example"]="module_select_xuodroid" + ["manage_odroid_board,status"]="review" ) # # @description Select optimised board configuration # -function manage_odroid_board() { - local board_list=("Odroid XU4" "Odroid XU3" "Odroid XU3 Lite" "Odroid HC1/HC2") +function module_select_xuodroid() { + 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 From 9a52aa569c8870970e6780be04139ab71dde824a Mon Sep 17 00:00:00 2001 From: Geoff Clements Date: Tue, 3 Dec 2024 19:29:35 +0000 Subject: [PATCH 4/7] Indentation fixes --- tools/modules/system/manage_odroid_board.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/modules/system/manage_odroid_board.sh b/tools/modules/system/manage_odroid_board.sh index 96f08e73..35996d9d 100644 --- a/tools/modules/system/manage_odroid_board.sh +++ b/tools/modules/system/manage_odroid_board.sh @@ -33,10 +33,10 @@ function module_select_xuodroid() { 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 + sed -i "s/^BOARD_NAME.*/BOARD_NAME=\"Odroid ${target_board^^}\"/" /etc/armbian-release $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 + --no-button "Cancel" --yesno "A reboot is required to apply the changes. Shall we reboot now?" 7 34 + [[ $? == 0 ]] && reboot fi } From d04e3734556dd2741d3216b9e884e25bda8f1850 Mon Sep 17 00:00:00 2001 From: Igor Pecovnik Date: Wed, 4 Dec 2024 23:49:02 +0100 Subject: [PATCH 5/7] Menu adjustement and simplified condition, spaces to tabs, name with GH name --- tools/json/config.system.json | 26 +++++++- tools/modules/system/manage_odroid_board.sh | 67 +++++++++++---------- 2 files changed, 57 insertions(+), 36 deletions(-) diff --git a/tools/json/config.system.json b/tools/json/config.system.json index fae77c84..a35b99ca 100644 --- a/tools/json/config.system.json +++ b/tools/json/config.system.json @@ -334,14 +334,34 @@ "condition": "[ -d /boot/dtb/ ] && [ -f /boot/armbianEnv.txt ]" }, { - "id": "SYODD", + "id": "SY018", + "description": "ZFS filesystem - enable support", + "command": [ + "module_zfs install" + ], + "status": "Stable", + "author": "@armbian", + "condition": "! module_zfs status && linux-version compare ${KERNELID} le $(module_zfs kernel_max)" + }, + { + "id": "SY019", + "description": "ZFS filesystem - remove support", + "command": [ + "module_zfs remove" + ], + "status": "Stable", + "author": "@armbian", + "condition": "module_zfs status" + }, + { + "id": "SY020", "description": "Select Odroid board configuration", "command": [ - "module_select_xuodroid" + "manage_odroid_board select" ], "status": "Preview", "author": "", - "condition": "[ -f /etc/armbian-release ] && grep -q \"^BOARDFAMILY=odroidxu4\" /etc/armbian-release" + "condition": "[ $BOARDFAMILY == odroidxu4 ]" } ] } diff --git a/tools/modules/system/manage_odroid_board.sh b/tools/modules/system/manage_odroid_board.sh index 35996d9d..288b8721 100644 --- a/tools/modules/system/manage_odroid_board.sh +++ b/tools/modules/system/manage_odroid_board.sh @@ -1,42 +1,43 @@ module_options+=( - ["manage_odroid_board,author"]="Geoff Clements" - ["manage_odroid_board,ref_link"]="" - ["manage_odroid_board,feature"]="Odroid board" - ["manage_odroid_board,desc"]="Select optimised Odroid board configuration" - ["manage_odroid_board,example"]="module_select_xuodroid" - ["manage_odroid_board,status"]="review" + ["manage_odroid_board,author"]="@GeoffClements" + ["manage_odroid_board,ref_link"]="" + ["manage_odroid_board,feature"]="Odroid board" + ["manage_odroid_board,desc"]="Select optimised Odroid board configuration" + ["manage_odroid_board,example"]="select" + ["manage_odroid_board,status"]="Stable" ) # # @description Select optimised board configuration # -function module_select_xuodroid() { - 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 +function manage_odroid_board() { - local env_file=/boot/armbianEnv.txt - local current_board=$(grep -oP '^board_name=\K.*' ${env_file}) - local target_board=${current_board} + 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 - for board_num in $(seq 0 $((${#board_list[@]} - 1))); do - if [[ "${board_id[${board_num}]}" == "${current_board}" ]]; then - state=on - else - state=off - fi - list+=("${board_id[${board_num}]}" "${board_list[${board_num}]}" "${state}") - done + local env_file=/boot/armbianEnv.txt + local current_board=$(grep -oP '^board_name=\K.*' ${env_file}) + local target_board=${current_board} - 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 - - $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 + for board_num in $(seq 0 $((${#board_list[@]} - 1))); do + if [[ "${board_id[${board_num}]}" == "${current_board}" ]]; then + state=on + else + state=off + fi + list+=("${board_id[${board_num}]}" "${board_list[${board_num}]}" "${state}") + done + + 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 + + $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 } From 08d42170689ca66ffb462b1e4cf0dffed86357e4 Mon Sep 17 00:00:00 2001 From: Igor Date: Wed, 4 Dec 2024 23:54:24 +0100 Subject: [PATCH 6/7] Update config.system.json --- tools/json/config.system.json | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/tools/json/config.system.json b/tools/json/config.system.json index 947a70fb..a35b99ca 100644 --- a/tools/json/config.system.json +++ b/tools/json/config.system.json @@ -281,11 +281,7 @@ "status": "Stable", "author": "@igorpecovnik", "condition": "[ -f /etc/default/armbian-motd ]" - },======= -366 ->>>>>>> main -367 - + }, { "id": "SY015", "description": "Install alternative kernels", From 76b4fb38fa9d7830c314701084af7f1ffefb4f90 Mon Sep 17 00:00:00 2001 From: Igor Pecovnik Date: Thu, 5 Dec 2024 07:27:50 +0100 Subject: [PATCH 7/7] Small cosmetic and code styling fixes --- tools/modules/system/manage_odroid_board.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tools/modules/system/manage_odroid_board.sh b/tools/modules/system/manage_odroid_board.sh index 288b8721..2d33568f 100644 --- a/tools/modules/system/manage_odroid_board.sh +++ b/tools/modules/system/manage_odroid_board.sh @@ -29,15 +29,16 @@ function manage_odroid_board() { list+=("${board_id[${board_num}]}" "${board_list[${board_num}]}" "${state}") done - target_board=$($DIALOG --notags --title "Select optimised board configuration" --radiolist "" 10 42 4 "${list[@]}" 3>&1 1>&2 2>&3) - if [[ $? == 0 ]]; then + if target_board=$($DIALOG --notags --title "Select optimised board configuration" \ + --radiolist "" 10 42 4 "${list[@]}" 3>&1 1>&2 2>&3); 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 - $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 + 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 fi }