Commit dcabc18e authored by Igor Pecovnik's avatar Igor Pecovnik
Browse files

Adding menu driven h3 display change, firmware update from menu

parent bcb2a070
......@@ -19,7 +19,7 @@ while true; do
LIST+=( "Networking" "Wired, Wireless, Bluetooth, Access point" )
LIST+=( "System" "General system settings" )
LIST+=( "Armbian" "Armbian specific: overlays, MOTD, loglevel" )
LIST+=( "About" "Information about this configuration tool" )
LIST+=( "Help" "Documentation, support, sources" )
# count number of menu items to adjust window sizee
LISTLENGHT="$((9+${#LIST[@]}/2))"
......@@ -30,8 +30,8 @@ while true; do
DIALOG_ESC=255
exec 3>&1
selection=$(dialog --backtitle "$BACKTITLE" --title " armbian-config " --clear \
--cancel-label "Exit to shell" --menu "\nConfiguration tool for the $BOARD_NAME running $DISTRO $DISTROID \n " $LISTLENGHT 70 $BOXLENGHT \
selection=$(dialog --colors --backtitle "$BACKTITLE" --title " armbian-config " --clear \
--cancel-label "Exit to shell" --menu "\nConfiguration tool for the \Z5${BOARD_NAME}\Z0 running \Z5$DISTRO $DISTROID\Z0 \n " $LISTLENGHT 70 $BOXLENGHT \
"${LIST[@]}" 2>&1 1>&3)
exit_status=$?
exec 3>&-
......@@ -52,8 +52,8 @@ while true; do
"Armbian" )
submenu_hardware
;;
"About" )
show_box "Info" "This tool provides a straightforward way of doing initial configuration of the ${BOARD_NAME}. Although it can be run at any time, some of the options may have difficulties if you have heavily customised your installation.\n\nSources: https://github.com/armbian/config\n\nSupport: https://forum.armbian.com" "15"
"Help" )
show_box "Info" "This tool provides a straightforward way of configuring the \Z2${BOARD_NAME}\Z0. \n \nAlthough it can be run at any time, some of the options may have difficulties if you alter system settings manually.\n\n\Z1Documentation:\Z0 https://docs.armbian.com\n\n\Z1Support:\Z0 https://forum.armbian.com\n\n\Z1Sources:\Z0 https://github.com/armbian/config" "18"
;;
esac
done
\ No newline at end of file
......@@ -111,8 +111,18 @@ function jobs ()
# Set the display resolution
#
"Display" )
h3disp
exit
# show display modes menu
get_h3modes
dialog --title " Display output type " --colors --help-button --help-label "Back" --no-label "DVI" --yes-label "HDMI" --backtitle "$BACKTITLE" --yesno "\nIn case you use an HDMI-to-DVI converter choose DVI!" 7 57
output_type=$?
if [[ $output_type = 0 || $output_type = 1 ]]; then
if [[ $output_type = 0 ]]; then display_cmd="h3disp -m $SCREEN_RESOLUTION"; else display_cmd="h3disp -m $SCREEN_RESOLUTION -d";fi
dialog --title " Display resolution " --colors --no-label "Back" --backtitle "$BACKTITLE" --yesno "\nSetting new screen mode.\n\nExecuting \Z1$display_cmd\Z0 and reboot? " 9 56
if [[ $? = 0 ]]; then
eval $display_cmd > /dev/null
reboot
fi
fi
;;
......@@ -424,6 +434,24 @@ function jobs ()
fi
;;
# Firmware update
#
"Firmware" )
clear
exec 3>&1
monitor=$(dialog --print-maxsize 2>&1 1>&3)
exec 3>&-
mon_x=$(echo $monitor | awk '{print $2}' | sed 's/,//');mon_x=$(( $mon_x / 2 ))
mon_y=$(echo $monitor | awk '{print $3}' | sed 's/,//');
dialog --title " Update " --backtitle "$BACKTITLE" --no-label "Cancel" --yesno "\nDo you want to update board firmware?" 7 41
if [[ $? = 0 ]]; then
debconf-apt-progress -- apt-get update
debconf-apt-progress -- apt-get -y upgrade
dialog --title " Firmware update " --colors --no-label "Back" --backtitle "$BACKTITLE" --yesno "\nFirmware has been updated. Reboot? " 7 39
if [[ $? = 0 ]]; then reboot; fi
fi
;;
# Install to SATA, eMMC, NAND or USB
#
......@@ -435,8 +463,7 @@ function jobs ()
# Freeze and unfreeze kernel and board support packages
#
"Hold" | "Unhold" )
dialog --title " Update " --backtitle "$BACKTITLE" --yes-label "$1" --no-label "Cancel" \
--yesno "\nDo you want to ${1,,} kernel updates?" 7 50
dialog --title " Update " --backtitle "$BACKTITLE" --yes-label "$1" --no-label "Cancel" --yesno "\nDo you want to ${1,,} kernel updates?" 7 50
if [[ $? = 0 ]]; then
TARGET_BRANCH=$BRANCH
exceptions "$BRANCH"
......
......@@ -111,7 +111,7 @@ exec 3>&-
#
function show_box ()
{
dialog --no-shadow --backtitle "$BACKTITLE" --no-collapse --title " $1 " --clear --msgbox "\n$2\n \n" $3 56
dialog --no-shadow --colors --backtitle "$BACKTITLE" --no-collapse --title " $1 " --clear --msgbox "\n$2\n \n" $3 56
}
......@@ -267,6 +267,33 @@ function aval_kernel ()
}
#-----------------------------------------------------------------------------------------------------------------------------------------#
# select video mode for h3
#
function get_h3modes ()
{
IFS=$'\r\n'
GLOBIGNORE='*'
SCREEN_RESOLUTION=($(h3disp -i))
local LIST=()
for i in "${SCREEN_RESOLUTION[@]}"
do
LIST+=( "${i[0]//[[:blank:]]/}" "" )
done
LIST_LENGHT=$((${#LIST[@]}/2));
#echo $LIST_LENGHT
#exit
if [ "$LIST_LENGHT" -eq 1 ]; then
SCREEN_RESOLUTION=${SCREEN_RESOLUTION[0]}
else
exec 3>&1
SCREEN_RESOLUTION=$(dialog --nocancel --backtitle "$BACKTITLE" --no-collapse \
--title "Select video mode" --clear --menu "" $((6+${LIST_LENGHT})) 25 $((1+${LIST_LENGHT})) "${LIST[@]}" 2>&1 1>&3)
exec 3>&-
fi
}
#-----------------------------------------------------------------------------------------------------------------------------------------#
# search for wlan interfaces and provide a selection menu if there are more than one
#
......@@ -506,9 +533,10 @@ while true; do
LIST=()
# check for display manager statuses
LIST+=( "Timezone" "Change timezone ($(date +%Z))" )
LIST+=( "Locales" "Reconfigure language ($(locale | grep LANGUAGE | cut -d= -f2 | cut -d_ -f1)) and character set" )
LIST+=( "Hostname" "Change your hostname ($(cat /etc/hostname))" )
LIST+=( "Timezone" "Change timezone \Z5($(date +%Z))\Z0" )
LIST+=( "Locales" "Reconfigure language \Z5($(locale | grep LANGUAGE | cut -d= -f2 | cut -d_ -f1))\Z0 and character set" )
LIST+=( "Hostname" "Change your hostname \Z5($(cat /etc/hostname))\Z0" )
LIST+=( "Firmware" "Upgrade board firmware" )
# check for display manager statuses
DISPLAY_MANAGER=""; DESKTOP_INSTALLED=""
[[ -n $(service lightdm status 2> /dev/null | grep -w active) ]] && DISPLAY_MANAGER="lightdm"
......@@ -553,7 +581,7 @@ while true; do
DIALOG_ESC=255
exec 3>&1
selection=$(dialog --backtitle "$BACKTITLE" --title " System settings " --clear \
selection=$(dialog --colors --backtitle "$BACKTITLE" --title " System settings " --clear \
--cancel-label "Back" --menu "$disclaimer" $LISTLENGHT 70 $BOXLENGHT \
"${LIST[@]}" 2>&1 1>&3)
exit_status=$?
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment