- Show list of existing configurations
- Count users of each configuration
This commit is contained in:
IgorKha 2023-05-29 15:01:01 +05:00
parent 726c9aca82
commit e23944448e

View file

@ -96,9 +96,6 @@ function serverName() {
} }
function installQuestions() { function installQuestions() {
echo "Welcome to WireGuard-MikroTik configurator!"
echo "The git repository is available at: https://github.com/IgorKha/wireguard-mikrotik"
echo ""
echo "I need to ask you a few questions before starting the setup." echo "I need to ask you a few questions before starting the setup."
echo "You can leave the default options and just press enter if you are ok with them." echo "You can leave the default options and just press enter if you are ok with them."
echo "" echo ""
@ -303,8 +300,6 @@ AllowedIPs = ${CLIENT_WG_IPV4}/32,${CLIENT_WG_IPV6}/128" >>"$(pwd)/wireguard/${S
} }
function manageMenu() { function manageMenu() {
echo "Welcome to WireGuard-MikroTik configurator!"
echo "The git repository is available at: https://github.com/IgorKha/wireguard-mikrotik"
echo "" echo ""
echo "It looks like this WireGuard interface is already." echo "It looks like this WireGuard interface is already."
echo "" echo ""
@ -324,9 +319,36 @@ function manageMenu() {
esac esac
} }
#? List of existing configurations
function listConfs() {
local directory
directory="$(pwd)/wireguard"
if [ -d "${directory}" ]; then
echo "List of existing configurations:"
i=1
for folder in "${directory}"/*/; do
local users count folder_name
users="${folder}/client/"
count=$(find "$users" -maxdepth 1 -mindepth 1 -type d 2>/dev/null | wc -l)
folder_name=$(basename "${folder}")
echo "${i}. ${folder_name} [${count} user(s)]"
((i++))
done
fi
echo ""
}
echo ""
echo "Welcome to WireGuard-MikroTik configurator!"
echo "The git repository is available at: https://github.com/IgorKha/wireguard-mikrotik"
echo ""
#? Check for root, OS, WireGuard #? Check for root, OS, WireGuard
installCheck installCheck
listConfs
#? Check server exist #? Check server exist
serverName serverName