Commit 94f62976 authored by Igor Pecovnik's avatar Igor Pecovnik
Browse files

cosmetic fixes

parent a60e8461
#!/bin/bash
#
# Copyright (c) 2017 Igor Pecovnik, igor.pecovnik@gma**.com
# Copyright (c) 2018 Igor Pecovnik, igor.pecovnik@gma**.com
#
# This file is licensed under the terms of the GNU General Public
# License version 2. This program is licensed "as is" without any
# warranty of any kind, whether express or implied.
# define sane $PATH
export PATH=/usr/sbin:/usr/bin:/sbin:/bin
#-----------------------------------------------------------------------------------------------------------------------------------------#
#
# check for root
#
if [[ $EUID != 0 ]]; then
......@@ -19,7 +25,9 @@ if [[ $EUID != 0 ]]; then
fi
#-----------------------------------------------------------------------------------------------------------------------------------------#
#
# check if we have internet connection to install dependencies
#
echo -e "GET http://github.com HTTP/1.0\n\n" | nc github.com 80 > /dev/null 2>&1
......@@ -29,9 +37,11 @@ if [[ $? -ne 0 ]]; then
fi
#-----------------------------------------------------------------------------------------------------------------------------------------#
# load functions, local first
#
# load functions, local first
#
if [[ -f ${BASH_SOURCE}-jobs ]]; then source ${BASH_SOURCE}-jobs;
elif [[ -f /usr/lib/armbian-config/jobs.sh ]]; then source /usr/lib/armbian-config/jobs.sh;
else exit 1;
......@@ -52,11 +62,16 @@ if [[ -f ${BASH_SOURCE}-functions-network ]]; then source ${BASH_SOURCE}-functi
else exit 1;
fi
# collect info
main "$@"
#-----------------------------------------------------------------------------------------------------------------------------------------#
#
# Main menu
#
while true
......@@ -112,11 +127,10 @@ do
;;
"Help" )
show_box "Info" "This tool provides a straightforward way of configuring the \Z4${BOARD_NAME}\Z0. \
show_box "Info" "This tool provides a straightforward way of configuring. \
\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://git.armbian.com" "18"
;;
esac
done
#-----------------------------------------------------------------------------------------------------------------------------------------#
done
\ No newline at end of file
......@@ -35,9 +35,10 @@ function main(){
DISTROID=$(lsb_release -sc)
KERNELID=$(uname -r)
[[ -z "${ARMBIAN// }" ]] && ARMBIAN="$DISTRO $DISTROID"
BACKTITLE="Configuration utility, $ARMBIAN, https://www.armbian.com"
TITLE="$BOARD_NAME "
DEFAULT_ADAPTER=$(ip -4 route ls | grep default | grep -Po '(?<=dev )(\S+)')
local ipadd=$(ip -4 addr show dev $DEFAULT_ADAPTER | awk '/inet/ {print $2}' | cut -d'/' -f1)
BACKTITLE="Configuration utility, $ARMBIAN, $ipadd"
TITLE="$BOARD_NAME "
[[ -z "${DEFAULT_ADAPTER// }" ]] && DEFAULT_ADAPTER="lo"
OVERLAYDIR="/boot/dtb/overlay";
[[ "$LINUXFAMILY" == "sunxi64" ]] && OVERLAYDIR="/boot/dtb/allwinner/overlay";
......
#!/bin/bash
#
# Copyright (c) 2017 Igor Pecovnik, igor.pecovnik@gma**.com
# Copyright (c) 2018 Igor Pecovnik, igor.pecovnik@gma**.com
#
# This file is licensed under the terms of the GNU General Public
# License version 2. This program is licensed "as is" without any
......@@ -12,19 +12,30 @@
# submenu_personal
# submenu_software
#-----------------------------------------------------------------------------------------------------------------------------------------#
# system
#
# system settings
#
function submenu_settings ()
{
while true; do
LIST=()
DIALOG_CANCEL=1
DIALOG_ESC=255
# check update status of BSP packages
local mark=$(apt-mark showhold | grep -w "$BOARD")
[[ $(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" )
# check if install targets are avaliable
if [[ $(sed -n 's/^DEVNAME=//p' /sys/dev/block/$(mountpoint -d /)/uevent 2> /dev/null) == mmcblk* \
&& -f /usr/sbin/nand-sata-install ]]; then
LIST+=( "Install" "Install to SATA, eMMC, NAND or USB" )
fi
# armbian specific function
if [[ -f /etc/armbian-release ]]; then
if [[ -n "${mark}" ]]; then
LIST+=( "Defreeze" "Enable kernel upgrades" )
......@@ -32,13 +43,17 @@ while true; do
LIST+=( "Freeze" "Disable kernel upgrades" )
fi
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) ]] \
# armbian specific function, when upgrades are enabled
if [[ -z ${mark} ]]; 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) ]] \
[[ -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" )
......@@ -50,25 +65,25 @@ while true; do
[[ $(apt-cache search --names-only '^linux-'$(lsb_release -cs)'-root.*.'$BOARD'' | sed 's/.*(\(.*\))/\1/' | awk '{print $1}' \
| wc -l) -gt 1 && -z "${mark}" ]] && LIST+=( "Switch" "Switch to alternative kernels" )
LIST+=( "SSH" "Reconfigure SSH daemon" )
LIST+=( "Firmware" "Run apt update & apt upgrade" )
[[ "$LINUXFAMILY" = sun*i && "$BRANCH" = "default" && \
-n $(bin2fex </boot/script.bin 2>/dev/null | grep -w "hdmi_used = 1") ]] && LIST+=( "Display" "set the display resolution" )
# desktop
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" )
else
if [[ -n $DESKTOP_INSTALLED ]]; then
LIST+=( "Desktop" "Enable desktop" )
LIST+=( "Desktop" "Enable desktop" )
else
LIST+=( "Desktop" "Install desktop" )
LIST+=( "Desktop" "Install desktop" )
fi
fi
# overlayroot
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" )
......@@ -95,7 +110,9 @@ done
}
#-----------------------------------------------------------------------------------------------------------------------------------------#
#
# menu for networking
#
function submenu_networking ()
......@@ -107,10 +124,12 @@ select_default_interface
while true; do
LIST=()
DIALOG_CANCEL=1
DIALOG_ESC=255
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)
HOSTAPDSTATUS=$(service hostapd status 2> /dev/null | grep -w active | grep -w running)
if [[ -n "$HOSTAPDSTATUS" ]]; then
HOSTAPDINFO=$(hostapd_cli get_config 2> /dev/null | grep ^ssid | sed 's/ssid=//g')
HOSTAPDCLIENTS=$(hostapd_cli all_sta 2> /dev/null | grep connected_time | wc -l)
......
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