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

RFC, cleanup, readme update

parent 0fb01df9
# Armbian configuration utility # Armbian configuration utility
Utility for configuring your board, adjust services and install applications. It comes with Armbian by default. Login and type: Utility for configuring your board, adjusting services and installing applications. It comes with Armbian by default.
armbian-config Login as root and type:
![](images/armbian-config.png) armbian-config
**Configuration** ![](images/animated.gif)
- software - **system**
- change timezone, languages and hostname
- adjust SSH daemon features
- update board firmware
- toggle desktop, RDP and login manager (desktop builds)
- adjusting the display resolution (some boards)
- toggle running servives (stock Debian utility)
- enabling read only root filesystem (Ubuntu)
- install kernel headers
- **networking**
- select dynamic or static IP address
- hotspot management. Automatic detection of: nl80211, realtek, 802.11n, 802.11a and 802.11ac
- connect to wireless
- pair and connect Bluetooth devices
- edit IFUPDOWN interfaces
- **armbian**
- install to SATA, eMMC, NAND or USB
- freeze and unfreeze kernel and BSP upgrades
- edit boot environment, welcome screen items
- reconfigure board settings with DT overlays or FEX (Allwinner legacy)
- switching between avaliable kernels and nightly builds
- **software**
- softy - softy
- [TV headend](https://tvheadend.org/) *(IPTV server)* - [TV headend](https://tvheadend.org/) *(IPTV server)*
- [Syncthing](https://syncthing.net/) *(personal cloud)* - [Syncthing](https://syncthing.net/) *(personal cloud)*
...@@ -18,37 +39,15 @@ Utility for configuring your board, adjust services and install applications. It ...@@ -18,37 +39,15 @@ Utility for configuring your board, adjust services and install applications. It
- [Openmediavault NAS](http://www.openmediavault.org/) *(NAS server)* - [Openmediavault NAS](http://www.openmediavault.org/) *(NAS server)*
- [PI hole](https://pi-hole.net) *(ad blocker)* - [PI hole](https://pi-hole.net) *(ad blocker)*
- [MiniDLNA](http://minidlna.sourceforge.net/) *(media sharing)* - [MiniDLNA](http://minidlna.sourceforge.net/) *(media sharing)*
- monitoring tools - monitoring tools
- create diagnostics report - create diagnostics report
- install kernel headers - **help**
- networking - Links to documentation, support and sources
- select dynamic or static IP address
- manage hotspot. Automatic detection of: nl80211, realtek, 802.11n, 802.11a and 802.11ac
- connect to wireless
- Bluetooth devices pair and connect,
- edit IFUPDOWN interfaces
- system
- change timezone
- reconfigure locales, languages and charset
- change hostname
- toggle desktop (on desktop builds)
- toggle RDP (on desktop builds)
- toggle running servives (stock Debian app)
- enabling read only root filesystem (Ubuntu only)
- armbian
- install to SATA, eMMC, NAND or USB
- freeze and unfreeze kernel and BSP upgrades
- edit boot environment, network, FEX, welcome screen items
- switching between avaliable kernels and nightly builds
- about
- basic info about tool
----------
**Installation for regular Ubuntu or Debian based distributions** **Running this utility on 3rd party Debian based distributions**
sudo apt-get -y install git sudo apt-get -y install git
cd ~ cd ~
git clone https://github.com/igorpecovnik/Debian-micro-home-server git clone https://github.com/armbian/config
cd Debian-micro-home-server cd config
sudo ./debian-config bash debian-config
\ No newline at end of file
...@@ -39,6 +39,8 @@ if [[ $? -ne 0 ]]; then ...@@ -39,6 +39,8 @@ if [[ $? -ne 0 ]]; then
apt-get -qq -y --no-install-recommends install network-manager apt-get -qq -y --no-install-recommends install network-manager
[[ $(dpkg-query -W -f='${db:Status-Abbrev}\n' sunxi-tools 2>/dev/null) != *ii* ]] && \ [[ $(dpkg-query -W -f='${db:Status-Abbrev}\n' sunxi-tools 2>/dev/null) != *ii* ]] && \
apt-get -qq -y --no-install-recommends install sunxi-tools apt-get -qq -y --no-install-recommends install sunxi-tools
[[ $(dpkg-query -W -f='${db:Status-Abbrev}\n' iptables 2>/dev/null) != *ii* ]] && \
apt-get -qq -y --no-install-recommends install iptables
fi fi
...@@ -56,10 +58,10 @@ while true; do ...@@ -56,10 +58,10 @@ while true; do
LIST=() LIST=()
LIST+=( "Software" "System and 3rd party software install" )
LIST+=( "Networking" "Wired, Wireless, Bluetooth, Access point" )
LIST+=( "System" "General system settings" ) LIST+=( "System" "General system settings" )
LIST+=( "Networking" "Wired, Wireless, Bluetooth, Access point" )
LIST+=( "Armbian" "Armbian specific: overlays, MOTD, loglevel" ) LIST+=( "Armbian" "Armbian specific: overlays, MOTD, loglevel" )
LIST+=( "Software" "System and 3rd party software install" )
LIST+=( "Help" "Documentation, support, sources" ) LIST+=( "Help" "Documentation, support, sources" )
# count number of menu items to adjust window size # count number of menu items to adjust window size
......
...@@ -61,6 +61,16 @@ function jobs () ...@@ -61,6 +61,16 @@ function jobs ()
;; ;;
# Send diagnostics
#
"Diagnostics" )
clear
armbianmonitor -u
echo ""
read -n 1 -s -p "Press any key to continue"
;;
# Control board consumption # Control board consumption
# #
"Consumption" ) "Consumption" )
...@@ -316,10 +326,6 @@ function jobs () ...@@ -316,10 +326,6 @@ function jobs ()
debconf-apt-progress -- apt-get -qq -y --no-install-recommends install dnsmasq; debconf-apt-progress -- apt-get -qq -y --no-install-recommends install dnsmasq;
fi fi
if [[ $(dpkg-query -W -f='${db:Status-Abbrev}\n' iptables 2>/dev/null) != *ii* ]]; then
debconf-apt-progress -- apt-get -qq -y --no-install-recommends install iptables;
fi
echo -e "# armbian NAT hostapd\nallow-hotplug $WIRELESS_ADAPTER\niface $WIRELESS_ADAPTER inet static " > $TEMP_CONF echo -e "# armbian NAT hostapd\nallow-hotplug $WIRELESS_ADAPTER\niface $WIRELESS_ADAPTER inet static " > $TEMP_CONF
echo -e "\taddress 172.24.1.1\n\tnetmask 255.255.255.0\n\tnetwork 172.24.1.0\n\tbroadcast 172.24.1.255" >> $TEMP_CONF echo -e "\taddress 172.24.1.1\n\tnetmask 255.255.255.0\n\tnetwork 172.24.1.0\n\tbroadcast 172.24.1.255" >> $TEMP_CONF
# create new configuration # create new configuration
......
...@@ -11,49 +11,67 @@ DIALOG_CANCEL=1 ...@@ -11,49 +11,67 @@ DIALOG_CANCEL=1
DIALOG_ESC=255 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)
BACKTITLE="Configuration utility, $ARMBIAN, https://www.armbian.com"
TITLE="$BOARD_NAME "
DEFAULT_ADAPTER=$(ip -4 route ls | grep default | grep -Po '(?<=dev )(\S+)')
dialog --backtitle "$BACKTITLE" --title "Please wait" --infobox "\nLoading Armbian configuration utility ... " 5 45
sleep 1
#-----------------------------------------------------------------------------------------------------------------------------------------#
# check all possible wireless modes
#
function check_advanced_modes () function check_advanced_modes ()
{ {
CHECK=$(systemctl daemon-reload;service hostapd stop; sleep 2;service hostapd start;sleep 2;service hostapd status|grep fail) CHECK=$(systemctl daemon-reload;service hostapd stop; sleep 2;service hostapd start;sleep 2;service hostapd status|grep fail)
# check n,a and ac modes # check n,a and ac modes
if [[ -z "$CHECK" ]]; then if [[ -z "$CHECK" ]]; then
dialog --title " Info " --backtitle "$BACKTITLE" --no-collapse --colors --infobox "\nProbing wireless 802.11n \Z1(150-300Mbps)\Z0" 5 43 dialog --title " Info " --backtitle "$BACKTITLE" --no-collapse --colors --infobox "\nProbing wireless 802.11n \Z1(150-300Mbps)\Z0" 5 43
sleep 2 sleep 2
sed '/### IEEE 802.11n/,/^### IEEE 802.11n/ s/^# *//' -i /etc/hostapd.conf sed '/### IEEE 802.11n/,/^### IEEE 802.11n/ s/^# *//' -i /etc/hostapd.conf
CHECK=$(systemctl daemon-reload;service hostapd stop; sleep 2;service hostapd start;sleep 2;service hostapd status|grep fail) CHECK=$(systemctl daemon-reload;service hostapd stop; sleep 2;service hostapd start;sleep 2;service hostapd status|grep fail)
if [[ -z "$CHECK" ]]; then if [[ -z "$CHECK" ]]; then
# check various HT modes # check various HT modes
check_ht_capab check_ht_capab
# than go to check 5Ghz # than go to check 5Ghz
dialog --title " Info " --backtitle "$BACKTITLE" --no-collapse --colors --infobox "\nProbing wireless 802.11a \Z1(5Ghz)\Z0" 5 36 dialog --title " Info " --backtitle "$BACKTITLE" --no-collapse --colors --infobox "\nProbing wireless 802.11a \Z1(5Ghz)\Z0" 5 36
sleep 2 sleep 2
sed '/### IEEE 802.11a\>/,/^### IEEE 802.11a\>/ s/^# *//' -i /etc/hostapd.conf sed '/### IEEE 802.11a\>/,/^### IEEE 802.11a\>/ s/^# *//' -i /etc/hostapd.conf
CHECK=$(systemctl daemon-reload;service hostapd stop; sleep 2;service hostapd start;sleep 2;service hostapd status|grep fail) CHECK=$(systemctl daemon-reload;service hostapd stop; sleep 2;service hostapd start;sleep 2;service hostapd status|grep fail)
if [[ -n "$CHECK" ]]; then if [[ -n "$CHECK" ]]; then
check_channels check_channels
fi fi
CHECK=$(systemctl daemon-reload;service hostapd stop; sleep 2;service hostapd start;service hostapd status|grep fail) CHECK=$(systemctl daemon-reload;service hostapd stop; sleep 2;service hostapd start;service hostapd status|grep fail)
if [[ -z "$CHECK" ]]; then if [[ -z "$CHECK" ]]; then
dialog --title " Info " --backtitle "$BACKTITLE" --no-collapse --colors --infobox "\nProbing wireless 802.11ac \Z1(433Mbps x n @ 5Ghz)\Z0" 5 51 dialog --title " Info " --backtitle "$BACKTITLE" --no-collapse --colors \
sleep 2 --infobox "\nProbing wireless 802.11ac \Z1(433Mbps x n @ 5Ghz)\Z0" 5 51
sed '/### IEEE 802.11ac\>/,/^### IEEE 802.11ac\>/ s/^# *//' -i /etc/hostapd.conf sleep 2
CHECK=$(systemctl daemon-reload;service hostapd stop; sleep 2;service hostapd start;service hostapd status|grep fail) sed '/### IEEE 802.11ac\>/,/^### IEEE 802.11ac\>/ s/^# *//' -i /etc/hostapd.conf
if [[ -n "$CHECK" ]]; then CHECK=$(systemctl daemon-reload;service hostapd stop; sleep 2;service hostapd start;service hostapd status|grep fail)
dialog --title " Reverting configuration " --backtitle "$BACKTITLE" --no-collapse --colors --infobox "\nWireless 802.11ac \Z1(433Mbps x n @ 5Ghz)\Z0 is not supported!" 5 60 if [[ -n "$CHECK" ]]; then
sed '/## IEEE 802.11ac\>/,/^## IEEE 802.11ac\>/ s/.*/#&/' -i /etc/hostapd.conf dialog --title " Reverting configuration " --backtitle "$BACKTITLE" --no-collapse --colors \
fi --infobox "\nWireless 802.11ac \Z1(433Mbps x n @ 5Ghz)\Z0 is not supported!" 5 60
else sed '/## IEEE 802.11ac\>/,/^## IEEE 802.11ac\>/ s/.*/#&/' -i /etc/hostapd.conf
dialog --title " Reverting configuration " --backtitle "$BACKTITLE" --no-collapse --colors --infobox "\nWireless 802.11a \Z1(5Ghz)\Z0 is not supported!" 5 45 fi
sed -i "s/^channel=.*/channel=5/" /etc/hostapd.conf else
sed '/## IEEE 802.11a\>/,/^## IEEE 802.11a\>/ s/.*/#&/' -i /etc/hostapd.conf dialog --title " Reverting configuration " --backtitle "$BACKTITLE" --no-collapse --colors \
fi --infobox "\nWireless 802.11a \Z1(5Ghz)\Z0 is not supported!" 5 45
else sed -i "s/^channel=.*/channel=5/" /etc/hostapd.conf
dialog --title " Reverting configuration " --backtitle "$BACKTITLE" --no-collapse --colors --infobox "\nWireless 802.11n \Z1(150-300Mbps)\Z0 is not supported!" 5 52 sed '/## IEEE 802.11a\>/,/^## IEEE 802.11a\>/ s/.*/#&/' -i /etc/hostapd.conf
sed '/## IEEE 802.11n/,/^## IEEE 802.11n/ s/.*/#&/' -i /etc/hostapd.conf fi
fi else
fi dialog --title " Reverting configuration " --backtitle "$BACKTITLE" --no-collapse --colors \
--infobox "\nWireless 802.11n \Z1(150-300Mbps)\Z0 is not supported!" 5 52
sed '/## IEEE 802.11n/,/^## IEEE 802.11n/ s/.*/#&/' -i /etc/hostapd.conf
fi
fi
} }
...@@ -75,30 +93,20 @@ function create_if_config() { ...@@ -75,30 +93,20 @@ function create_if_config() {
fi fi
} # } #
function reload-nety() {
systemctl daemon-reload
if [[ "$1" == "reload" ]]; then WHATODO="Reloading services"; else WHATODO="Stopping services"; fi
(service network-manager stop; echo 10; sleep 1;\
service hostapd stop; echo 20; sleep 1;\
service dnsmasq stop; echo 30; sleep 1;\
[[ "$1" == "reload" ]] && service dnsmasq start && echo 60 && sleep 1 && service hostapd start && echo 80 && sleep 1;\
service network-manager start; echo 90; sleep 5;) | dialog --backtitle "$BACKTITLE" --title " $WHATODO " --gauge "" 6 70 0
systemctl restart systemd-resolved.service
}
#-----------------------------------------------------------------------------------------------------------------------------------------# #-----------------------------------------------------------------------------------------------------------------------------------------#
# gather info about the board and start with loading menu
# #
[[ -f /etc/armbian-release ]] && source /etc/armbian-release && ARMBIAN="Armbian $VERSION $IMAGE_TYPE"; # reaload network related services. some are "just in case"
DISTRO=$(lsb_release -is) #
DISTROID=$(lsb_release -sc) function reload-nety() {
KERNELID=$(uname -r) systemctl daemon-reload
BACKTITLE="Configuration utility, $ARMBIAN, https://www.armbian.com" if [[ "$1" == "reload" ]]; then WHATODO="Reloading services"; else WHATODO="Stopping services"; fi
TITLE="$BOARD_NAME " (service network-manager stop; echo 10; sleep 1; service hostapd stop; echo 20; sleep 1; service dnsmasq stop; echo 30; sleep 1;\
DEFAULT_ADAPTER=$(ip -4 route ls | grep default | grep -Po '(?<=dev )(\S+)') [[ "$1" == "reload" ]] && service dnsmasq start && echo 60 && sleep 1 && service hostapd start && echo 80 && sleep 1;\
service network-manager start; echo 90; sleep 5;) | dialog --backtitle "$BACKTITLE" --title " $WHATODO " --gauge "" 6 70 0
systemctl restart systemd-resolved.service
}
dialog --backtitle "$BACKTITLE" --title "Please wait" --infobox "\nLoading Armbian configuration utility ... " 5 45
#-----------------------------------------------------------------------------------------------------------------------------------------# #-----------------------------------------------------------------------------------------------------------------------------------------#
# #
...@@ -118,7 +126,8 @@ check_port () ...@@ -118,7 +126,8 @@ check_port ()
function beta_disclaimer () function beta_disclaimer ()
{ {
exec 3>&1 exec 3>&1
ACKNOWLEDGEMENT=$(dialog --nocancel --backtitle "$BACKTITLE" --no-collapse --title " Warning " --clear \--radiolist "\n$1.\n \n" 12 56 7 "Yes, I understand" "" off 2>&1 1>&3) ACKNOWLEDGEMENT=$(dialog --nocancel --backtitle "$BACKTITLE" --no-collapse --title " Warning " \
--clear \--radiolist "\n$1.\n \n" 12 56 7 "Yes, I understand" "" off 2>&1 1>&3)
exec 3>&- exec 3>&-
} }
...@@ -133,6 +142,10 @@ dialog --colors --backtitle "$BACKTITLE" --no-collapse --title " $1 " --clear -- ...@@ -133,6 +142,10 @@ dialog --colors --backtitle "$BACKTITLE" --no-collapse --title " $1 " --clear --
} }
#-----------------------------------------------------------------------------------------------------------------------------------------#
#
# check wifi high throughput
#
function check_ht_capab () function check_ht_capab ()
{ {
declare -a arr=("[HT40+][LDPC][SHORT-GI-20][SHORT-GI-40][TX-STBC][RX-STBC1][DSSS_CCK-40][SMPS-STATIC]" "[HT40-][SHORT-GI-40][SHORT-GI-40][DSSS_CCK-40]" "[SHORT-GI-20][SHORT-GI-40][HT40+]") declare -a arr=("[HT40+][LDPC][SHORT-GI-20][SHORT-GI-40][TX-STBC][RX-STBC1][DSSS_CCK-40][SMPS-STATIC]" "[HT40-][SHORT-GI-40][SHORT-GI-40][DSSS_CCK-40]" "[SHORT-GI-20][SHORT-GI-40][HT40+]")
...@@ -140,13 +153,19 @@ local j=0 ...@@ -140,13 +153,19 @@ local j=0
for i in "${arr[@]}" for i in "${arr[@]}"
do do
j=$((j+1)) j=$((j+1))
dialog --title " Info " --backtitle "$BACKTITLE" --no-collapse --colors --infobox "\nProbing high throughput capabilities \Z1(${j})\Z0" 5 46 dialog --title " Info " --backtitle "$BACKTITLE" --no-collapse --colors \
--infobox "\nProbing high throughput capabilities \Z1(${j})\Z0" 5 46
sed -i "s/^ht_capab=.*/ht_capab=$i/" /etc/hostapd.conf sed -i "s/^ht_capab=.*/ht_capab=$i/" /etc/hostapd.conf
CHECK=$(systemctl daemon-reload;service hostapd stop; sleep 2;service hostapd start;sleep 2;service hostapd status|grep fail) CHECK=$(systemctl daemon-reload;service hostapd stop; sleep 2;service hostapd start;sleep 2;service hostapd status|grep fail)
if [[ -z "$CHECK" ]]; then break; fi if [[ -z "$CHECK" ]]; then break; fi
done done
} }
#-----------------------------------------------------------------------------------------------------------------------------------------#
#
# check 5Ghz channels
#
function check_channels () function check_channels ()
{ {
declare -a arr=("36" "40") declare -a arr=("36" "40")
...@@ -160,7 +179,6 @@ done ...@@ -160,7 +179,6 @@ done
} }
#-----------------------------------------------------------------------------------------------------------------------------------------# #-----------------------------------------------------------------------------------------------------------------------------------------#
# #
# show description for MOTD files # show description for MOTD files
...@@ -193,6 +211,9 @@ function description ...@@ -193,6 +211,9 @@ function description
} }
#-----------------------------------------------------------------------------------------------------------------------------------------#
# edit ip address
#
function ip_editor () function ip_editor ()
{ {
exec 3>&1 exec 3>&1
...@@ -234,21 +255,23 @@ function wlan_edit_basic () ...@@ -234,21 +255,23 @@ function wlan_edit_basic ()
} }
} }
#-----------------------------------------------------------------------------------------------------------------------------------------# #-----------------------------------------------------------------------------------------------------------------------------------------#
# edit hostapd parameters # edit hostapd parameters
# #
function wlan_edit () function wlan_edit ()
{ {
# select default interfaces if there is more than one # select default interfaces if there is more than one
select_default_interface select_default_interface
dialog --title " Configuration edit " --colors --backtitle "$BACKTITLE" --help-button --help-label "Cancel" --yes-label "Basic" --no-label "Advanced" --yesno "\n\Z1Basic:\Z0 Change SSID, password and channel\n\n\Z1Advanced:\Z0 Edit /etc/hostapd.conf file" 9 70 dialog --title " Configuration edit " --colors --backtitle "$BACKTITLE" --help-button --help-label "Cancel" --yes-label "Basic" \
if [[ $? = 0 ]]; then --no-label "Advanced" --yesno "\n\Z1Basic:\Z0 Change SSID, password and channel\n\n\Z1Advanced:\Z0 Edit /etc/hostapd.conf file" 9 70
wlan_edit_basic if [[ $? = 0 ]]; then
elif [[ $? = 1 ]]; then wlan_edit_basic
dialog --backtitle "$BACKTITLE" --title " Edit hostapd configuration /etc/hostapd.conf" --no-collapse \ elif [[ $? = 1 ]]; then
--ok-label "Save" --editbox /etc/hostapd.conf 30 0 2> /etc/hostapd.conf.out dialog --backtitle "$BACKTITLE" --title " Edit hostapd configuration /etc/hostapd.conf" --no-collapse \
[[ $? = 0 ]] && mv /etc/hostapd.conf.out /etc/hostapd.conf && service hostapd restart --ok-label "Save" --editbox /etc/hostapd.conf 30 0 2> /etc/hostapd.conf.out
fi [[ $? = 0 ]] && mv /etc/hostapd.conf.out /etc/hostapd.conf && service hostapd restart
fi
} }
...@@ -315,7 +338,7 @@ function aval_kernel () ...@@ -315,7 +338,7 @@ function aval_kernel ()
#-----------------------------------------------------------------------------------------------------------------------------------------# #-----------------------------------------------------------------------------------------------------------------------------------------#
# select video mode for h3 # select video modes for h3
# #
function get_h3modes () function get_h3modes ()
{ {
...@@ -393,6 +416,7 @@ function select_default_interface () ...@@ -393,6 +416,7 @@ function select_default_interface ()
} }
#-----------------------------------------------------------------------------------------------------------------------------------------#
# search for BT devices and connect # search for BT devices and connect
# #
function connect_bt_interface () function connect_bt_interface ()
...@@ -433,61 +457,84 @@ function connect_bt_interface () ...@@ -433,61 +457,84 @@ function connect_bt_interface ()
fi fi
} }
#-----------------------------------------------------------------------------------------------------------------------------------------# #-----------------------------------------------------------------------------------------------------------------------------------------#
# menu for software # system
# #
function submenu_software () function submenu_settings ()
{ {
while true; do while true; do
LIST=() LIST=()
[[ -f /usr/bin/softy ]] && LIST+=( "Softy" "3rd party applications installer" )
#if [[ -n $(netstat -lnt | awk '$6 == "LISTEN" && $4 ~ ".'32032'"') ]]; then
# LIST+=( "USB redirector" "Disable USB devices sharing over Ethernet" )
# else
# LIST+=( "USB redirector" "Enable USB devices sharing over Ethernet" )
#fi
[[ -f /usr/bin/h3consumption && "$LINUXFAMILY" = "sun8i" && "$BRANCH" = "default" ]] && \
LIST+=( "Consumption" "Control board consumption" )
[[ -f /usr/bin/armbianmonitor ]] && LIST+=( "Monitor" "Simple CLI board monitoring" )
[[ -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
[[ -f /usr/bin/h3disp && "$LINUXFAMILY" = "sun8i" && "$BRANCH" = "default" && \
-n $(bin2fex </boot/script.bin 2>/dev/null | grep -w "hdmi_used = 1") ]] && LIST+=( "Display" "set the display resolution" )
# count number of menu items to adjust window sizee LIST+=( "Timezone" "Change timezone \Z5($(date +%Z))\Z0" )
LISTLENGHT="$((11+${#LIST[@]}/2))" LIST+=( "Locales" "Reconfigure language \Z5($(locale | grep LANGUAGE | cut -d= -f2 | cut -d_ -f1))\Z0 and character set" )
BOXLENGHT=${#LIST[@]} LIST+=( "Hostname" "Change your hostname \Z5($(cat /etc/hostname))\Z0" )
LIST+=( "SSHd" "Reconfigure SSH daemon" )
LIST+=( "Firmware" "Upgrade board firmware" )
# display warning only we have wifi # detect desktop
if [[ " ${LIST[*]} " == *" Hotspot "* ]]; then DISPLAY_MANAGER=""; DESKTOP_INSTALLED=""
local disclaimer="\nNote: wireless networking in Linux is problematic. Our tools make it easy for some cases but can't enable AP on every random WiFi chip. If this tool fail, you are on your own.\n " if [ $(dpkg-query -W -f='${db:Status-Abbrev}\n' nodm 2>/dev/null) <> "*ii*" ]; then DESKTOP_INSTALLED="nodm"; fi
else if [ $(dpkg-query -W -f='${db:Status-Abbrev}\n' lightdm 2>/dev/null) <> "*ii*" ]; then DESKTOP_INSTALLED="lightdm"; fi
LISTLENGHT="$((6+${#LIST[@]}/2))" [[ -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" )
[[ $DISPLAY_MANAGER == 'nodm' ]] && LIST+=( "Lightdm" "Switch to standard login manager" )
[[ $DISPLAY_MANAGER == 'lightdm' ]] && LIST+=( "Nodm" "Switch to simple auto login manager" )
elif [[ -n $DESKTOP_INSTALLED ]]; then
LIST+=( "Desktop" "Enable desktop" )
fi fi
DIALOG_CANCEL=1 if [[ -n $DISPLAY_MANAGER ]]; then
DIALOG_ESC=255 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
LIST+=( "Overlayroot" "Disable virtual read-only root filesystem" )
else
LIST+=( "Overlayroot" "Enable virtual read-only root filesystem" )
fi
fi
# count number of menu items to adjust window sizee
LISTLENGHT="$((6+${#LIST[@]}/2))"
BOXLENGHT=${#LIST[@]}
exec 3>&1 exec 3>&1
selection=$(dialog --backtitle "$BACKTITLE" --title "System and 3rd party software" --clear \ selection=$(dialog --colors --backtitle "$BACKTITLE" --title " System settings " --clear \
--cancel-label "Back" --menu "$disclaimer" $LISTLENGHT 70 $BOXLENGHT \ --cancel-label "Back" --menu "$disclaimer" $LISTLENGHT 70 $BOXLENGHT \
"${LIST[@]}" 2>&1 1>&3) "${LIST[@]}" 2>&1 1>&3)
exit_status=$? exit_status=$?
exec 3>&- exec 3>&-
[[ $exit_status == $DIALOG_CANCEL || $exit_status == $DIALOG_ESC ]] && clear && break [[ $exit_status == $DIALOG_CANCEL || $exit_status == $DIALOG_ESC ]] && clear && break
# run main function
jobs "$selection" jobs "$selection"
done done
} }
#-----------------------------------------------------------------------------------------------------------------------------------------# #-----------------------------------------------------------------------------------------------------------------------------------------#
# menu for networking # menu for networking
# #
function submenu_networking () function submenu_networking ()
{ {
# if there is more than one connected device
select_default_interface select_default_interface
while true; do while true; do
LIST=() LIST=()
LIST+=( "IP" "Select dynamic or edit static IP address" ) LIST+=( "IP" "Select dynamic or edit static IP address" )
HOSTAPDBRIDGE=$(cat /etc/hostapd.conf 2> /dev/null | grep -w "^bridge=br0") HOSTAPDBRIDGE=$(cat /etc/hostapd.conf 2> /dev/null | grep -w "^bridge=br0")
HOSTAPDSTATUS=$(service hostapd status | grep -w active | grep -w running) HOSTAPDSTATUS=$(service hostapd status | grep -w active | grep -w running)
...@@ -511,7 +558,8 @@ while true; do ...@@ -511,7 +558,8 @@ while true; do
fi fi
LIST+=( "Advanced" "Edit /etc/network/interfaces" ) LIST+=( "Advanced" "Edit /etc/network/interfaces" )
[[ $(ls -1 /etc/NetworkManager/system-connections 2> /dev/null) ]] && LIST+=( "Forget" "Disconnect and forget all wireless connections" ) [[ $(ls -1 /etc/NetworkManager/system-connections 2> /dev/null) ]] && \
LIST+=( "Forget" "Disconnect and forget all wireless connections" )
# count number of menu items to adjust window sizee # count number of menu items to adjust window sizee
LISTLENGHT="$((13+${#LIST[@]}/2))" LISTLENGHT="$((13+${#LIST[@]}/2))"
...@@ -520,7 +568,6 @@ while true; do ...@@ -520,7 +568,6 @@ while true; do
local disclaimer="" local disclaimer=""
local ipadd=$(ip -4 addr show dev $DEFAULT_ADAPTER | awk '/inet/ {print $2}' | cut -d'/' -f1) local ipadd=$(ip -4 addr show dev $DEFAULT_ADAPTER | awk '/inet/ {print $2}' | cut -d'/' -f1)
if [[ -n $(grep $DEFAULT_ADAPTER /etc/network/interfaces | grep static) ]]; then if [[ -n $(grep $DEFAULT_ADAPTER /etc/network/interfaces | grep static) ]]; then
...@@ -532,7 +579,6 @@ while true; do ...@@ -532,7 +579,6 @@ while true; do
fi fi
disclaimer="$ifup" disclaimer="$ifup"
if [[ -n $WIFICONNECTED ]]; then if [[ -n $WIFICONNECTED ]]; then
LISTLENGHT=$((LISTLENGHT+2)) LISTLENGHT=$((LISTLENGHT+2))
local connected="\n\Z0Connected to SSID: \Z1${WIFICONNECTED}\n\Z0 " local connected="\n\Z0Connected to SSID: \Z1${WIFICONNECTED}\n\Z0 "
...@@ -541,28 +587,20 @@ while true; do ...@@ -541,28 +587,20 @@ while true; do
if [[ -n $HOSTAPDINFO && -n $HOSTAPDSTATUS ]]; then if [[ -n $HOSTAPDINFO && -n $HOSTAPDSTATUS ]]; then
LISTLENGHT=$((LISTLENGHT+2)) LISTLENGHT=$((LISTLENGHT+2))
chipid=$(dmesg | grep $(grep ^interface /etc/hostapd.conf | sed 's/interface=//g') | head -1 | sed 's/\[.*\]//g' | awk '{print $1}') chpid=$(dmesg | grep $(grep ^interface /etc/hostapd.conf | sed 's/interface=//g') | head -1 | sed 's/\[.*\]//g' | awk '{print $1}')
disclaimer=$disclaimer$"\n\Z0Hotspot SSID: \Z1$HOSTAPDINFO\Zn Band:"; disclaimer=$disclaimer$"\n\Z0Hotspot SSID: \Z1$HOSTAPDINFO\Zn Band:";
if [[ `grep ^hw_mode=a /etc/hostapd.conf` ]]; then local band="5Ghz"; else band="2.4Ghz"; fi if [[ `grep ^hw_mode=a /etc/hostapd.conf` ]]; then local band="5Ghz"; else band="2.4Ghz"; fi
if [[ `grep ^ieee80211n /etc/hostapd.conf` ]]; then local type="N"; fi if [[ `grep ^ieee80211n /etc/hostapd.conf` ]]; then local type="N"; fi
if [[ `grep ^ieee80211ac /etc/hostapd.conf` ]]; then local type="AC"; fi if [[ `grep ^ieee80211ac /etc/hostapd.conf` ]]; then local type="AC"; fi
disclaimer=$disclaimer$" \Z1${band} ${type}\Z0" disclaimer=$disclaimer$" \Z1${band} ${type}\Z0"
if [ -n $chipid ]; then disclaimer=$disclaimer$"\n\nChip: \Z1${chipid}\Z0"; fi if [ -n $chpid ]; then disclaimer=$disclaimer$"\n\nChip: \Z1${chpid}\Z0"; fi
if [ "$HOSTAPDCLIENTS" -gt "0" ]; then disclaimer=$disclaimer$" Connected clients: \Z1$HOSTAPDCLIENTS\Zn"; fi if [ "$HOSTAPDCLIENTS" -gt "0" ]; then disclaimer=$disclaimer$" Connected clients: \Z1$HOSTAPDCLIENTS\Zn"; fi
if [ -n $chip ] || [ "$HOSTAPDCLIENTS" -gt "0" ]; then LISTLENGHT=$((LISTLENGHT+2)); fi if [ -n $chip ] || [ "$HOSTAPDCLIENTS" -gt "0" ]; then LISTLENGHT=$((LISTLENGHT+2)); fi
disclaimer=$disclaimer$"\n"; disclaimer=$disclaimer$"\n";
fi fi
#disclaimer=$disclaimer"\n"
# display warning only we have wifi
#if [[ " ${LIST[*]} " == *" Hotspot "* ]]; then
disclaimer=$disclaimer"\n\Z1Note\Zn: wireless networking in Linux is problematic. Our tools make it easy for some cases but can't enable AP on every random WiFi chip. If this tool fail, you are on your own.\n "
#else
# LISTLENGHT="$((6+${#LIST[@]}/2))"
#fi
DIALOG_CANCEL=1 disclaimer=$disclaimer"\n\Z1Note\Zn: wireless networking in Linux is problematic.\
DIALOG_ESC=255 Our tools make it easy for some cases but can't enable AP on every random WiFi chip. If this tool fail, you are on your own.\n "
exec 3>&1 exec 3>&1
selection=$(dialog --backtitle "$BACKTITLE" --colors --title " Wired, Wireless, Bluetooth, Hotspot " --clear \ selection=$(dialog --backtitle "$BACKTITLE" --colors --title " Wired, Wireless, Bluetooth, Hotspot " --clear \
...@@ -571,86 +609,15 @@ while true; do ...@@ -571,86 +609,15 @@ while true; do
exit_status=$? exit_status=$?
exec 3>&- exec 3>&-
[[ $exit_status == $DIALOG_CANCEL || $exit_status == $DIALOG_ESC ]] && clear && break [[ $exit_status == $DIALOG_CANCEL || $exit_status == $DIALOG_ESC ]] && clear && break
jobs "$selection"
done
}
#-----------------------------------------------------------------------------------------------------------------------------------------#
# menu for settings
#
function submenu_settings ()
{
while true; do
LIST=()
# check for display manager statuses
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+=( "SSHd" "Reconfigure SSH daemon" )
LIST+=( "Firmware" "Upgrade board firmware" )
# check for display manager statuses
# 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" )
[[ $DISPLAY_MANAGER == 'nodm' ]] && LIST+=( "Lightdm" "Switch to standard login manager" )
[[ $DISPLAY_MANAGER == 'lightdm' ]] && LIST+=( "Nodm" "Switch to simple auto login manager" )
elif [[ -n $DESKTOP_INSTALLED ]]; then
LIST+=( "Desktop" "Enable desktop" )
fi
if [[ -n $DISPLAY_MANAGER ]]; then # run main function
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
LIST+=( "Overlayroot" "Disable virtual read-only root filesystem" )
else
LIST+=( "Overlayroot" "Enable virtual read-only root filesystem" )
fi
fi
# count number of menu items to adjust window sizee
LISTLENGHT="$((11+${#LIST[@]}/2))"
BOXLENGHT=${#LIST[@]}
# display warning only we have wifi
if [[ " ${LIST[*]} " == *" Hotspot "* ]]; then
local disclaimer="\nNote: wireless networking in Linux is problematic. Our tools make it easy for some cases but can't enable AP on every random WiFi chip. If this tool fail, you are on your own.\n "
else
LISTLENGHT="$((6+${#LIST[@]}/2))"
fi
DIALOG_CANCEL=1
DIALOG_ESC=255
exec 3>&1
selection=$(dialog --colors --backtitle "$BACKTITLE" --title " System settings " --clear \
--cancel-label "Back" --menu "$disclaimer" $LISTLENGHT 70 $BOXLENGHT \
"${LIST[@]}" 2>&1 1>&3)
exit_status=$?
exec 3>&-
[[ $exit_status == $DIALOG_CANCEL || $exit_status == $DIALOG_ESC ]] && clear && break
jobs "$selection" jobs "$selection"
done done
} }
#-----------------------------------------------------------------------------------------------------------------------------------------# #-----------------------------------------------------------------------------------------------------------------------------------------#
# Armbian specific settings # armbian
# #
function submenu_hardware () function submenu_hardware ()
{ {
...@@ -696,4 +663,41 @@ while true; do ...@@ -696,4 +663,41 @@ while true; do
jobs "$selection" jobs "$selection"
done done
}
#-----------------------------------------------------------------------------------------------------------------------------------------#
# software
#
function submenu_software ()
{
while true; do
LIST=()
[[ -f /usr/bin/softy ]] && LIST+=( "Softy" "3rd party applications installer" )
[[ -f /usr/bin/h3consumption && "$LINUXFAMILY" = "sun8i" && "$BRANCH" = "default" ]] && \
LIST+=( "Consumption" "Control board consumption" )
[[ -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
[[ -f /usr/bin/h3disp && "$LINUXFAMILY" = "sun8i" && "$BRANCH" = "default" && \
-n $(bin2fex </boot/script.bin 2>/dev/null | grep -w "hdmi_used = 1") ]] && LIST+=( "Display" "set the display resolution" )
# count number of menu items to adjust window sizee
LISTLENGHT="$((6+${#LIST[@]}/2))"
BOXLENGHT=${#LIST[@]}
exec 3>&1
selection=$(dialog --backtitle "$BACKTITLE" --title "System and 3rd party software" --clear \
--cancel-label "Back" --menu "$disclaimer" $LISTLENGHT 70 $BOXLENGHT \
"${LIST[@]}" 2>&1 1>&3)
exit_status=$?
exec 3>&-
[[ $exit_status == $DIALOG_CANCEL || $exit_status == $DIALOG_ESC ]] && clear && break
# run main function
jobs "$selection"
done
} }
\ 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