Files

55 lines
1.1 KiB
Bash
Raw Permalink Normal View History

2022-09-02 12:17:54 +02:00
#!/usr/bin/env bash
2024-04-10 11:10:52 +02:00
# SPDX-FileCopyrightText: 2024 3mdeb <contact@3mdeb.com>
#
# SPDX-License-Identifier: Apache-2.0
source $DTS_ENV
source $DTS_FUNCS
2024-06-20 15:41:45 +02:00
source $DTS_SUBS
2022-09-02 12:17:54 +02:00
trap : 2
trap : 3
trap wait_for_input EXIT
wait_for_input() {
code=$?
if [[ $code -ne 0 ]]; then
read -p "Press Enter to continue."
fi
exit $code
}
2022-09-02 12:17:54 +02:00
while : ; do
2024-11-12 11:52:07 +01:00
clear
2024-06-21 14:38:26 +02:00
# Do some subscription routine each time menu is rendered:
2024-06-20 15:41:45 +02:00
subscription_routine
2024-06-21 14:38:26 +02:00
# Header should always be printed:
2024-04-10 16:09:44 +02:00
show_header
2024-07-16 11:29:41 +02:00
if [ -z "$DPP_SUBMENU_ACTIVE" ]; then
2024-06-21 14:38:26 +02:00
show_hardsoft_inf
2024-07-16 11:29:41 +02:00
show_dpp_credentials
2024-06-21 14:38:26 +02:00
show_ssh_info
show_main_menu
2024-07-16 11:29:41 +02:00
elif [ -n "$DPP_SUBMENU_ACTIVE" ]; then
show_dpp_submenu
2024-06-21 14:38:26 +02:00
fi
show_footer
2024-04-10 12:29:58 +02:00
2022-09-21 11:26:00 +02:00
echo
2024-11-12 11:52:07 +01:00
read -n 1 OPTION
2022-09-02 12:17:54 +02:00
echo
2024-06-21 14:38:26 +02:00
# If OPTION is being matched with smth inside *_options functions the
# functions return 0 and loop start over, if not: next *_options function is
# being checked:
2024-07-16 11:29:41 +02:00
if [ -z "$DPP_SUBMENU_ACTIVE" ]; then
2024-06-21 14:38:26 +02:00
main_menu_options $OPTION && continue
2024-07-16 11:29:41 +02:00
elif [ -n "$DPP_SUBMENU_ACTIVE" ]; then
dpp_submenu_options $OPTION && continue
2024-06-21 14:38:26 +02:00
fi
2024-06-21 14:38:26 +02:00
footer_options $OPTION
2022-09-02 12:17:54 +02:00
done