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

Rearange items here and there + bugfixing in network area

parent 930a40c7
......@@ -34,6 +34,8 @@ fi
source "$0""-submenu"
source "$0""-jobs"
#-----------------------------------------------------------------------------------------------------------------------------------------#
# Main menu
#
......@@ -41,25 +43,24 @@ while true
do
LIST=()
LIST+=( "System" "General system settings" )
LIST+=( "Networking" "Wired, Wireless, Bluetooth, Access point" )
LIST+=( "Armbian" "Armbian specific: overlays, MOTD, loglevel" )
LIST+=( "System" "System and security settings" )
LIST+=( "Network" "Wired, wireless, Bluetooth, access point" )
LIST+=( "Personal" "Timezone, language, hostname" )
LIST+=( "Software" "System and 3rd party software install" )
LIST+=( "Help" "Documentation, support, sources" )
# count number of menu items to adjust window size
LISTLENGHT="$((11+${#LIST[@]}/2))"
BOXLENGHT=${#LIST[@]}
MENUTITLE="Configuration tool "
[[ -n "${BOARD_NAME/ /}" ]] && MENUTITLE=$MENUTITLE"for the \Z1${BOARD_NAME}\Z0"
MENUTITLE=$MENUTITLE"running \Z1$DISTRO $DISTROID\Z0"
MENUTITLE="Configure $DISTRO $DISTROID based \Z1Armbian\Z0 "
[[ -n "${BOARD_NAME/ /}" ]] && MENUTITLE=$MENUTITLE"for the \Z1${BOARD_NAME}\Z0 "
# main dialog routine
DIALOG_CANCEL=1
DIALOG_ESC=255
TITLELENGHT=${#MENUTITLE}
[[ "$TITLELENGHT" -lt 50 ]] && TITLELENGHT="70"
[[ "$TITLELENGHT" -lt 50 ]] && TITLELENGHT="50"
exec 3>&1
selection=$(dialog --colors --backtitle "$BACKTITLE" --title " armbian-config " --clear \
......@@ -74,18 +75,22 @@ do
case $selection in
"Software" )
submenu_software
"System" )
submenu_settings
;;
"Networking" )
"Network" )
submenu_networking
;;
"System" )
submenu_settings
"Personal" )
submenu_personal
;;
"Armbian" )
submenu_hardware
"Software" )
submenu_software
;;
"Help" )
show_box "Info" "This tool provides a straightforward way of configuring the \Z4${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\
......
......@@ -26,7 +26,7 @@ function jobs ()
# Remove BT
#
"Remove BT" )
"BT remove" )
debconf-apt-progress -- apt-get -y remove bluetooth bluez bluez-tools
check_if_installed xserver-xorg && debconf-apt-progress -- apt-get -y remove pulseaudio-module-bluetooth blueman
debconf-apt-progress -- apt -y -qq autoremove
......@@ -34,7 +34,7 @@ function jobs ()
# Enabling BT
#
"Bluetooth" )
"BT install" )
debconf-apt-progress -- apt-get -y install bluetooth bluez bluez-tools
check_if_installed xserver-xorg && debconf-apt-progress -- apt-get -y --no-install-recommends install pulseaudio-module-bluetooth blueman
;;
......@@ -146,7 +146,7 @@ function jobs ()
if [[ -f /usr/bin/h3disp ]]; then
# h3 boards
get_h3modes
dialog --title " Display output type " --colors --help-button --help-label "Back" --no-label "DVI" --yes-label "HDMI" \
dialog --title " Display output type " --colors --help-button --help-label "Cancel" --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
......@@ -164,7 +164,7 @@ function jobs ()
display_cmd="sed -i \"s/^disp_mode=.*/disp_mode=$SCREEN_RESOLUTION/\" /boot/armbianEnv.txt";
fi
dialog --title " Display resolution " --colors --no-label "Back" --backtitle "$BACKTITLE" --yesno \
dialog --title " Display resolution " --colors --no-label "Cancel" --backtitle "$BACKTITLE" --yesno \
"\nSwitching to \Z1$SCREEN_RESOLUTION\Z0 and reboot?" 7 42
if [[ $? = 0 ]]; then
eval $display_cmd > /dev/null
......@@ -239,12 +239,12 @@ function jobs ()
if [[ -n $(service hostapd status | grep -w active | grep -w running) ]]; then
if [[ -n $HOSTAPDBRIDGE ]]; then
dialog --title " Hostapd service is running " --colors --backtitle "$BACKTITLE" --help-button \
--help-label "Back" --yes-label "Stop and reboot" --no-label "Edit" --yesno \
--help-label "Cancel" --yes-label "Stop and reboot" --no-label "Edit" --yesno \
"\n\Z1Stop:\Z0 stop and reboot\n\n\Z1Edit:\Z0 change basic parameters: SSID, password and channel" 9 70
else
dialog --title " Hostapd service is running " --colors --backtitle "$BACKTITLE" --help-button \
--help-label "Back" --yes-label "Stop" --no-label "Edit" --yesno \
--help-label "Cancel" --yes-label "Stop" --no-label "Edit" --yesno \
"\n\Z1Stop:\Z0 stop providing Access Point\n\n\Z1Edit:\Z0 change basic parameters: SSID, password and channel" 9 70
fi
exitstatus=$?;
......@@ -282,7 +282,7 @@ function jobs ()
if grep -q "^## IEEE 802.11n" /etc/hostapd.conf; then sed '/## IEEE 802.11n/,/^## IEEE 802.11n/ s/.*/#&/' -i /etc/hostapd.conf; fi
sed -i "s/^channel=.*/channel=5/" /etc/hostapd.conf
service network-manager restart; sleep 3
service network-manager reload
# change special adapters to AP mode
wlan_exceptions "on"
# check for WLAN interfaces
......@@ -295,7 +295,7 @@ function jobs ()
echo "[keyfile]" > /etc/NetworkManager/conf.d/10-ignore-interfaces.conf
echo "unmanaged-devices=interface-name:$WIRELESS_ADAPTER" >> /etc/NetworkManager/conf.d/10-ignore-interfaces.conf
fi
service network-manager restart; sleep 3
service network-manager reload
# display dialog
dialog --colors --backtitle "$BACKTITLE" --title "Please wait" --infobox \
"\nWireless adapter: \Z1${WIRELESS_ADAPTER}\Z0\n\nProbing nl80211 hostapd driver compatibility." 7 50
......@@ -490,7 +490,7 @@ function jobs ()
${VPNDIR}vpncmd /client localhost /cmd niccreate se >/dev/null 2>&1
fi
if [[ -z $(${VPNDIR}vpncmd /client localhost /cmd accountlist | grep "VPN Server") ]]; then
dialog --backtitle "$BACKTITLE" --no-label " Back " --yes-label " Import " --title " VPN " --yesno "\nVPN configuration was not found.\n\nPlace file to /etc/server.vpn" 9 45
dialog --backtitle "$BACKTITLE" --no-label " Cancel " --yes-label " Import " --title " VPN " --yesno "\nVPN configuration was not found.\n\nPlace file to /etc/server.vpn" 9 45
if [[ $? = 0 && -f /etc/server.vpn ]]; then
${VPNDIR}vpncmd /client localhost /cmd accountimport //etc//server.vpn >/dev/null 2>&1
${VPNDIR}vpnclient stop >/dev/null 2>&1
......@@ -508,7 +508,7 @@ function jobs ()
echo "ip route del default"
echo "ip route add default via $GW dev vpn_se"
read
dialog --title "VPN client is connected to $VPNSERVERIP" --colors --backtitle "$BACKTITLE" --help-button --help-label "Back" --yes-label "Stop" --no-label " Import " --yesno "\n\Z1Stop: \Z0 stop\n\n\Z1Import:\Z0 import new config from /etc/armbian.vpn" 9 70
dialog --title "VPN client is connected to $VPNSERVERIP" --colors --backtitle "$BACKTITLE" --help-button --help-label "Cancel" --yes-label "Stop" --no-label " Import " --yesno "\n\Z1Stop: \Z0 stop\n\n\Z1Import:\Z0 import new config from /etc/armbian.vpn" 9 70
fi
response=$?
if [[ $response = 0 ]]; then
......@@ -521,7 +521,7 @@ function jobs ()
${VPNDIR}vpnclient stop >/dev/null 2>&1
fi
else
dialog --title "VPN client is disconnected" --colors --backtitle "$BACKTITLE" --help-button --help-label "Back" --yes-label "Connect" --no-label " Import " --yesno "\n\Z1Connect:\Z0 Connect with your VPN server \n\n\Z1Import:\Z0 import new config from /etc/armbian.vpn" 9 70
dialog --title "VPN client is disconnected" --colors --backtitle "$BACKTITLE" --help-button --help-label "Cancel" --yes-label "Connect" --no-label " Import " --yesno "\n\Z1Connect:\Z0 Connect with your VPN server \n\n\Z1Import:\Z0 import new config from /etc/armbian.vpn" 9 70
response=$?
if [[ $response = 0 ]]; then
${VPNDIR}vpnclient start >/dev/null 2>&1
......@@ -542,7 +542,7 @@ function jobs ()
# Connect to Bluetooth
#
"Discover" )
"BT discover" )
dialog --backtitle "$BACKTITLE" --title " Bluetooth " --msgbox "\nMake sure your Bluetooth devices are discoverable!" 7 54
connect_bt_interface
;;
......@@ -617,7 +617,7 @@ function jobs ()
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 \
dialog --title " Firmware update " --colors --no-label "Cancel" --backtitle "$BACKTITLE" --yesno \
"\nFirmware has been updated. Reboot? " 7 39
if [[ $? = 0 ]]; then reboot; fi
fi
......@@ -634,7 +634,7 @@ function jobs ()
# Freeze and unfreeze kernel and board support packages
#
"Freeze" | "Defreeze" )
dialog --title " Updating " --backtitle "$BACKTITLE" --yes-label "$1" --no-label "Back" --yesno \
dialog --title " Updating " --backtitle "$BACKTITLE" --yes-label "$1" --no-label "Cancel" --yesno \
"\nDo you want to ${1,,} kernel updates?" 7 44
if [[ $? = 0 ]]; then
TARGET_BRANCH=$BRANCH
......@@ -656,12 +656,12 @@ function jobs ()
"Desktop" )
if [[ -n $(service lightdm status 2> /dev/null | grep -w active | grep -w running) || -n $(service nodm status | grep -w active | grep -w running) ]]; then
dialog --title " Desktop is enabled and running " --backtitle "$BACKTITLE" \
--yes-label "Stop" --no-label "Back" --yesno "\nDo you want to stop and disable this service?" 7 50
--yes-label "Stop" --no-label "Cancel" --yesno "\nDo you want to stop and disable this service?" 7 50
exitstatus=$?;
[[ $exitstatus = 0 ]] && service nodm stop && service lightdm stop && \
sed -i "s/^NODM_ENABLED=.*/NODM_ENABLED=false/" /etc/default/nodm
else
dialog --colors --title " Choose a display manager " --backtitle "$BACKTITLE" --help-button --help-label "Back" --yes-label "Lightdm" \
dialog --colors --title " Choose a display manager " --backtitle "$BACKTITLE" --help-button --help-label "Cancel" --yes-label "Lightdm" \
--no-label "Nodm" --yesno "\n\Z1Lightdm\Z0 = full featured login display manager\n\Z1Nodm\Z0 = autoloading into desktop" 8 70
exitstatus=$?;
[[ $exitstatus = 0 ]] && [[ -f /etc/X11/default-display-manager ]] && \
......@@ -746,7 +746,7 @@ function jobs ()
# Toggle overlay items
#
"Overlays" )
"Hardware" )
# check if user agree to enter this area
CHANGES="false"
while true; do
......@@ -773,7 +773,7 @@ function jobs ()
exec 3>&1
selection=$(dialog --backtitle "$BACKTITLE" --title "Toggle hardware config" --clear --cancel-label \
"Back" --ok-label "Save" --checklist "\nChoose what you want to enable or disable:\n " \
"Cancel" --ok-label "Save" --checklist "\nChoose what you want to enable or disable:\n " \
$LISTLENGHT 70 $LISTLENGHT "${MOTD[@]}" 2>&1 1>&3)
exit_status=$?
exec 3>&-
......@@ -825,7 +825,7 @@ function jobs ()
dialog --backtitle "$BACKTITLE" --title "Please wait" --colors --msgbox "\nThere are no mirrors available!" 7 35
else
exec 3>&1
TARGET_MIRROR=$(dialog --cancel-label "Back" --backtitle "$BACKTITLE" --no-collapse \
TARGET_MIRROR=$(dialog --cancel-label "Cancel" --backtitle "$BACKTITLE" --no-collapse \
--title "Change repository location" --colors --clear --menu "\nfrom \Z1$BEFORE\Z0 to:\n " $((6+${LIST_LENGHT})) 60 15 "${LIST[@]}" 2>&1 1>&3)
exitstatus=$?;
exec 3>&-
......@@ -904,7 +904,7 @@ function jobs ()
exec 3>&1
selection=$(dialog --backtitle "$BACKTITLE" --title " Toggle sshd options " --clear --cancel-label \
"Back" --ok-label "Save" --checklist "\nChoose what you want to enable or disable:\n " \
"Cancel" --ok-label "Save" --checklist "\nChoose what you want to enable or disable:\n " \
$LISTLENGHT 74 21 "${MOTD[@]}" 2>&1 1>&3)
exit_status=$?
exec 3>&-
......@@ -936,7 +936,7 @@ function jobs ()
# Switch to daily builds
#
"Nightly" )
dialog --title " Warning " --backtitle "$BACKTITLE" --yes-label "OK" --no-label "Back" \
dialog --colors --title " \Z1Warning\Z0 " --backtitle "$BACKTITLE" --yes-label "OK" --no-label "Cancel" \
--yesno "\nYou are switching to automated nightly repository which is untested and might break your system.\
Are you fine with that?" 9 48
if [[ $? = 0 ]]; then
......@@ -944,7 +944,7 @@ function jobs ()
debconf-apt-progress -- apt-get update
debconf-apt-progress -- apt-get -y upgrade
dialog --title "Switching to nightly" --backtitle "$BACKTITLE" --yes-label "Reboot" \
--no-label "Back" --yesno "\nReboot to apply new settings?" 7 34
--no-label "Cancel" --yesno "\nReboot to apply new settings?" 7 34
if [[ $? = 0 ]]; then reboot; fi
fi
;;
......@@ -953,13 +953,13 @@ function jobs ()
# Switch to stable builds
#
"Stable" )
dialog --title " Warning " --backtitle "$BACKTITLE" --yes-label "OK" --no-label "Back" \
dialog --colors --title " \Z1Warning\Z0 " --backtitle "$BACKTITLE" --yes-label "OK" --no-label "Cancel" \
--yesno "\nYou are switching back to stable respository where you are going to get future updates. Are you fine with that?" 9 44
if [[ $? = 0 ]]; then
sed -i 's/beta.armbian.com/apt.armbian.com/' /etc/apt/sources.list.d/armbian.list
debconf-apt-progress -- apt-get update
debconf-apt-progress -- apt-get -y upgrade
dialog --title "Switching to stable" --backtitle "$BACKTITLE" --yes-label "Reboot" --no-label "Back" --yesno \
dialog --title "Switching to stable" --backtitle "$BACKTITLE" --yes-label "Reboot" --no-label "Cancel" --yesno \
"\nReboot to apply new settings?" 7 34
if [[ $? = 0 ]]; then reboot; fi
fi
......@@ -972,7 +972,7 @@ function jobs ()
aval_kernel
if [[ $exitstatus = 0 ]]; then
exceptions "$INSTALL_KERNEL"
dialog --title " Install and reboot " --colors --backtitle "$BACKTITLE" --yes-label "OK" --no-label "Back" \
dialog --title " Install and reboot " --colors --backtitle "$BACKTITLE" --yes-label "OK" --no-label "Cancel" \
--yesno "\nSwitching to \Z1linux-image${TARGET_BRANCH}-${TARGET_FAMILY}\Z0 \n\nMake sure you know what you are doing! \
\n\nBoard config will be reverted to defaults." 11 46
if [[ $? = 0 ]]; then
......
......@@ -7,27 +7,6 @@
# warranty of any kind, whether express or implied.
DIALOG_CANCEL=1
DIALOG_ESC=255
#-----------------------------------------------------------------------------------------------------------------------------------------#
# gather info about the board and start with loading menu
#
[[ -f /etc/armbian-release ]] && source /etc/armbian-release && ARMBIAN="Armbian $VERSION $IMAGE_TYPE";
DISTRO=$(lsb_release -is)
DISTROID=$(lsb_release -sc)
KERNELID=$(uname -r)
[[ -z "${ARMBIAN// }" ]] && ARMBIAN=$KERNELID
BACKTITLE="Configuration utility, $ARMBIAN, https://www.armbian.com"
TITLE="$BOARD_NAME "
DEFAULT_ADAPTER=$(ip -4 route ls | grep default | grep -Po '(?<=dev )(\S+)')
[[ -z "${DEFAULT_ADAPTER// }" ]] && DEFAULT_ADAPTER="lo"
dialog --backtitle "$BACKTITLE" --title "Please wait" --infobox "\nLoading Armbian configuration utility ... " 5 45
sleep 1
check_if_installed (){
#------------------------------------------------------------------------------------------------------------------------------------------
# check dpkg status of $1 -- currently only 'not installed at all' case catched
......@@ -349,7 +328,7 @@ function aval_kernel ()
TARGET_BRANCH=${AVAL_KERNEL[0]}
else
exec 3>&1
TARGET_BRANCH=$(dialog --cancel-label "Back" --backtitle "$BACKTITLE" --no-collapse \
TARGET_BRANCH=$(dialog --cancel-label "Cancel" --backtitle "$BACKTITLE" --no-collapse \
--title "Upgrade from $BRANCH to:" --clear --menu "" $((6+${LIST_LENGHT})) 40 15 "${LIST[@]}" 2>&1 1>&3)
exitstatus=$?;
exec 3>&-
......@@ -418,8 +397,8 @@ function get_wlan_interface ()
{
IFS=$'\r\n'
GLOBIGNORE='*'
WLAN_INTERFACES=($(nmcli dev status | grep wifi | grep disconnected |awk '{print $1}'))
WLAN_INTERFACES=($(nmcli --wait 10 dev status | grep wifi | grep disconnected |awk '{print $1}'))
local LIST=()
for i in "${WLAN_INTERFACES[@]}"
do
......@@ -432,7 +411,7 @@ function get_wlan_interface ()
else
exec 3>&1
WIRELESS_ADAPTER=$(dialog --nocancel --backtitle "$BACKTITLE" --no-collapse \
--title "Select interface" --clear --menu "" $((6+${LIST_LENGHT})) 30 15 "${LIST[@]}" 2>&1 1>&3)
--title "Select interface" --clear --menu "" $((6+${LIST_LENGHT})) 40 15 "${LIST[@]}" 2>&1 1>&3)
exec 3>&-
fi
}
......@@ -459,7 +438,7 @@ function select_default_interface ()
else
exec 3>&1
DEFAULT_ADAPTER=$(dialog --nocancel --backtitle "$BACKTITLE" --no-collapse \
--title "Select default interface" --clear --menu "" $((6+${LIST_LENGHT})) 30 15 "${LIST[@]}" 2>&1 1>&3)
--title "Select default interface" --clear --menu "" $((6+${LIST_LENGHT})) 40 15 "${LIST[@]}" 2>&1 1>&3)
exec 3>&-
fi
}
......@@ -511,6 +490,12 @@ function connect_bt_interface ()
}
#-----------------------------------------------------------------------------------------------------------------------------------------#
# system
#
......@@ -520,18 +505,35 @@ while true; do
LIST=()
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" )
[[ $(sed -n 's/^DEVNAME=//p' /sys/dev/block/$(mountpoint -d /)/uevent 2> /dev/null) == mmcblk* && -f /usr/sbin/nand-sata-install ]] \
&& LIST+=( "Install" "Install to SATA, eMMC, NAND or USB" )
if [[ -n $(apt-mark showhold | grep -w "$BOARD") ]]; then
LIST+=( "Defreeze" "Defreeze firmware - enable kernel upgrade" )
else
LIST+=( "Freeze" "Freeze firmware - disable kernel upgrade" )
fi
if [[ -z $(apt-mark showhold | grep -w "$BOARD") ]]; then
[[ -f /etc/apt/sources.list.d/armbian.list ]] && [[ -n $(grep -w apt /etc/apt/sources.list.d/armbian.list) ]] \
&& LIST+=( "Nightly" "Switch to nightly automated builds" )
[[ -f /etc/apt/sources.list.d/armbian.list ]] && [[ -n $(grep -w beta /etc/apt/sources.list.d/armbian.list) ]] \
&& LIST+=( "Stable" "Switch to stable builds" )
fi
[[ -n $(grep -w "#kernel.printk" /etc/sysctl.conf ) ]] && LIST+=( "Lowlevel" "Stop low-level messages on console" )
[[ -f /boot/armbianEnv.txt ]] && LIST+=( "Bootenv" "Edit boot environment" )
[[ -f /boot/boot.ini ]] && LIST+=( "Bootscript" "Edit boot script" )
[[ -d /boot/dtb/overlay && $LINUXFAMILY == sun*i && $BRANCH != default ]] && \
LIST+=( "Hardware" "Toggle hardware configuration: UART, I2C, etc." )
[[ -f /usr/bin/bin2fex && "$LINUXFAMILY" = sun*i && "$BRANCH" = "default" ]] && LIST+=( "Fexedit" "Board (fex) settings editor" )
[[ $(apt-cache search --names-only '^linux-'$(lsb_release -cs)'-root.*.'$BOARD'' | sed 's/.*(\(.*\))/\1/' | awk '{print $1}' \
| wc -l) -gt 1 ]] && LIST+=( "Switch" "Switch to alternative kernels" )
LIST+=( "SSH" "Reconfigure SSH daemon" )
LIST+=( "Firmware" "Upgrade board firmware" )
[[ "$LINUXFAMILY" = sun*i && "$BRANCH" = "default" && \
-n $(bin2fex </boot/script.bin 2>/dev/null | grep -w "hdmi_used = 1") ]] && LIST+=( "Display" "set the display resolution" )
# detect desktop
DISPLAY_MANAGER=""; DESKTOP_INSTALLED=""
if [ $(dpkg-query -W -f='${db:Status-Abbrev}\n' nodm 2>/dev/null) <> "*ii*" ]; then DESKTOP_INSTALLED="nodm"; fi
if [ $(dpkg-query -W -f='${db:Status-Abbrev}\n' lightdm 2>/dev/null) <> "*ii*" ]; then DESKTOP_INSTALLED="lightdm"; fi
[[ -n $(service lightdm status 2> /dev/null | grep -w active) ]] && DISPLAY_MANAGER="lightdm"
[[ -n $(service nodm status 2> /dev/null | grep -w active) ]] && DISPLAY_MANAGER="nodm"
if [[ -n $DISPLAY_MANAGER ]]; then
LIST+=( "Desktop" "Disable desktop" )
......@@ -541,13 +543,7 @@ while true; do
LIST+=( "Desktop" "Enable desktop" )
fi
if [[ -n $DISPLAY_MANAGER ]]; then
if [[ $(service xrdp status 2> /dev/null | grep -w active) ]]; then
LIST+=( "RDP" "Disable remote desktop access from Windows" )
else
LIST+=( "RDP" "Enable remote desktop access from Windows" )
fi
fi
LIST+=( "Services" "Toggle running services" )
if [[ "$DISTRO" == "Ubuntu" && "$(modinfo overlay > /dev/null 2>&1; echo $?)" == "0" ]]; then
if [ -n "$(mount | grep -w tmpfs-root)" ]; then
......@@ -563,7 +559,7 @@ while true; do
exec 3>&1
selection=$(dialog --colors --backtitle "$BACKTITLE" --title " System settings " --clear \
--cancel-label "Back" --menu "$disclaimer" $LISTLENGHT 70 $BOXLENGHT \
--cancel-label "Cancel" --menu "$disclaimer" $LISTLENGHT 70 $BOXLENGHT \
"${LIST[@]}" 2>&1 1>&3)
exit_status=$?
exec 3>&-
......@@ -613,11 +609,18 @@ while true; do
else
LIST+=( "Clear" "Clear possible blocked interfaces" )
fi
if [[ -n $(service bluetooth status | grep -w active | grep -w running) ]]; then
[[ $(hcitool dev | sed '1d') != "" ]] && LIST+=( "Discover" "Discover and connect Bluetooth devices" )
check_if_installed lirc && LIST+=( "Remove IR" "Remove IR support" ) || LIST+=( "IR" "Install IR support" )
if check_if_installed bluetooth then ; then
LIST+=( "BT remove" "Remove Bluetooth support" )
if [[ -n $(service bluetooth status | grep -w active | grep -w running) ]]; then
[[ $(hcitool dev | sed '1d') != "" ]] && LIST+=( "BT discover" "Discover and connect Bluetooth devices" )
fi
else
LIST+=( "BT install" "Install Bluetooth support" )
fi
[[ -d /usr/local/vpnclient ]] && LIST+=( "VPN" "Manage Softether VPN client" ) && VPNSERVERIP=$(/usr/local/vpnclient/vpncmd /client localhost /cmd accountlist | grep "VPN Server" |grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}' | head -1)
LIST+=( "Advanced" "Edit /etc/network/interfaces" )
......@@ -670,7 +673,7 @@ while true; do
exec 3>&1
selection=$(dialog --backtitle "$BACKTITLE" --colors --title " Wired, Wireless, Bluetooth, Hotspot " --clear \
--cancel-label "Back" --menu "${disclaimer}" $LISTLENGHT 70 $BOXLENGHT \
--cancel-label "Cancel" --menu "${disclaimer}" $LISTLENGHT 70 $BOXLENGHT \
"${LIST[@]}" 2>&1 1>&3)
exit_status=$?
exec 3>&-
......@@ -678,49 +681,32 @@ while true; do
# run main function
jobs "$selection"
done
}
#-----------------------------------------------------------------------------------------------------------------------------------------#
# armbian
# personal
#
function submenu_hardware ()
function submenu_personal ()
{
while true; do
LIST=()
[[ $(sed -n 's/^DEVNAME=//p' /sys/dev/block/$(mountpoint -d /)/uevent 2> /dev/null) == mmcblk* && -f /usr/sbin/nand-sata-install ]] \
&& LIST+=( "Install" "Install to SATA, eMMC, NAND or USB" )
if [[ -n $(apt-mark showhold | grep -w "$BOARD") ]]; then
LIST+=( "Defreeze" "Defreeze firmware upgrade" )
else
LIST+=( "Freeze" "Freeze firmware upgrade" )
fi
[[ -n $(grep -w "#kernel.printk" /etc/sysctl.conf ) ]] && LIST+=( "Lowlevel" "Stop low-level messages on console" )
[[ -f /boot/armbianEnv.txt ]] && LIST+=( "Bootenv" "Edit boot environment" )
[[ -f /boot/boot.ini ]] && LIST+=( "Bootscript" "Edit boot script" )
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" )
[[ -f /etc/apt/sources.list.d/armbian.list ]] && LIST+=( "Mirror" "Change repository server" )
LIST+=( "Welcome" "Toggle welcome screen items" )
if [[ -z $(apt-mark showhold | grep -w "$BOARD") ]]; then
[[ -f /etc/apt/sources.list.d/armbian.list ]] && [[ -n $(grep -w apt /etc/apt/sources.list.d/armbian.list) ]] \
&& LIST+=( "Nightly" "Switch to nightly builds" )
[[ -f /etc/apt/sources.list.d/armbian.list ]] && [[ -n $(grep -w beta /etc/apt/sources.list.d/armbian.list) ]] \
&& LIST+=( "Stable" "Switch to stable builds" )
fi
[[ -d /boot/dtb/overlay && $LINUXFAMILY == sun*i && $BRANCH != default ]] && \
LIST+=( "Overlays" "Toggle board functions: UART, I2C, SPI, ..." )
[[ $(apt-cache search --names-only '^linux-'$(lsb_release -cs)'-root.*.'$BOARD'' | sed 's/.*(\(.*\))/\1/' | awk '{print $1}' \
| wc -l) -gt 1 ]] && LIST+=( "Switch" "Switch to alternative kernels" )
# count number of menu items to adjust window sizee
LISTLENGHT="$((6+${#LIST[@]}/2))"
BOXLENGHT=${#LIST[@]}
exec 3>&1
selection=$(dialog --backtitle "$BACKTITLE" --title " Armbian specific settings " --clear \
--cancel-label "Back" --menu "$disclaimer" $LISTLENGHT 70 $BOXLENGHT \
selection=$(dialog --colors --backtitle "$BACKTITLE" --title "Personal settings" --clear \
--cancel-label "Cancel" --menu "$disclaimer" $LISTLENGHT 70 $BOXLENGHT \
"${LIST[@]}" 2>&1 1>&3)
exit_status=$?
exec 3>&-
......@@ -744,18 +730,18 @@ while true; do
[[ -f /usr/bin/softy ]] && LIST+=( "Softy" "3rd party applications installer" )
[[ -f /usr/bin/h3consumption && "$LINUXFAMILY" = "sun8i" && "$BRANCH" = "default" ]] && \
LIST+=( "Consumption" "Control board consumption" )
check_if_installed bluetooth && LIST+=( "Remove BT" "Remove Bluetooth support" ) || LIST+=( "Bluetooth" "Install Bluetooth support" )
check_if_installed lirc && LIST+=( "Remove IR" "Remove IR support" ) || LIST+=( "IR" "Install IR support" )
[[ -f /usr/bin/armbianmonitor ]] && LIST+=( "Monitor" "Simple CLI board monitoring" )
[[ -f /usr/bin/armbianmonitor ]] && LIST+=( "Diagnostics" "Send diagnostics" )
[[ -f /usr/bin/bin2fex && "$LINUXFAMILY" = sun*i && "$BRANCH" = "default" ]] && LIST+=( "Fexedit" "Board (fex) settings editor" )
if [[ -n $(dpkg -l | grep linux-headers) ]]; then LIST+=( "Headers" "Remove kernel headers" ); else \
LIST+=( "Headers" "Install kernel headers" ); fi
[[ "$LINUXFAMILY" = sun*i && "$BRANCH" = "default" && \
-n $(bin2fex </boot/script.bin 2>/dev/null | grep -w "hdmi_used = 1") ]] && LIST+=( "Display" "set the display resolution" )
if [[ -n $DISPLAY_MANAGER ]]; then
if [[ $(service xrdp status 2> /dev/null | grep -w active) ]]; then
LIST+=( "RDP" "Disable remote desktop access from Windows" )
else
LIST+=( "RDP" "Enable remote desktop access from Windows" )
fi
fi
# count number of menu items to adjust window sizee
LISTLENGHT="$((6+${#LIST[@]}/2))"
......@@ -763,7 +749,7 @@ while true; do
exec 3>&1
selection=$(dialog --backtitle "$BACKTITLE" --title "System and 3rd party software" --clear \
--cancel-label "Back" --menu "$disclaimer" $LISTLENGHT 70 $BOXLENGHT \
--cancel-label "Cancel" --menu "$disclaimer" $LISTLENGHT 70 $BOXLENGHT \
"${LIST[@]}" 2>&1 1>&3)
exit_status=$?
exec 3>&-
......@@ -771,5 +757,34 @@ while true; do
# run main function
jobs "$selection"
done
}
DIALOG_CANCEL=1
DIALOG_ESC=255
#-----------------------------------------------------------------------------------------------------------------------------------------#
# gather info about the board and start with loading menu
#
[[ -f /etc/armbian-release ]] && source /etc/armbian-release && ARMBIAN="Armbian $VERSION $IMAGE_TYPE";
DISTRO=$(lsb_release -is)
DISTROID=$(lsb_release -sc)
KERNELID=$(uname -r)
[[ -z "${ARMBIAN// }" ]] && ARMBIAN=$KERNELID
BACKTITLE="Configuration utility, $ARMBIAN, https://www.armbian.com"
TITLE="$BOARD_NAME "
DEFAULT_ADAPTER=$(ip -4 route ls | grep default | grep -Po '(?<=dev )(\S+)')
[[ -z "${DEFAULT_ADAPTER// }" ]] && DEFAULT_ADAPTER="lo"
# detect desktop
DISPLAY_MANAGER=""; DESKTOP_INSTALLED=""
check_if_installed bluetooth nodm && DESKTOP_INSTALLED="nodm";
check_if_installed bluetooth lightdm && DESKTOP_INSTALLED="lightdm";
[[ -n $(service lightdm status 2> /dev/null | grep -w active) ]] && DISPLAY_MANAGER="lightdm"
[[ -n $(service nodm status 2> /dev/null | grep -w active) ]] && DISPLAY_MANAGER="nodm"
dialog --backtitle "$BACKTITLE" --title "Please wait" --infobox "\nLoading Armbian configuration utility ... " 5 45
sleep 1
\ No newline at end of file
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