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

RFC, cleanup, readme update

parent 0fb01df9
# 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
- [TV headend](https://tvheadend.org/) *(IPTV server)*
- [Syncthing](https://syncthing.net/) *(personal cloud)*
......@@ -20,35 +41,13 @@ Utility for configuring your board, adjust services and install applications. It
- [MiniDLNA](http://minidlna.sourceforge.net/) *(media sharing)*
- monitoring tools
- create diagnostics report
- install kernel headers
- networking
- 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
----------
- **help**
- Links to documentation, support and sources
**Installation for regular Ubuntu or Debian based distributions**
**Running this utility on 3rd party Debian based distributions**
sudo apt-get -y install git
cd ~
git clone https://github.com/igorpecovnik/Debian-micro-home-server
cd Debian-micro-home-server
sudo ./debian-config
git clone https://github.com/armbian/config
cd config
bash debian-config
\ No newline at end of file
......@@ -39,6 +39,8 @@ if [[ $? -ne 0 ]]; then
apt-get -qq -y --no-install-recommends install network-manager
[[ $(dpkg-query -W -f='${db:Status-Abbrev}\n' sunxi-tools 2>/dev/null) != *ii* ]] && \
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
......@@ -56,10 +58,10 @@ while true; do
LIST=()
LIST+=( "Software" "System and 3rd party software install" )
LIST+=( "Networking" "Wired, Wireless, Bluetooth, Access point" )
LIST+=( "System" "General system settings" )
LIST+=( "Networking" "Wired, Wireless, Bluetooth, Access point" )
LIST+=( "Armbian" "Armbian specific: overlays, MOTD, loglevel" )
LIST+=( "Software" "System and 3rd party software install" )
LIST+=( "Help" "Documentation, support, sources" )
# count number of menu items to adjust window size
......
......@@ -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
#
"Consumption" )
......@@ -316,10 +326,6 @@ function jobs ()
debconf-apt-progress -- apt-get -qq -y --no-install-recommends install dnsmasq;
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 "\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
......
......@@ -11,14 +11,28 @@ 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)
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 ()
{
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
if [[ -z "$CHECK" ]]; then
# check n,a and ac modes
if [[ -z "$CHECK" ]]; then
dialog --title " Info " --backtitle "$BACKTITLE" --no-collapse --colors --infobox "\nProbing wireless 802.11n \Z1(150-300Mbps)\Z0" 5 43
sleep 2
sed '/### IEEE 802.11n/,/^### IEEE 802.11n/ s/^# *//' -i /etc/hostapd.conf
......@@ -36,24 +50,28 @@ CHECK=$(systemctl daemon-reload;service hostapd stop; sleep 2;service hostapd st
fi
CHECK=$(systemctl daemon-reload;service hostapd stop; sleep 2;service hostapd start;service hostapd status|grep fail)
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 \
--infobox "\nProbing wireless 802.11ac \Z1(433Mbps x n @ 5Ghz)\Z0" 5 51
sleep 2
sed '/### IEEE 802.11ac\>/,/^### IEEE 802.11ac\>/ s/^# *//' -i /etc/hostapd.conf
CHECK=$(systemctl daemon-reload;service hostapd stop; sleep 2;service hostapd start;service hostapd status|grep fail)
if [[ -n "$CHECK" ]]; then
dialog --title " Reverting configuration " --backtitle "$BACKTITLE" --no-collapse --colors --infobox "\nWireless 802.11ac \Z1(433Mbps x n @ 5Ghz)\Z0 is not supported!" 5 60
dialog --title " Reverting configuration " --backtitle "$BACKTITLE" --no-collapse --colors \
--infobox "\nWireless 802.11ac \Z1(433Mbps x n @ 5Ghz)\Z0 is not supported!" 5 60
sed '/## IEEE 802.11ac\>/,/^## IEEE 802.11ac\>/ s/.*/#&/' -i /etc/hostapd.conf
fi
else
dialog --title " Reverting configuration " --backtitle "$BACKTITLE" --no-collapse --colors --infobox "\nWireless 802.11a \Z1(5Ghz)\Z0 is not supported!" 5 45
dialog --title " Reverting configuration " --backtitle "$BACKTITLE" --no-collapse --colors \
--infobox "\nWireless 802.11a \Z1(5Ghz)\Z0 is not supported!" 5 45
sed -i "s/^channel=.*/channel=5/" /etc/hostapd.conf
sed '/## IEEE 802.11a\>/,/^## IEEE 802.11a\>/ s/.*/#&/' -i /etc/hostapd.conf
fi
else
dialog --title " Reverting configuration " --backtitle "$BACKTITLE" --no-collapse --colors --infobox "\nWireless 802.11n \Z1(150-300Mbps)\Z0 is not supported!" 5 52
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
fi
}
......@@ -75,30 +93,20 @@ function create_if_config() {
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";
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+)')
# reaload network related services. some are "just in case"
#
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
}
dialog --backtitle "$BACKTITLE" --title "Please wait" --infobox "\nLoading Armbian configuration utility ... " 5 45
#-----------------------------------------------------------------------------------------------------------------------------------------#
#
......@@ -118,7 +126,8 @@ check_port ()
function beta_disclaimer ()
{
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>&-
}
......@@ -133,6 +142,10 @@ dialog --colors --backtitle "$BACKTITLE" --no-collapse --title " $1 " --clear --
}
#-----------------------------------------------------------------------------------------------------------------------------------------#
#
# check wifi high throughput
#
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+]")
......@@ -140,13 +153,19 @@ local j=0
for i in "${arr[@]}"
do
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
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
done
}
#-----------------------------------------------------------------------------------------------------------------------------------------#
#
# check 5Ghz channels
#
function check_channels ()
{
declare -a arr=("36" "40")
......@@ -160,7 +179,6 @@ done
}
#-----------------------------------------------------------------------------------------------------------------------------------------#
#
# show description for MOTD files
......@@ -193,6 +211,9 @@ function description
}
#-----------------------------------------------------------------------------------------------------------------------------------------#
# edit ip address
#
function ip_editor ()
{
exec 3>&1
......@@ -234,6 +255,7 @@ function wlan_edit_basic ()
}
}
#-----------------------------------------------------------------------------------------------------------------------------------------#
# edit hostapd parameters
#
......@@ -241,7 +263,8 @@ function wlan_edit ()
{
# select default interfaces if there is more than one
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" \
--no-label "Advanced" --yesno "\n\Z1Basic:\Z0 Change SSID, password and channel\n\n\Z1Advanced:\Z0 Edit /etc/hostapd.conf file" 9 70
if [[ $? = 0 ]]; then
wlan_edit_basic
elif [[ $? = 1 ]]; then
......@@ -315,7 +338,7 @@ function aval_kernel ()
#-----------------------------------------------------------------------------------------------------------------------------------------#
# select video mode for h3
# select video modes for h3
#
function get_h3modes ()
{
......@@ -393,6 +416,7 @@ function select_default_interface ()
}
#-----------------------------------------------------------------------------------------------------------------------------------------#
# search for BT devices and connect
#
function connect_bt_interface ()
......@@ -433,61 +457,84 @@ function connect_bt_interface ()
fi
}
#-----------------------------------------------------------------------------------------------------------------------------------------#
# menu for software
# system
#
function submenu_software ()
function submenu_settings ()
{
while true; do
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
LISTLENGHT="$((11+${#LIST[@]}/2))"
BOXLENGHT=${#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" )
LIST+=( "SSHd" "Reconfigure SSH daemon" )
LIST+=( "Firmware" "Upgrade board firmware" )
# 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 "
# 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
if [[ $(service xrdp status 2> /dev/null | grep -w active) ]]; then
LIST+=( "RDP" "Disable remote desktop access from Windows" )
else
LISTLENGHT="$((6+${#LIST[@]}/2))"
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
DIALOG_CANCEL=1
DIALOG_ESC=255
# 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 \
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
# run main function
jobs "$selection"
done
}
#-----------------------------------------------------------------------------------------------------------------------------------------#
# menu for networking
#
function submenu_networking ()
{
# if there is more than one connected device
select_default_interface
while true; do
LIST=()
LIST+=( "IP" "Select dynamic or edit static IP address" )
HOSTAPDBRIDGE=$(cat /etc/hostapd.conf 2> /dev/null | grep -w "^bridge=br0")
HOSTAPDSTATUS=$(service hostapd status | grep -w active | grep -w running)
......@@ -511,7 +558,8 @@ while true; do
fi
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
LISTLENGHT="$((13+${#LIST[@]}/2))"
......@@ -520,7 +568,6 @@ while true; do
local disclaimer=""
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
......@@ -532,7 +579,6 @@ while true; do
fi
disclaimer="$ifup"
if [[ -n $WIFICONNECTED ]]; then
LISTLENGHT=$((LISTLENGHT+2))
local connected="\n\Z0Connected to SSID: \Z1${WIFICONNECTED}\n\Z0 "
......@@ -541,28 +587,20 @@ while true; do
if [[ -n $HOSTAPDINFO && -n $HOSTAPDSTATUS ]]; then
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:";
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 ^ieee80211ac /etc/hostapd.conf` ]]; then local type="AC"; fi
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 [ -n $chip ] || [ "$HOSTAPDCLIENTS" -gt "0" ]; then LISTLENGHT=$((LISTLENGHT+2)); fi
disclaimer=$disclaimer$"\n";
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
DIALOG_ESC=255
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 "
exec 3>&1
selection=$(dialog --backtitle "$BACKTITLE" --colors --title " Wired, Wireless, Bluetooth, Hotspot " --clear \
......@@ -571,86 +609,15 @@ while true; do
exit_status=$?
exec 3>&-
[[ $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
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
# run main function
jobs "$selection"
done
}
#-----------------------------------------------------------------------------------------------------------------------------------------#
# Armbian specific settings
# armbian
#
function submenu_hardware ()
{
......@@ -697,3 +664,40 @@ while true; do
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