Include local functions first, adding functions names at the beggining of the file

This commit is contained in:
Igor Pecovnik
2018-05-01 21:38:39 +02:00
parent 87f42decda
commit d2ab5b5d37
5 changed files with 65 additions and 13 deletions

View File

@@ -30,12 +30,30 @@ fi
#-----------------------------------------------------------------------------------------------------------------------------------------#
# load functions
[[ -f /usr/lib/armbian-config/jobs.sh ]] && source /usr/lib/armbian-config/jobs.sh || source ${BASH_SOURCE}-jobs
[[ -f /usr/lib/armbian-config/submenu.sh ]] && source /usr/lib/armbian-config/submenu.sh || source ${BASH_SOURCE}-submenu
[[ -f /usr/lib/armbian-config/functions.sh ]] && source /usr/lib/armbian-config/functions.sh || source ${BASH_SOURCE}-functions
[[ -f /usr/lib/armbian-config/functions-network.sh ]] && source /usr/lib/armbian-config/functions-network.sh || source ${BASH_SOURCE}-functions-network
# 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;
fi
if [[ -f ${BASH_SOURCE}-submenu ]]; then source ${BASH_SOURCE}-submenu;
elif [[ -f /usr/lib/armbian-config/submenu.sh ]]; then source /usr/lib/armbian-config/submenu.sh;
else exit 1;
fi
sleep 1
if [[ -f ${BASH_SOURCE}-functions ]]; then source ${BASH_SOURCE}-functions;
elif [[ -f /usr/lib/armbian-config/functions.sh ]]; then source /usr/lib/armbian-config/functions.sh;
else exit 1;
fi
if [[ -f ${BASH_SOURCE}-functions-network ]]; then source ${BASH_SOURCE}-functions-network;
elif [[ -f /usr/lib/armbian-config/functions-network.sh ]]; then source /usr/lib/armbian-config/functions-network.sh;
else exit 1;
fi
# collect info
main "$@"
#-----------------------------------------------------------------------------------------------------------------------------------------#

17
debian-config-functions Normal file → Executable file
View File

@@ -6,8 +6,20 @@
# License version 2. This program is licensed "as is" without any
# warranty of any kind, whether express or implied.
# Functions:
# main
# check_if_installed
# is_package_manager_running
# display_qr_code
# beta_disclaimer
# show_box
# description
# aval_kernel
# aval_dtbs
# get_a20modes
# get_h3modes
# add_choose_user
# configure_desktop
#
# gather info about the board and start with loading menu
@@ -371,4 +383,3 @@ function configure_desktop ()
main "$@"

23
debian-config-functions-network Normal file → Executable file
View File

@@ -6,7 +6,26 @@
# License version 2. This program is licensed "as is" without any
# warranty of any kind, whether express or implied.
# Functions:
# check_hostapd
# check_advanced_modes
# create_if_config
# reload-nety
# check_port
# check_ht_capab
# check_vht_capab
# check_channels
# nm_ip_editor
# systemd_ip_editor
# ip_editor
# wlan_edit_basic
# wlan_edit
# exceptions
# wlan_exceptions
# check_and_warn
# get_wlan_interface
# select_default_interface
# connect_bt_interface
#
@@ -121,7 +140,7 @@ function reload-nety() {
#
# Check if something is running on port $1 and display info
#
check_port ()
function check_port ()
{
[[ -n $(netstat -lnt | awk '$6 == "LISTEN" && $4 ~ ".'$1'"') ]] && dialog --backtitle "$BACKTITLE" --title "Checking service" \
--msgbox "\nIt looks good.\n\nThere is $2 service on port $1" 9 52

2
debian-config-jobs Normal file → Executable file
View File

@@ -21,7 +21,7 @@ function jobs ()
# Application installer
#
"Softy" )
softy
./softy || softy
;;
# Remove BT

8
debian-config-submenu Normal file → Executable file
View File

@@ -6,7 +6,11 @@
# License version 2. This program is licensed "as is" without any
# warranty of any kind, whether express or implied.
# Functions:
# submenu_settings
# submenu_networking
# submenu_personal
# submenu_software
#-----------------------------------------------------------------------------------------------------------------------------------------#
# system
@@ -261,7 +265,7 @@ function submenu_software ()
while true; do
LIST=()
[[ -f /usr/bin/softy ]] && LIST+=( "Softy" "3rd party applications installer" )
[[ -f /usr/bin/softy || -f 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" )