Skip to content

Commit

Permalink
Add a warning when tool runs with outdated BSP package
Browse files Browse the repository at this point in the history
  • Loading branch information
igorpecovnik committed Nov 13, 2024
1 parent 5d79990 commit 21138d9
Showing 1 changed file with 39 additions and 34 deletions.
73 changes: 39 additions & 34 deletions tools/modules/system/manage_dtoverlays.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,39 +14,44 @@ function manage_dtoverlays () {
# check if user agree to enter this area
local changes="false"
local overlayconf="/boot/armbianEnv.txt"
while true; do
local options=()
j=0
available_overlays=$(ls -1 ${OVERLAY_DIR}/*.dtbo | sed "s#^${OVERLAY_DIR}/##" | sed 's/.dtbo//g' | grep $BOOT_SOC | tr '\n' ' ')
for overlay in ${available_overlays}; do
local status="OFF"
grep '^fdt_overlays' ${overlayconf} | grep -qw ${overlay} && status=ON
options+=( "$overlay" "" "$status")
done
selection=$($DIALOG --title "Manage devicetree overlays" --cancel-button "Back" \
--ok-button "Save" --checklist "\nUse <space> to toggle functions and save them.\nExit when you are done.\n " \
0 0 0 "${options[@]}" 3>&1 1>&2 2>&3)
exit_status=$?
case $exit_status in
0)
changes="true"
newoverlays=$(echo $selection | sed 's/"//g')
sed -i "s/^fdt_overlays=.*/fdt_overlays=$newoverlays/" ${overlayconf}
if ! grep -q "^fdt_overlays" ${overlayconf}; then echo "fdt_overlays=$newoverlays" >> ${overlayconf}; fi
sync
;;
1)
if [[ "$changes" == "true" ]]; then
$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
if [[ $? = 0 ]]; then
reboot

if [[ -z "${OVERLAY_DIR}" ]]; then
show_message <<< "Error: OVERLAY folder not found.\n\nThis feature requires Armbian v24.11.1 or newer!"
else
while true; do
local options=()
j=0
available_overlays=$(ls -1 ${OVERLAY_DIR}/*.dtbo | sed "s#^${OVERLAY_DIR}/##" | sed 's/.dtbo//g' | grep $BOOT_SOC | tr '\n' ' ')
for overlay in ${available_overlays}; do
local status="OFF"
grep '^fdt_overlays' ${overlayconf} | grep -qw ${overlay} && status=ON
options+=( "$overlay" "" "$status")
done
selection=$($DIALOG --title "Manage devicetree overlays" --cancel-button "Back" \
--ok-button "Save" --checklist "\nUse <space> to toggle functions and save them.\nExit when you are done.\n " \
0 0 0 "${options[@]}" 3>&1 1>&2 2>&3)
exit_status=$?
case $exit_status in
0)
changes="true"
newoverlays=$(echo $selection | sed 's/"//g')
sed -i "s/^fdt_overlays=.*/fdt_overlays=$newoverlays/" ${overlayconf}
if ! grep -q "^fdt_overlays" ${overlayconf}; then echo "fdt_overlays=$newoverlays" >> ${overlayconf}; fi
sync
;;
1)
if [[ "$changes" == "true" ]]; then
$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
if [[ $? = 0 ]]; then
reboot
fi
fi
fi
break
;;
255)
;;
esac
done
break
;;
255)
;;
esac
done
fi
}

0 comments on commit 21138d9

Please sign in to comment.